void (PsiJavaModule javaModule) { List<String> emptyList = Collections.emptyList(); for (PsiPackageAccessibilityStatement statement : javaModule.getExports()) { PsiElement element = addReference(statement.getPackageReference()); String packageName = null; if (element instanceof PsiPackage) { packageName = ((PsiPackage)element).getQualifiedName(); if (myExportedPackageNames == null) myExportedPackageNames = new HashMap<>(1); myExportedPackageNames.put(packageName, emptyList); } for (PsiJavaModuleReferenceElement referenceElement : statement.getModuleReferences()) { if (referenceElement != null) { PsiElement moduleElement = addReference(referenceElement.getReference()); if (packageName != null && moduleElement instanceof PsiJavaModule) { List<String> toModuleNames = myExportedPackageNames.get(packageName); if (toModuleNames == emptyList) myExportedPackageNames.put(packageName, toModuleNames = new ArrayList<>(1)); toModuleNames.add(((PsiJavaModule)moduleElement).getName()); } } } } }