{"record":{"id":"aed891010a353da2","repo":"pxb1988/dex2jar","slug":"illegal-ldc-constant","errorCode":null,"errorMessage":"Illegal LDC constant ","messagePattern":"Illegal LDC constant ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dex-translator/src/main/java/com/googlecode/d2j/converter/J2IRConverter.java","lineNumber":379,"sourceCode":"                        if (cst instanceof Integer) {\n                            return b(1, Exprs.nInt((Integer) cst));\n                        } else if (cst instanceof Float) {\n                            return b(1, Exprs.nFloat((Float) cst));\n                        } else if (cst instanceof Long) {\n                            return b(2, Exprs.nLong((Long) cst));\n                        } else if (cst instanceof Double) {\n                            return b(2, Exprs.nDouble((Double) cst));\n                        } else if (cst instanceof String) {\n                            return b(1, Exprs.nString((String) cst));\n                        } else if (cst instanceof Type) {\n                            Type type = (Type) cst;\n                            int sort = type.getSort();\n                            if (sort == Type.OBJECT || sort == Type.ARRAY) {\n                                return b(1, Exprs.nType(type.getDescriptor()));\n                            } else if (sort == Type.METHOD) {\n                                throw new UnsupportedOperationException(\"Not supported yet.\");\n                            } else {\n                                throw new IllegalArgumentException(\"Illegal LDC constant \" + cst);\n                            }\n                        } else if (cst instanceof Handle) {\n                            throw new UnsupportedOperationException(\"Not supported yet.\");\n                        } else {\n                            throw new IllegalArgumentException(\"Illegal LDC constant \" + cst);\n                        }\n                    case JSR:\n                        throw new UnsupportedOperationException(\"Not supported yet.\");\n                    case GETSTATIC:\n                        FieldInsnNode fin = (FieldInsnNode) insn;\n                        return b(Type.getType(fin.desc).getSize(), Exprs.nStaticField(\"L\" + fin.owner + \";\", fin.name,\n                                fin.desc));\n                    case NEW:\n                        return b(1, Exprs.nNew(\"L\" + ((TypeInsnNode) insn).desc + \";\"));\n                    default:\n                        throw new Error(\"Internal error.\");\n                }\n            }","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/pxb1988/dex2jar/blob/b5bda4fb4935ae8b3869b422454ae3b3896c7bc1/dex-translator/src/main/java/com/googlecode/d2j/converter/J2IRConverter.java#L361-L397","documentation":"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.","triggerScenarios":"Thrown at dex-translator/src/main/java/com/googlecode/d2j/converter/J2IRConverter.java:379 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the constant named in the message; javap -c the offending class to see the LDC","Recompile the source with constants the tool supports, or convert small primitive constants (Boolean/Short/etc.) into Integer constants in the bytecode","Report the case upstream so the converter gains a branch for that constant type"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}