{"record":{"id":"4064fcdd387d1988","repo":"pxb1988/dex2jar","slug":"not-support-yet-methodhandlercontext-type","errorCode":null,"errorMessage":"not support yet: ${methodHandlerContext.type}","messagePattern":"not support yet: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"d2j-smali/src/main/java/com/googlecode/d2j/smali/AntlrSmaliUtil.java","lineNumber":666,"sourceCode":"                value = new MethodHandle(MethodHandle.INSTANCE_PUT, parseFieldAndUnescape(methodHandlerContext.fld.getText()));\n                break;\n            case \"invoke-static\":\n                value = new MethodHandle(MethodHandle.INVOKE_STATIC, parseMethodAndUnescape(methodHandlerContext.mtd.getText()));\n                break;\n            case \"invoke-instance\":\n                value = new MethodHandle(MethodHandle.INVOKE_INSTANCE, parseMethodAndUnescape(methodHandlerContext.mtd.getText()));\n                break;\n            case \"invoke-direct\":\n                value = new MethodHandle(MethodHandle.INVOKE_DIRECT, parseMethodAndUnescape(methodHandlerContext.mtd.getText()));\n                break;\n            case \"invoke-interface\":\n                value = new MethodHandle(MethodHandle.INVOKE_INTERFACE, parseMethodAndUnescape(methodHandlerContext.mtd.getText()));\n                break;\n            case \"invoke-constructor\":\n                value = new MethodHandle(MethodHandle.INVOKE_CONSTRUCTOR, parseMethodAndUnescape(methodHandlerContext.mtd.getText()));\n                break;\n            default:\n                throw new RuntimeException(\"not support yet: \" + methodHandlerContext.type);\n        }\n        return value;\n    }\n\n    private static int findTotalRegisters(SmaliParser.SMethodContext ctx, int ins) {\n        int totalRegisters = -1;\n        List<SmaliParser.SInstructionContext> instructionContexts = ctx.sInstruction();\n        for (SmaliParser.SInstructionContext instructionContext : instructionContexts) {\n            ParserRuleContext parserRuleContext = (ParserRuleContext) instructionContext.getChild(0);\n            if (parserRuleContext != null) {\n                int ruleIndex = parserRuleContext.getRuleIndex();\n                if (ruleIndex == SmaliParser.RULE_fregisters) {\n                    totalRegisters = parseInt(((SmaliParser.FregistersContext) parserRuleContext).xregisters.getText());\n                    break;\n                } else if (ruleIndex == SmaliParser.RULE_flocals) {\n                    totalRegisters = ins + parseInt(((SmaliParser.FlocalsContext) parserRuleContext).xlocals.getText());\n                    break;\n                }","sourceCodeStart":648,"sourceCodeEnd":684,"githubUrl":"https://github.com/pxb1988/dex2jar/blob/b5bda4fb4935ae8b3869b422454ae3b3896c7bc1/d2j-smali/src/main/java/com/googlecode/d2j/smali/AntlrSmaliUtil.java#L648-L684","documentation":"AntlrSmaliUtil parses smali files; when translating a .method-handle directive it maps the invoked type (invoke-static, invoke-instance, invoke-interface, invoke-constructor) to a MethodHandle kind. Any type value not in that set falls into the default branch and throws RuntimeException('not support yet: <type>'). The smali construct itself parsed fine, but its semantics are outside the supported subset.","triggerScenarios":"A smali file contains a .method-handle (or similar) directive whose type field is not one of invoke-static/invoke-instance/invoke-interface/invoke-constructor, e.g. a newer or malformed type string, processed via AntlrSmaliUtil.parse or d2j-smali tools.","commonSituations":"Smali emitted by newer toolchains introducing handle types this dex2jar version predates; hand-edited smali with a misspelled invoke type; a newer dex2jar/smali spec feature used with an older library build.","solutions":["Check the reported type string for typos and correct it to a supported value (invoke-static/invoke-instance/invoke-interface/invoke-constructor).","Upgrade dex2jar to a version whose AntlrSmaliUtil supports the newer handle type.","Remove or rewrite the unsupported directive in the smali source.","Catch the RuntimeException around parsing to identify and skip/patch the offending file.","Report/support the missing type in a patched AntlrSmaliUtil if the type is legitimately valid smali."],"exampleFix":"// before\n.method-handle invoke-dynamic LFoo;->bar()V\n\n// after\n.method-handle invoke-static LFoo;->bar()V","handlingStrategy":"validation","validationCode":"Set<String> supported = Set.of(\"invoke-static\",\"invoke-instance\",\"invoke-interface\",\"invoke-constructor\");\nfor (String line : Files.readAllLines(smaliFile)) {\n    if (line.strip().startsWith(\".method-handle\")) {\n        String type = line.strip().split(\"\\\\s+\")[1];\n        if (!supported.contains(type)) throw new IllegalStateException(\"Unsupported handle type: \" + type);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    AntlrSmaliUtil.parse(file);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"not support yet:\")) {\n        System.err.println(\"Unsupported smali construct: \" + e.getMessage() + \" — upgrade dex2jar or patch the smali.\");\n    } else throw e;\n}","preventionTips":["Keep dex2jar updated to cover newer smali method-handle types.","Pre-validate .method-handle type strings against the supported set.","Avoid hand-editing invoke type tokens in smali sources.","Isolate and inspect files that fail parsing instead of failing the whole batch."],"tags":["smali","parser","unsupported"],"backgroundTag":"unsupported-operation","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"}