{"record":{"id":"2b0dd54f65551953","repo":"wasabeef/android-gpuimage","slug":"unknown-rotation","errorCode":null,"errorMessage":"Unknown Rotation!","messagePattern":"Unknown Rotation!","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"warning","filePath":"library/src/main/java/jp/co/cyberagent/android/gpuimage/util/Rotation.java","lineNumber":38,"sourceCode":"    NORMAL, ROTATION_90, ROTATION_180, ROTATION_270;\n\n    /**\n     * Retrieves the int representation of the Rotation.\n     *\n     * @return 0, 90, 180 or 270\n     */\n    public int asInt() {\n        switch (this) {\n            case NORMAL:\n                return 0;\n            case ROTATION_90:\n                return 90;\n            case ROTATION_180:\n                return 180;\n            case ROTATION_270:\n                return 270;\n            default:\n                throw new IllegalStateException(\"Unknown Rotation!\");\n        }\n    }\n\n    /**\n     * Create a Rotation from an integer. Needs to be either 0, 90, 180 or 270.\n     *\n     * @param rotation 0, 90, 180 or 270\n     * @return Rotation object\n     */\n    public static Rotation fromInt(int rotation) {\n        switch (rotation) {\n            case 0:\n                return NORMAL;\n            case 90:\n                return ROTATION_90;\n            case 180:\n                return ROTATION_180;\n            case 270:","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/wasabeef/android-gpuimage/blob/ceea576ec931c2968431ad46f1fb2e6d68a542e2/library/src/main/java/jp/co/cyberagent/android/gpuimage/util/Rotation.java#L20-L56","documentation":"Rotation.asInt() maps the four enum constants (NORMAL/ROTATION_90/ROTATION_180/ROTATION_270) to degrees; the default branch throws IllegalStateException(\"Unknown Rotation!\"). This is a defensive branch for enum values outside the known set.","triggerScenarios":"Only reachable if a Rotation enum value exists that asInt() does not handle — e.g. adding a new enum constant (like a ROTATION_45) without updating asInt()'s switch, or reflection/obfuscation-produced mismatched enum state.","commonSituations":"Library/enum version skew where code compiled against a newer Rotation enum runs on an older switch; custom forks adding constants; R8/ProGuard changes are unlikely but non-exhaustive switches on enums are the root cause.","solutions":["Update the switch in Rotation.asInt() to cover every declared enum constant.","Align library versions — recompile/upgrade so the Rotation enum and its consumers match.","Replace the default-throw with exhaustive handling (Java: no default throw; Kotlin: when expression without else to get compile-time exhaustiveness)."],"exampleFix":"// before\ndefault:\n    throw new IllegalStateException(\"Unknown Rotation!\");\n// after\n// make the switch exhaustive over all Rotation constants so the compiler catches missing cases\n ROTATION_0 -> 0; ROTATION_90 -> 90; ROTATION_180 -> 180; ROTATION_270 -> 270; // no default throw","handlingStrategy":"type-guard","validationCode":"if (rotation == null) { /* handle null before asInt() */ }","typeGuard":"boolean isKnownRotation(Rotation r) {\n    return r == Rotation.NORMAL || r == Rotation.ROTATION_90\n        || r == Rotation.ROTATION_180 || r == Rotation.ROTATION_270;\n}","tryCatchPattern":"try {\n    int degrees = rotation.asInt();\n} catch (IllegalStateException e) {\n    degrees = 0; // default to NORMAL on unknown rotation\n}","preventionTips":["Keep enum switches exhaustive; prefer compile-time-checked when expressions in Kotlin","Rebuild consumers when upgrading the library so enums stay in sync","Avoid custom forked Rotation constants"],"tags":["android","gpuimage","enum","exhaustiveness"],"backgroundTag":"unsupported-enum-value","analyzedSha":"ceea576ec931c2968431ad46f1fb2e6d68a542e2","analyzedAt":"2026-09-11T16:56:13.742Z","contentChangedAt":"2026-09-11T16:56:13.742Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}