boolean (@NotNull Map<Integer, Exprent> mapCaseValue, @NotNull Map<Integer, String> mapCaseClasses) { @NotNull List<List<@Nullable Exprent>> values = myRootSwitchStatement.getCaseValues(); boolean hasPattern = false; for (int caseIndex = 0; caseIndex < values.size(); caseIndex++) { List<Exprent> caseValues = values.get(caseIndex); for (int valueIndex = 0; valueIndex < caseValues.size(); valueIndex++) { Exprent caseValue = caseValues.get(valueIndex); if (!(caseValue instanceof ConstExprent constCaseValue)) { continue; } int expectedValue = constCaseValue.getIntValue(); if (expectedValue == -1) { caseValues.set(valueIndex, new ConstExprent(VARTYPE_NULL, null, null)); } Exprent newCaseValue = mapCaseValue.get(expectedValue); if (newCaseValue == null) { String className = mapCaseClasses.get(expectedValue); if (className == null) { continue; } List<PatternContainer.PatternStatement> guards = myPatternContainer.getPatterns(myRootSwitchStatement.getCaseStatements().get(caseIndex)); if (guards != null && guards.size() == 1) { //if several, they will be remapped later newCaseValue = guards.get(0).variable(); } if (newCaseValue == null) { newCaseValue = JavacReferenceFinder.createDefaultPatternVal(className); } hasPattern = true; } caseValues.set(valueIndex, newCaseValue); } } return hasPattern; }