void (PsiType type, PsiTypeElement typeElement, PsiElement variable) { if (typeElement == null) { return; } final PsiJavaCodeReferenceElement reference = typeElement.getInnermostComponentReferenceElement(); if (reference == null) { return; } final PsiElement nameElement = reference.getReferenceNameElement(); if (nameElement == null) { return; } final Collection<PsiClass> weaklings = WeakestTypeFinder.calculateWeakestClassesNecessary(variable, false); if (weaklings.isEmpty()) { return; } final PsiClassType javaLangObject = PsiType.getJavaLangObject(nameElement.getManager(), nameElement.getResolveScope()); final List<PsiClass> weaklingList = new ArrayList<>(weaklings); final PsiClass objectClass = javaLangObject.resolve(); weaklingList.remove(objectClass); String qualifiedName = weaklingList.isEmpty() ? CollectionUtils.getInterfaceForClass(type.getCanonicalText()) : weaklingList.get(0).getQualifiedName(); if (qualifiedName != null) { registerError(nameElement, qualifiedName); } }