void (PsiJavaModule javaModule) { for (PsiProvidesStatement statement : javaModule.getProvides()) { final PsiJavaCodeReferenceElement interfaceReference = statement.getInterfaceReference(); final PsiReferenceList implementationList = statement.getImplementationList(); if (interfaceReference != null && implementationList != null) { final PsiElement providerInterface = interfaceReference.resolve(); if (providerInterface instanceof PsiClass) { final RefElement refInterface = getRefManager().getReference(providerInterface); if (refInterface instanceof RefClassImpl) { if (myServiceInterfaces == null) myServiceInterfaces = new HashSet<>(); myServiceInterfaces.add((RefClass)refInterface); for (PsiJavaCodeReferenceElement implementationReference : implementationList.getReferenceElements()) { final PsiElement implementationClass = implementationReference.resolve(); if (implementationClass instanceof PsiClass) { RefElement refTargetElement = null; PsiElement targetElement = getProviderMethod((PsiClass)implementationClass); if (targetElement == null) { final RefElement refClass = getRefManager().getReference(implementationClass); if (refClass instanceof RefClassImpl) { refClass.initializeIfNeeded(); if (myServiceImplementations == null) myServiceImplementations = new HashSet<>(); myServiceImplementations.add((RefClass)refClass); final RefMethod refConstructor = ((RefClassImpl)refClass).getDefaultConstructor(); if (refConstructor != null) { final PsiElement constructorElement = refConstructor.getPsiElement(); if (constructorElement instanceof PsiModifierListOwner && ((PsiModifierListOwner)constructorElement).hasModifierProperty(PsiModifier.PUBLIC)) { refTargetElement = refConstructor; targetElement = constructorElement; } } } } if (targetElement == null) { targetElement = implementationClass; } if (refTargetElement == null) { refTargetElement = getRefManager().getReference(targetElement); } if (refTargetElement != null) { ((RefClassImpl)refInterface) .addReference(refTargetElement, targetElement, UastContextKt.toUElement(providerInterface, UDeclaration.class), false, true, null); } } } } } } } }