private static ArrayExprent getEnumArrayExprent(Exprent switchHead, RootStatement root) {
    Exprent candidate = switchHead;

    if (switchHead instanceof FunctionExprent) {
      // Check for switches on a ternary expression like `a != null ? ...SwitchMap[a.ordinal()] : -1` (nullable switch)
      FunctionExprent func = (FunctionExprent) switchHead;
      if (func.getFuncType() == FunctionExprent.FunctionType.TERNARY && func.getLstOperands().size() == 3) {
        List<Exprent> ops = func.getLstOperands();
        if (ops.get(0) instanceof FunctionExprent) {
          FunctionExprent nn = (FunctionExprent) ops.get(0);
          if (nn.getFuncType() == FunctionExprent.FunctionType.NE
                && nn.getLstOperands().get(0) instanceof VarExprent
                && nn.getLstOperands().get(1).getExprType().equals(VarType.VARTYPE_NULL)) {
            // TODO: consider if verifying the variable used is necessary
            // probably not, since the array is checked to be generated (?) so user written code shouldn't encounter bad resugaring
            if (ops.get(2) instanceof ConstExprent) {
              ConstExprent minusOne = (ConstExprent) ops.get(2);
              if (minusOne.getConstType().equals(VarType.VARTYPE_INT) && minusOne.getIntValue() == -1) {
                candidate = ops.get(1);
              }
            }
          }
        }
      }
    }

    if (switchHead instanceof VarExprent) {
      // Check for switches with intermediary assignment of enum array index
      // This happens with Kotlin when expressions on enums.
      VarExprent var = (VarExprent) switchHead;

      if (!"I".equals(var.getVarType().toString())) {
        // Enum array index must be int
        return null;
      }

      List<AssignmentExprent> assignments = getAssignmentsOfWithinOneStatement(root, var);

      if (!assignments.isEmpty()) {
        if (assignments.size() == 1) {
          AssignmentExprent assignment = assignments.get(0);
          candidate = assignment.getRight();
        } else {
          // more than 1 assignment to variable => can't be what we're looking for
          return null;
        }
      }
    }

    return isEnumArray(candidate) ? (ArrayExprent) candidate : null;
  }
Gets the enum array exprent (or null if not found) corresponding to
the switch head. If the switch head itself is an enum array, returns the head.
If it's a variable only assigned to an enum array, returns that array.
src/org/jetbrains/java/decompiler/modules/decompiler/SwitchHelper.java