{"record":{"id":"6565eb6d148b377f","repo":"skylot/jadx","slug":"null-class-type","errorCode":null,"errorMessage":"Null class type","messagePattern":"Null class type","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/dex/info/ClassInfo.java","lineNumber":52,"sourceCode":"\t\tif (cls != null) {\n\t\t\treturn cls;\n\t\t}\n\t\tboolean canBeInner = root.getArgs().isMoveInnerClasses();\n\t\tClassInfo newClsInfo = new ClassInfo(root, clsType, canBeInner);\n\t\treturn root.getInfoStorage().putCls(newClsInfo);\n\t}\n\n\tpublic static ClassInfo fromName(RootNode root, String clsName) {\n\t\treturn fromType(root, ArgType.object(clsName));\n\t}\n\n\tpublic static ClassInfo fromNameWithoutCache(RootNode root, String fullClsName, boolean canBeInner) {\n\t\treturn new ClassInfo(root, ArgType.object(fullClsName), canBeInner);\n\t}\n\n\tprivate static ArgType checkClassType(ArgType type) {\n\t\tif (type == null) {\n\t\t\tthrow new JadxRuntimeException(\"Null class type\");\n\t\t}\n\t\tif (type.isArray()) {\n\t\t\t// TODO: check case with method declared in array class like ( clone in int[])\n\t\t\treturn ArgType.OBJECT;\n\t\t}\n\t\tif (!type.isObject() || type.isGenericType()) {\n\t\t\tthrow new JadxRuntimeException(\"Not class type: \" + type);\n\t\t}\n\t\tif (type.isGeneric()) {\n\t\t\treturn ArgType.object(type.getObject());\n\t\t}\n\t\treturn type;\n\t}\n\n\tpublic void changeShortName(String aliasName) {\n\t\tClassAliasInfo newAlias;\n\t\tString aliasPkg = getAliasPkg();\n\t\tif (Objects.equals(name, aliasName) || StringUtils.isEmpty(aliasName)) {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/dex/info/ClassInfo.java#L34-L70","documentation":"Thrown by ClassInfo.checkClassType when the ArgType passed to build a ClassInfo is null. Every ClassInfo must be backed by a non-null class type; a null type is an unrecoverable programming error rather than bad input data.","triggerScenarios":"Calling ClassInfo.fromType / fromName / the constructor with a null ArgType, or a code path where ArgType.object(null) produced a null. Reachable from any class-resolution path that fails to supply a type.","commonSituations":"Library/plugin code that resolves a class by a name that yielded null; a malformed type string parsed to null; NPE-masked flows where the type field was never set.","solutions":["Ensure a non-null ArgType is always supplied; guard the caller with Objects.requireNonNull(type, \"class type\").","If the class name may be unknown, check it before calling fromName and handle the missing-class case explicitly.","Trace which caller passed null - it usually indicates a prior parsing/resolution failure that should have been handled earlier.","Add a unit test asserting fromName rejects null with a clear message."],"exampleFix":"// before\nArgType type = resolveType(maybeNull);\nClassInfo info = ClassInfo.fromType(root, type); // throws if type null\n\n// after\nArgType type = resolveType(maybeNull);\nif (type == null) {\n    throw new IllegalArgumentException(\"Class type could not be resolved for: \" + maybeNull);\n}\nClassInfo info = ClassInfo.fromType(root, type);","handlingStrategy":"validation","validationCode":"if (type == null) {\n    throw new IllegalArgumentException(\"Cannot build ClassInfo from null type\");\n}","typeGuard":"static boolean isNonNullOrThrow(ArgType t, String ctx) {\n    if (t == null) throw new IllegalArgumentException(\"Null type in \" + ctx);\n    return true;\n}","tryCatchPattern":"ClassInfo info;\ntry {\n    info = ClassInfo.fromType(root, type);\n} catch (JadxRuntimeException e) {\n    throw new IllegalArgumentException(\"Class type was null; resolve the name first\", e);\n}","preventionTips":["Resolve class names to non-null types before building ClassInfo.","Guard with Objects.requireNonNull at the call boundary.","Investigate why a prior resolution step produced null - fix it upstream."],"tags":["classinfo","type-system","precondition","null-check"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}