ModuleVisitor (String name, int access, String version) { myResult = new PsiJavaModuleStubImpl(myParent, name); myModList = new PsiModifierListStubImpl(myResult, moduleFlags(access)); return new ModuleVisitor(Opcodes.API_VERSION) { @Override public void visitRequire(String module, int access, String version) { if (!isGenerated(access)) { PsiRequiresStatementStubImpl statementStub = new PsiRequiresStatementStubImpl(myResult, module); new PsiModifierListStubImpl(statementStub, requiresFlags(access)); } } @Override public void visitExport(String packageName, int access, String... modules) { if (!isGenerated(access)) { new PsiPackageAccessibilityStatementStubImpl( myResult, EXPORTS_STATEMENT, NAME_MAPPER.fun(packageName), modules == null ? null : Arrays.asList(modules)); } } @Override public void visitOpen(String packageName, int access, String... modules) { if (!isGenerated(access)) { new PsiPackageAccessibilityStatementStubImpl( myResult, OPENS_STATEMENT, NAME_MAPPER.fun(packageName), modules == null ? null : Arrays.asList(modules)); } } @Override public void visitUse(String service) { new PsiUsesStatementStubImpl(myResult, NAME_MAPPER.fun(service)); } @Override public void visitProvide(String service, String... providers) { PsiProvidesStatementStubImpl statementStub = new PsiProvidesStatementStubImpl(myResult, NAME_MAPPER.fun(service)); String[] names = map2Array(providers, String.class, NAME_MAPPER); new PsiClassReferenceListStubImpl(PROVIDES_WITH_LIST, statementStub, names.length == 0 ? ArrayUtilRt.EMPTY_STRING_ARRAY : names); } }; }