boolean (PsiType type) { if (type == null) return true; if (!type.isValid()) return true; if (type instanceof PsiClassType psiClassType){ if (psiClassType.resolve() == null) return true; final PsiType[] types = psiClassType.getParameters(); for (PsiType paramType : types) { if (paramType instanceof PsiPrimitiveType || (paramType instanceof PsiWildcardType && ((PsiWildcardType)paramType).getBound() instanceof PsiPrimitiveType)) { return true; } if (isIllegalTypeMigration(paramType)) return true; } } if (type instanceof PsiArrayType) { PsiType componentType = type.getDeepComponentType(); if (PsiTypes.voidType().equals(componentType)) return true; return isIllegalTypeMigration(componentType); } if (type instanceof PsiDisjunctionType disjunctionType) { PsiElementFactory factory = JavaPsiFacade.getElementFactory(myRoots[0].getProject()); PsiClassType throwable = factory.createTypeByFQClassName(CommonClassNames.JAVA_LANG_THROWABLE, myRoots[0].getResolveScope()); List<PsiType> disjunctions = disjunctionType.getDisjunctions(); for (PsiType disjunction : disjunctions) { if (isIllegalTypeMigration(disjunction)) return true; if (!TypeConversionUtil.isAssignable(throwable, type)) return true; } } return false; }