pxb1988/dex2jar · error · IllegalArgumentException

Illegal LDC constant

Error message

Illegal LDC constant 

What it means

Validation branch in J2IRConverter.newOperation for the LDC bytecode: the pushed constant is a known-but-unusable type for dex IR (the message appends the constant/class), i.e. it is not Integer, Float, Long, Double, String, Type, or Handle — for example a Boolean, Character, Short, Byte, or a dynamic ConstantDesc from a class compiled with condy/invokedynamic support. The faulting input is the constant operand of the LDC instruction.

Solutions

  1. Inspect the constant named in the message; javap -c the offending class to see the LDC
  2. Recompile the source with constants the tool supports, or convert small primitive constants (Boolean/Short/etc.) into Integer constants in the bytecode
  3. Report the case upstream so the converter gains a branch for that constant type
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at dex-translator/src/main/java/com/googlecode/d2j/converter/J2IRConverter.java:379 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at dex-translator/src/main/java/com/googlecode/d2j/converter/J2IRConverter.java:379

                        if (cst instanceof Integer) {
                            return b(1, Exprs.nInt((Integer) cst));
                        } else if (cst instanceof Float) {
                            return b(1, Exprs.nFloat((Float) cst));
                        } else if (cst instanceof Long) {
                            return b(2, Exprs.nLong((Long) cst));
                        } else if (cst instanceof Double) {
                            return b(2, Exprs.nDouble((Double) cst));
                        } else if (cst instanceof String) {
                            return b(1, Exprs.nString((String) cst));
                        } else if (cst instanceof Type) {
                            Type type = (Type) cst;
                            int sort = type.getSort();
                            if (sort == Type.OBJECT || sort == Type.ARRAY) {
                                return b(1, Exprs.nType(type.getDescriptor()));
                            } else if (sort == Type.METHOD) {
                                throw new UnsupportedOperationException("Not supported yet.");
                            } else {
                                throw new IllegalArgumentException("Illegal LDC constant " + cst);
                            }
                        } else if (cst instanceof Handle) {
                            throw new UnsupportedOperationException("Not supported yet.");
                        } else {
                            throw new IllegalArgumentException("Illegal LDC constant " + cst);
                        }
                    case JSR:
                        throw new UnsupportedOperationException("Not supported yet.");
                    case GETSTATIC:
                        FieldInsnNode fin = (FieldInsnNode) insn;
                        return b(Type.getType(fin.desc).getSize(), Exprs.nStaticField("L" + fin.owner + ";", fin.name,
                                fin.desc));
                    case NEW:
                        return b(1, Exprs.nNew("L" + ((TypeInsnNode) insn).desc + ";"));
                    default:
                        throw new Error("Internal error.");
                }
            }

View on GitHub (pinned to b5bda4fb49)