pxb1988/dex2jar · error · RuntimeException

not support yet

Error message

not support yet: ${methodHandlerContext.type}

What it means

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.

Solutions

  1. Check the reported type string for typos and correct it to a supported value (invoke-static/invoke-instance/invoke-interface/invoke-constructor).
  2. Upgrade dex2jar to a version whose AntlrSmaliUtil supports the newer handle type.
  3. Remove or rewrite the unsupported directive in the smali source.
  4. Catch the RuntimeException around parsing to identify and skip/patch the offending file.
  5. Report/support the missing type in a patched AntlrSmaliUtil if the type is legitimately valid smali.

Example fix

// before
.method-handle invoke-dynamic LFoo;->bar()V

// after
.method-handle invoke-static LFoo;->bar()V
Defensive patterns

Strategy: validation

Validate before calling

Set<String> supported = Set.of("invoke-static","invoke-instance","invoke-interface","invoke-constructor");
for (String line : Files.readAllLines(smaliFile)) {
    if (line.strip().startsWith(".method-handle")) {
        String type = line.strip().split("\\s+")[1];
        if (!supported.contains(type)) throw new IllegalStateException("Unsupported handle type: " + type);
    }
}

Try / catch

try {
    AntlrSmaliUtil.parse(file);
} catch (RuntimeException e) {
    if (e.getMessage().startsWith("not support yet:")) {
        System.err.println("Unsupported smali construct: " + e.getMessage() + " — upgrade dex2jar or patch the smali.");
    } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of pxb1988/dex2jar@b5bda4fb49 (2026-09-08). Data as JSON: /api/errors/4064fcdd387d1988. Report an issue: GitHub.

Appendix: source

Thrown at d2j-smali/src/main/java/com/googlecode/d2j/smali/AntlrSmaliUtil.java:666

                value = new MethodHandle(MethodHandle.INSTANCE_PUT, parseFieldAndUnescape(methodHandlerContext.fld.getText()));
                break;
            case "invoke-static":
                value = new MethodHandle(MethodHandle.INVOKE_STATIC, parseMethodAndUnescape(methodHandlerContext.mtd.getText()));
                break;
            case "invoke-instance":
                value = new MethodHandle(MethodHandle.INVOKE_INSTANCE, parseMethodAndUnescape(methodHandlerContext.mtd.getText()));
                break;
            case "invoke-direct":
                value = new MethodHandle(MethodHandle.INVOKE_DIRECT, parseMethodAndUnescape(methodHandlerContext.mtd.getText()));
                break;
            case "invoke-interface":
                value = new MethodHandle(MethodHandle.INVOKE_INTERFACE, parseMethodAndUnescape(methodHandlerContext.mtd.getText()));
                break;
            case "invoke-constructor":
                value = new MethodHandle(MethodHandle.INVOKE_CONSTRUCTOR, parseMethodAndUnescape(methodHandlerContext.mtd.getText()));
                break;
            default:
                throw new RuntimeException("not support yet: " + methodHandlerContext.type);
        }
        return value;
    }

    private static int findTotalRegisters(SmaliParser.SMethodContext ctx, int ins) {
        int totalRegisters = -1;
        List<SmaliParser.SInstructionContext> instructionContexts = ctx.sInstruction();
        for (SmaliParser.SInstructionContext instructionContext : instructionContexts) {
            ParserRuleContext parserRuleContext = (ParserRuleContext) instructionContext.getChild(0);
            if (parserRuleContext != null) {
                int ruleIndex = parserRuleContext.getRuleIndex();
                if (ruleIndex == SmaliParser.RULE_fregisters) {
                    totalRegisters = parseInt(((SmaliParser.FregistersContext) parserRuleContext).xregisters.getText());
                    break;
                } else if (ruleIndex == SmaliParser.RULE_flocals) {
                    totalRegisters = ins + parseInt(((SmaliParser.FlocalsContext) parserRuleContext).xlocals.getText());
                    break;
                }

View on GitHub (pinned to b5bda4fb49)