skylot/jadx · warning · JadxRuntimeException

Unknown if operations type: {}

Error message

Unknown if operations type: {}

What it means

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.

Source

Thrown at jadx-core/src/main/java/jadx/core/dex/instructions/IfOp.java:41

	public IfOp invert() {
		switch (this) {
			case EQ:
				return NE;
			case NE:
				return EQ;

			case LT:
				return GE;
			case LE:
				return GT;

			case GT:
				return LE;
			case GE:
				return LT;

			default:
				throw new JadxRuntimeException("Unknown if operations type: " + this);
		}
	}
}

View on GitHub (pinned to e738a26571)

Solutions

  1. Confirm you are on a released jadx build - on stock builds this branch does not execute.
  2. If maintaining jadx and adding a new IfOp, update invert() in the same change and add a unit test.
  3. No caller-side mitigation is needed; this is internal-only.
  4. If genuinely hit, file a jadx bug - it indicates a source-level omission.

Example fix

// before (default reachable in principle)
switch (this) {
    case EQ: return NE;
    // ...
    case GE: return LT;
    default: throw new JadxRuntimeException("Unknown if operations type: " + this);
}

// after (make exhaustive; rely on compiler, or assert unreachable)
switch (this) {
    case EQ: return NE;
    case NE: return EQ;
    case LT: return GE;
    case LE: return GT;
    case GT: return LE;
    case GE: return LT;
}
throw new IllegalStateException("Unreachable IfOp: " + this);
Defensive patterns

Strategy: validation

Validate before calling

// No caller-side validation needed; IfOp is a closed enum.
// If you add an IfOp constant, keep invert() exhaustive:
switch (op) {
    case EQ: case NE: case LT: case LE: case GT: case GE: break;
    default: throw new AssertionError("Unhandled IfOp: " + op);
}

Type guard

// Exhaustive check after adding constants
static boolean invertSupported(IfOp op) {
    return op == IfOp.EQ || op == IfOp.NE || op == IfOp.LT
        || op == IfOp.LE || op == IfOp.GT || op == IfOp.GE;
}

Try / catch

IfOp inverted;
try {
    inverted = op.invert();
} catch (JadxRuntimeException e) {
    // should not happen on a stock build
    throw new AssertionError("Unreachable: IfOp.invert failed for " + op, e);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14). Data as JSON: /api/errors/e944849d4b57e95b. Report an issue: GitHub.