boolean (PsiType type) { if (type instanceof PsiWildcardType || type instanceof PsiPrimitiveType) { return true; } if (type instanceof PsiArrayType arrayType) { final PsiType componentType = arrayType.getComponentType(); return isProbablySerializable(componentType); } if (type instanceof PsiClassType classType) { final PsiClass aClass = classType.resolve(); if (aClass instanceof PsiTypeParameter typeParameter) { final PsiReferenceList extendsList = typeParameter.getExtendsList(); return ContainerUtil.and(extendsList.getReferencedTypes(), SerializationUtils::isProbablySerializable); } if (aClass == null || aClass.hasModifierProperty(PsiModifier.ABSTRACT)) { // to avoid false positives return true; } if (isSerializable(aClass) || isExternalizable(aClass)) { return true; } if (InheritanceUtil.isInheritor(aClass, CommonClassNames.JAVA_UTIL_COLLECTION) || InheritanceUtil.isInheritor(aClass, CommonClassNames.JAVA_UTIL_MAP)) { return ContainerUtil.and(classType.getParameters(), SerializationUtils::isProbablySerializable); } return false; } return false; }