{"record":{"id":"2ea7f335bfda2c17","repo":"skylot/jadx","slug":"unknown-visibility-flags","errorCode":null,"errorMessage":"Unknown visibility flags: {}","messagePattern":"Unknown visibility flags: (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/dex/info/AccessInfo.java","lineNumber":263,"sourceCode":"\t\t\tcode.append(\"/* synthetic */ \");\n\t\t}\n\t\treturn code.toString();\n\t}\n\n\tpublic String visibilityName() {\n\t\tif (isPackagePrivate()) {\n\t\t\treturn \"package-private\";\n\t\t}\n\t\tif (isPublic()) {\n\t\t\treturn \"public\";\n\t\t}\n\t\tif (isPrivate()) {\n\t\t\treturn \"private\";\n\t\t}\n\t\tif (isProtected()) {\n\t\t\treturn \"protected\";\n\t\t}\n\t\tthrow new JadxRuntimeException(\"Unknown visibility flags: \" + getVisibility());\n\t}\n\n\tpublic int rawValue() {\n\t\treturn accFlags;\n\t}\n\n\t@Override\n\tpublic String toString() {\n\t\treturn \"AccessInfo: \" + type + \" 0x\" + Integer.toHexString(accFlags) + \" (\" + makeString(true) + ')';\n\t}\n}\n","sourceCodeStart":245,"sourceCodeEnd":275,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/dex/info/AccessInfo.java#L245-L275","documentation":"Thrown by AccessInfo.makeString (visibility-to-label path) when none of isPackagePrivate/isPublic/isPrivate/isProtected is true. This means the access flags have no recognised visibility combination at all - a state the type system considers impossible for valid JVM access flags.","triggerScenarios":"AccessInfo built from access flags where the visibility bits are inconsistent with the four predicates (e.g. flags that are zero-but-not-detected-as-package-private, or a custom AccessInfo constructed without normalisation). It is the string-form counterpart of error 87's ordering failure.","commonSituations":"Corrupted/obfuscated access flags; an AccessInfo constructed directly with raw flags that skip normalisation; combination of flags that defeats all four predicates (rare, since PUBLIC=0x1 always satisfies isPublic).","solutions":["Inspect getVisibility() (printed in the message) to see the actual mask.","Normalise flags at AccessInfo construction so exactly one visibility bit is set.","If using jadx as a library, pass well-formed access flags (from a real Class/Member) rather than hand-crafted masks.","Treat as malformed input and report/fallback to 'package-private'."],"exampleFix":"// before\nif (isProtected()) { return \"protected\"; }\nthrow new JadxRuntimeException(\"Unknown visibility flags: \" + getVisibility());\n\n// after (fall back instead of aborting string rendering)\nLOG.warn(\"Unknown visibility flags: 0x{}\", Integer.toHexString(accFlags));\nreturn \"package-private\";","handlingStrategy":"validation","validationCode":"int vis = getVisibility();\nif (Integer.bitCount(vis & (AccessFlags.PUBLIC | AccessFlags.PROTECTED | AccessFlags.PRIVATE)) == 0 && vis != 0) {\n    LOG.warn(\"Unrecognised visibility mask 0x{}\", Integer.toHexString(vis));\n}","typeGuard":"static boolean hasKnownVisibility(AccessInfo ai) {\n    return ai.isPackagePrivate() || ai.isPublic() || ai.isPrivate() || ai.isProtected();\n}","tryCatchPattern":"String label;\ntry {\n    label = ai.visibilityString();\n} catch (JadxRuntimeException e) {\n    label = \"package-private\"; // safe fallback\n}","preventionTips":["Normalise access flags at construction so exactly one visibility predicate is true.","Always pass well-formed access flags (from real Class/Member reflection) rather than hand-crafted masks.","Use a safe fallback when stringifying unknown flags rather than aborting output."],"tags":["access-flags","bytecode","invariant","stringification"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}