{"record":{"id":"e4623e2de198556a","repo":"skylot/jadx","slug":"unexpected-field-type-class","errorCode":null,"errorMessage":"Unexpected field type class: ","messagePattern":"Unexpected field type class: ","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/codegen/AnnotationGen.java","lineNumber":196,"sourceCode":"\t\t\t\tcode.add(StringUtils.formatDouble((Double) value));\n\t\t\t\tbreak;\n\t\t\tcase ENCODED_STRING:\n\t\t\t\tcode.add(stringUtils.unescapeString((String) value));\n\t\t\t\tbreak;\n\t\t\tcase ENCODED_TYPE:\n\t\t\t\tclassGen.useType(code, ArgType.parse((String) value));\n\t\t\t\tcode.add(\".class\");\n\t\t\t\tbreak;\n\t\t\tcase ENCODED_ENUM:\n\t\t\tcase ENCODED_FIELD:\n\t\t\t\t// must be a static field\n\t\t\t\tif (value instanceof IFieldRef) {\n\t\t\t\t\tFieldInfo fieldInfo = FieldInfo.fromRef(root, (IFieldRef) value);\n\t\t\t\t\tInsnGen.makeStaticFieldAccess(code, fieldInfo, classGen);\n\t\t\t\t} else if (value instanceof FieldInfo) {\n\t\t\t\t\tInsnGen.makeStaticFieldAccess(code, (FieldInfo) value, classGen);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new JadxRuntimeException(\"Unexpected field type class: \" + value.getClass());\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ENCODED_METHOD:\n\t\t\t\t// TODO\n\t\t\t\tbreak;\n\t\t\tcase ENCODED_ARRAY:\n\t\t\t\tcode.add('{');\n\t\t\t\tIterator<?> it = ((Iterable<?>) value).iterator();\n\t\t\t\twhile (it.hasNext()) {\n\t\t\t\t\tEncodedValue v = (EncodedValue) it.next();\n\t\t\t\t\tencodeValue(cls.root(), code, v);\n\t\t\t\t\tif (it.hasNext()) {\n\t\t\t\t\t\tcode.add(\", \");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcode.add('}');\n\t\t\t\tbreak;\n\t\t\tcase ENCODED_ANNOTATION:","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/codegen/AnnotationGen.java#L178-L214","documentation":"Thrown by AnnotationGen.encodeValue() when processing an ENCODED_ENUM or ENCODED_FIELD annotation value whose backing object is neither an IFieldRef nor a FieldInfo. These are the only two expected types for static field references in annotation values; any other type indicates an internal inconsistency in how the annotation was parsed from the DEX.","triggerScenarios":"Decompiling a DEX/APK where an annotation references a field (enum constant or static field) and the value object produced by the dex parser is an unexpected type. This usually indicates a bug in the annotation attribute processing pipeline or a malformed DEX.","commonSituations":"Obfuscated or modified APKs with non-standard annotation structures. A jadx version regression in annotation parsing that produces a different value wrapper type than expected.","solutions":["Report the APK/APK file as a test case to the jadx project — this is likely an internal jadx bug in annotation processing.","Update to the latest jadx version where the annotation value handling may have been fixed.","As a workaround, exclude the affected class from decompilation or use --no-debug-info / fallback mode."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    annotationGen.encodeValue(root, code, encodedValue);\n} catch (JadxRuntimeException e) {\n    if (e.getMessage().startsWith(\"Unexpected field type class\")) {\n        // Fallback: emit a comment with the raw value instead of failing\n        code.add(\"/* unexpected annotation field value: \" + value + \" */\");\n        logger.warn(\"Skipping annotation field with unexpected type\", e);\n    } else {\n        throw e;\n    }\n}","preventionTips":["This is an internal jadx bug — report the APK to the project.","Use fallback decompilation mode to bypass annotation generation for problematic classes.","Keep jadx updated — annotation processing is actively improved."],"tags":["codegen","annotation","dex","internal-bug"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}