IDEA-172200 Decompiler switch-on-enum multiple switches in same class generates wrong cases for all but the first switch-on-enum
This commit is contained in:
@@ -37,8 +37,9 @@ public class SwitchHelper {
|
||||
List<List<Exprent>> caseValues = switchStatement.getCaseValues();
|
||||
Map<Exprent, Exprent> mapping = new HashMap<>(caseValues.size());
|
||||
ArrayExprent array = (ArrayExprent)value;
|
||||
FieldExprent arrayField = (FieldExprent)array.getArray();
|
||||
ClassesProcessor.ClassNode classNode =
|
||||
DecompilerContext.getClassProcessor().getMapRootClasses().get(((FieldExprent)array.getArray()).getClassname());
|
||||
DecompilerContext.getClassProcessor().getMapRootClasses().get(arrayField.getClassname());
|
||||
if (classNode != null) {
|
||||
MethodWrapper wrapper = classNode.getWrapper().getMethodWrapper(CodeConstants.CLINIT_NAME, "()V");
|
||||
if (wrapper != null) {
|
||||
@@ -48,7 +49,7 @@ public class SwitchHelper {
|
||||
if (exprent instanceof AssignmentExprent) {
|
||||
AssignmentExprent assignment = (AssignmentExprent)exprent;
|
||||
Exprent left = assignment.getLeft();
|
||||
if (isEnumArray(left)) {
|
||||
if (left.type == Exprent.EXPRENT_ARRAY && ((ArrayExprent)left).getArray().equals(arrayField)) {
|
||||
mapping.put(assignment.getRight(), ((InvocationExprent)((ArrayExprent)left).getIndex()).getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user