{"record":{"id":"e944849d4b57e95b","repo":"skylot/jadx","slug":"unknown-if-operations-type","errorCode":null,"errorMessage":"Unknown if operations type: {}","messagePattern":"Unknown if operations type: (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"warning","filePath":"jadx-core/src/main/java/jadx/core/dex/instructions/IfOp.java","lineNumber":41,"sourceCode":"\tpublic IfOp invert() {\n\t\tswitch (this) {\n\t\t\tcase EQ:\n\t\t\t\treturn NE;\n\t\t\tcase NE:\n\t\t\t\treturn EQ;\n\n\t\t\tcase LT:\n\t\t\t\treturn GE;\n\t\t\tcase LE:\n\t\t\t\treturn GT;\n\n\t\t\tcase GT:\n\t\t\t\treturn LE;\n\t\t\tcase GE:\n\t\t\t\treturn LT;\n\n\t\t\tdefault:\n\t\t\t\tthrow new JadxRuntimeException(\"Unknown if operations type: \" + this);\n\t\t}\n\t}\n}\n","sourceCodeStart":23,"sourceCodeEnd":45,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/dex/instructions/IfOp.java#L23-L45","documentation":"Thrown by IfOp.invert() in its default branch. IfOp is a closed enum of six comparison ops (EQ, NE, LT, LE, GT, GE), all of which are handled. The default branch is therefore effectively dead code - it can only fire if a new IfOp constant is added without updating invert(), or via unsafe enum trickery. It is a defensive completeness guard, not a realistic runtime failure.","triggerScenarios":"Realistically unreachable with the current enum. Would fire only if a new IfOp value were added (e.g. a hypothetical unsigned compare) without adding its case to invert(), or if reflection/serialisation produced a non-standard IfOp instance.","commonSituations":"Virtually never seen in practice. The only realistic trigger is a jadx source change that adds an enum constant and forgets invert(); static analysis (enum completeness checks) usually catches this at compile time.","solutions":["Confirm you are on a released jadx build - on stock builds this branch does not execute.","If maintaining jadx and adding a new IfOp, update invert() in the same change and add a unit test.","No caller-side mitigation is needed; this is internal-only.","If genuinely hit, file a jadx bug - it indicates a source-level omission."],"exampleFix":"// before (default reachable in principle)\nswitch (this) {\n    case EQ: return NE;\n    // ...\n    case GE: return LT;\n    default: throw new JadxRuntimeException(\"Unknown if operations type: \" + this);\n}\n\n// after (make exhaustive; rely on compiler, or assert unreachable)\nswitch (this) {\n    case EQ: return NE;\n    case NE: return EQ;\n    case LT: return GE;\n    case LE: return GT;\n    case GT: return LE;\n    case GE: return LT;\n}\nthrow new IllegalStateException(\"Unreachable IfOp: \" + this);","handlingStrategy":"validation","validationCode":"// No caller-side validation needed; IfOp is a closed enum.\n// If you add an IfOp constant, keep invert() exhaustive:\nswitch (op) {\n    case EQ: case NE: case LT: case LE: case GT: case GE: break;\n    default: throw new AssertionError(\"Unhandled IfOp: \" + op);\n}","typeGuard":"// Exhaustive check after adding constants\nstatic boolean invertSupported(IfOp op) {\n    return op == IfOp.EQ || op == IfOp.NE || op == IfOp.LT\n        || op == IfOp.LE || op == IfOp.GT || op == IfOp.GE;\n}","tryCatchPattern":"IfOp inverted;\ntry {\n    inverted = op.invert();\n} catch (JadxRuntimeException e) {\n    // should not happen on a stock build\n    throw new AssertionError(\"Unreachable: IfOp.invert failed for \" + op, e);\n}","preventionTips":["Keep invert() exhaustive whenever a new IfOp constant is added.","Add a unit test covering invert() for every constant.","Rely on the closed enum; no runtime mitigation is required for callers."],"tags":["bytecode","enum","dead-code","defensive"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}