void (GrReferenceElement refElement) { if (refElement.isQualified()) return; final String refName = refElement.getReferenceName(); if ("super".equals(refName)) return; final GroovyResolveResult[] resolveResults = refElement.multiResolve(false); if (resolveResults.length == 0 && refName != null) { if (PsiTreeUtil.getParentOfType(refElement, GrImportStatement.class) == null) { unresolvedReferenceNames.add(refName); } } for (GroovyResolveResult resolveResult : resolveResults) { final PsiElement context = resolveResult.getCurrentFileResolveContext(); final PsiElement resolved = resolveResult.getElement(); if (resolved == null) return; if (context instanceof GrImportStatement importStatement) { usedImports.add(importStatement); if (GroovyImportHelper.isImplicitlyImported(resolved, refName, file)) { addImplicitClass(resolved); } if (!importStatement.isAliasedImport() && !isAnnotatedImport(importStatement)) { String importedName = null; if (importStatement.isOnDemand()) { if (importStatement.isStatic()) { if (resolved instanceof PsiMember member) { final PsiClass clazz = member.getContainingClass(); if (clazz != null) { final String classQName = clazz.getQualifiedName(); if (classQName != null) { final String name = member.getName(); if (name != null) { importedName = classQName + "." + name; } } } } } else { importedName = getTargetQualifiedName(resolved); } } else { importedName = importStatement.getImportFqn(); } if (importedName == null) return; final String importRef = importStatement.getImportFqn(); if (importStatement.isAliasedImport()) { aliased.put(importRef, importedName); return; } if (importStatement.isStatic()) { staticallyImportedMembers.add(importedName); } else { importedClasses.add(importedName); if (resolved instanceof PsiClass && ((PsiClass)resolved).getContainingClass() != null) { innerClasses.add(importedName); } } } } else if (context == null && !(refElement.getParent() instanceof GrImportStatement) && refElement.getQualifier() == null && (!(resolved instanceof PsiClass) || ((PsiClass)resolved).getContainingClass() == null)) { addImplicitClass(resolved); } } }