List<ExpectedTypeInfo> (@NotNull List<PsiType> expectedTypes, boolean mustBeReference, @NotNull PsiSwitchBlock context) { List<ExpectedTypeInfo> result = new ArrayList<>(); Set<PsiType> processedTypes = new HashSet<>(); for (PsiType expectedType : expectedTypes) { if (expectedType == null) { continue; } if (expectedType instanceof PsiClassType classType) { PsiClass resolved = classType.resolve(); if (resolved != null && resolved.isEnum()) { processedTypes.add(expectedType); result.add(createInfoImpl(expectedType, expectedType)); continue; } } if (expectedType.equalsToText(CommonClassNames.JAVA_LANG_STRING) || TypeConversionUtil.isPrimitiveAndNotNullOrWrapper(expectedType)) { if (expectedType instanceof PsiPrimitiveType primitiveType) { if (primitiveType.equals(PsiTypes.longType()) || primitiveType.equals(PsiTypes.doubleType()) || primitiveType.equals(PsiTypes.floatType())) { return List.of(); //unexpected types, let's suggest default } if (mustBeReference) { expectedType = primitiveType.getBoxedType(context); if (expectedType == null) { continue; } } else { addWithWrapper(processedTypes, PsiTypes.intType(), result, context); } } addWithWrapper(processedTypes, expectedType, result, context); continue; } return List.of(); //something unexpected, let's suggest default } return result; }