{"record":{"id":"0b5ad25ac1916e30","repo":"pxb1988/dex2jar","slug":"arguments-not-equal","errorCode":null,"errorMessage":"arguments not equal: ","messagePattern":"arguments not equal: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"dex-tools/src/main/java/com/googlecode/d2j/tools/jar/InvocationWeaver.java","lineNumber":449,"sourceCode":"                        Type[] orgArgs = Type.getArgumentTypes(desc);\n                        Type nRet = Type.getReturnType(mapTo.desc);\n                        Type[] nArgs = Type.getArgumentTypes(mapTo.desc);\n                        if (orgRet.getSort() != Type.VOID && nRet.getSort() == Type.VOID) {\n                            throw new RuntimeException(\"can't cast \" + nRet + \" to \" + orgRet);\n                        }\n\n                        if (nArgs.length == 1 && nArgs[0].getDescriptor().equals(invocationInterfaceDesc)) {\n                            MtdInfo t = new MtdInfo();\n                            t.owner = \"L\" + owner + \";\";\n                            t.name = name;\n                            t.desc = desc;\n                            MtdInfo n = newMethodA(opcode, t, mapTo);\n                            super.visitMethodInsn(INVOKESTATIC, clzName, n.name, n.desc, isInterface);\n                        } else { // simple replace\n                            // checking for invalid replace\n                            if (isStatic) {\n                                if (!Arrays.deepEquals(orgArgs, nArgs)) {\n                                    throw new RuntimeException(\"arguments not equal: \" + owner + \".\" + name + desc\n                                            + \" <> \" + mapTo.owner + \".\" + mapTo.name + mapTo.desc);\n                                }\n                            } else {\n                                if (nArgs.length != orgArgs.length + 1) {\n                                    throw new RuntimeException(\"arguments not equal: \" + owner + \".\" + name + desc\n                                            + \" <> \" + mapTo.owner + \".\" + mapTo.name + mapTo.desc);\n                                }\n                                if (orgArgs.length > 0) {\n                                    for (int i = 0; i < orgArgs.length; i++) {\n                                        if (!orgArgs[i].equals(nArgs[i + 1])) {\n                                            throw new RuntimeException(\"arguments not equal: \" + owner + \".\" + name\n                                                    + desc + \" <> \" + mapTo.owner + \".\" + mapTo.name + mapTo.desc);\n                                        }\n                                    }\n                                }\n                            }\n                            // replace it!\n                            super.visitMethodInsn(INVOKESTATIC, toInternal(mapTo.owner), mapTo.name, mapTo.desc, isInterface);","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/pxb1988/dex2jar/blob/b5bda4fb4935ae8b3869b422454ae3b3896c7bc1/dex-tools/src/main/java/com/googlecode/d2j/tools/jar/InvocationWeaver.java#L431-L467","documentation":"Thrown by InvocationWeaver.visitMethodInsn during a 'simple replace' of a STATIC invocation: for INVOKESTATIC the replacement must take exactly the same argument list as the original (no receiver), and Arrays.deepEquals(orgArgs, nArgs) fails when the descriptors differ in any way.","triggerScenarios":"Mapping a static method call to another static method whose argument types (count or order) differ from the original, e.g. replacing '(II)V' with '(ILjava/lang/String;)V'.","commonSituations":"Hand-written weaving configs where the replacement method was refactored to accept different parameters, or mapping a static method to one intended for instance calls.","solutions":["Align the replacement method's parameter list with the original (same count, types, and order).","Use an invocation-interface mapping (mapTo taking the Invocation interface) instead of simple replace if argument adaptation is needed.","Fix descriptor typos in the config so the mapped descriptor matches the original argument types."],"exampleFix":"// before: replacing static '(II)V' with '(ILjava/lang/String;)V'\nmapTo = Lcom/X;->f(ILjava/lang/String;)V\n// after\nmapTo = Lcom/X;->f(II)V","handlingStrategy":"validation","validationCode":"// validate static->static replacement signatures before weaving\nType[] orgArgs = Type.getArgumentTypes(original.desc);\nType[] nArgs = Type.getArgumentTypes(mapTo.desc);\nif (!Arrays.deepEquals(orgArgs, nArgs)) {\n    throw new IllegalArgumentException(\"static replacement must keep identical arguments: \"\n        + Arrays.toString(orgArgs) + \" vs \" + Arrays.toString(nArgs));\n}","typeGuard":null,"tryCatchPattern":"try {\n    new InvocationWeaver(cfg).weave();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"arguments not equal\")) {\n        throw new IllegalStateException(\"Fix the mapping so replacement arguments match the original\", e);\n    }\n    throw e;\n}","preventionTips":["Keep static replacements with the exact same parameter list","Use the Invocation-interface mapping style when argument adaptation is required","Diff mapTo descriptors against original descriptors in CI before weaving"],"tags":["bytecode","weaving","argument-mismatch"],"backgroundTag":"invalid-argument-value","analyzedSha":"b5bda4fb4935ae8b3869b422454ae3b3896c7bc1","analyzedAt":"2026-09-08T00:44:01.258Z","contentChangedAt":"2026-09-08T00:44:01.258Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}