Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
100
void (final Element configuration) { myConfiguration = configuration; }
setConfiguration
101
void (final String name) { myName = name; }
setName
102
void (final String type) { myFacetType = type; }
setFacetType
103
void (String externalSystemId) { myExternalSystemId = externalSystemId; }
setExternalSystemId
104
void (String externalSystemIdInInternalStorage) { myExternalSystemIdInInternalStorage = externalSystemIdInInternalStorage; }
setExternalSystemIdInInternalStorage
105
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FacetState state = (FacetState)o; return Objects.equals(myFacetType, state.myFacetType) && Objects.equals(myName, state.myName) && Objects.equals(myExternalSystemId, state.myExternalSystemId) && JDOMUtil.areElementsEqual(myConfiguration, state.myConfiguration) && Objects.equals(subFacets, state.subFacets); }
equals
106
int () { return (31 * Objects.hash(myFacetType, myName, myExternalSystemId, subFacets)) + JDOMUtil.hashCode(myConfiguration, false); }
hashCode
107
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FacetManagerState state = (FacetManagerState)o; return facets.equals(state.facets); }
equals
108
int () { return Objects.hash(facets); }
hashCode
109
String () { return myFacetTypeId; }
getFacetTypeId
110
E (final Element configurationElement, final String facetName, JpsModule module, JpsElement parentFacet) { final E e = loadExtension(configurationElement, facetName, parentFacet, module); return module.getContainer().setChild(myRole, e); }
loadExtension
111
boolean (JpsModule module) { return module.getContainer().getChild(myRole) != null; }
hasExtension
112
void (E extension, Element facetConfigurationTag, JpsModule module) { }
saveExtension
113
String () { return myTypeId; }
getTypeId
114
void (@NotNull JpsProject project, @Nullable Element runManagerTag) { List<Element> elements = JDOMUtil.getChildren(runManagerTag, "configuration"); if (elements.isEmpty()) { return; } Map<String, JpsRunConfigurationPropertiesSerializer<?>> serializers = new HashMap<>(); for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) { for (JpsRunConfigurationPropertiesSerializer<?> serializer : extension.getRunConfigurationPropertiesSerializers()) { serializers.put(serializer.getTypeId(), serializer); } } for (Element configurationTag : elements) { if (Boolean.parseBoolean(configurationTag.getAttributeValue("default"))) { continue; } String typeId = configurationTag.getAttributeValue("type"); JpsRunConfigurationPropertiesSerializer<?> serializer = serializers.get(typeId); String name = configurationTag.getAttributeValue("name"); if (serializer != null) { loadRunConfiguration(name, configurationTag, serializer, project); } else if (name == null) { LOG.info("Run configuration '" + JDOMUtil.write(configurationTag) + "' wasn't loaded because 'name' attribute is missing"); } else if (typeId != null) { project.addRunConfiguration(name, new JpsUnknownRunConfigurationType(typeId), JpsElementFactory.getInstance().createDummyElement()); } else { LOG.info("Run configuration '" + name + "' wasn't loaded because 'type' attribute is missing"); } } }
loadRunConfigurations
115
void (@NotNull JpsModule module, @NotNull Element rootModel) { loadExplodedDirectoryExtension(module, rootModel); loadJavaModuleExtension(module, rootModel); }
loadRootModel
116
void (@NotNull JpsModule module, @NotNull Element rootElement) { Element testModuleProperties = JDomSerializationUtil.findComponent(rootElement, "TestModuleProperties"); if (testModuleProperties != null) { String productionModuleName = testModuleProperties.getAttributeValue(PRODUCTION_MODULE_NAME_ATTRIBUTE); if (productionModuleName != null) { getService().setTestModuleProperties(module, JpsElementFactory.getInstance().createModuleReference(productionModuleName)); } } }
loadModuleOptions
117
void (JpsDependencyElement dependency, Element entry) { boolean exported = entry.getAttributeValue(EXPORTED_ATTRIBUTE) != null; String scopeName = entry.getAttributeValue(SCOPE_ATTRIBUTE); JpsJavaDependencyScope scope; try { scope = scopeName != null ? JpsJavaDependencyScope.valueOf(scopeName) : JpsJavaDependencyScope.COMPILE; } catch (IllegalArgumentException e) { scope = JpsJavaDependencyScope.COMPILE; } final JpsJavaDependencyExtension extension = getService().getOrCreateDependencyExtension(dependency); extension.setExported(exported); extension.setScope(scope); }
loadModuleDependencyProperties
118
List<JpsLibraryRootTypeSerializer> () { return Arrays.asList(new JpsLibraryRootTypeSerializer("JAVADOC", JpsOrderRootType.DOCUMENTATION, true), new JpsLibraryRootTypeSerializer("ANNOTATIONS", JpsAnnotationRootType.INSTANCE, false), new JpsLibraryRootTypeSerializer("NATIVE", JpsNativeLibraryRootType.INSTANCE, false)); }
getLibraryRootTypeSerializers
119
List<JpsLibraryRootTypeSerializer> () { return Arrays.asList(new JpsLibraryRootTypeSerializer("javadocPath", JpsOrderRootType.DOCUMENTATION, true), new JpsLibraryRootTypeSerializer("annotationsPath", JpsAnnotationRootType.INSTANCE, true)); }
getSdkRootTypeSerializers
120
void (JpsModule module, Element rootModelComponent) { final Element exploded = rootModelComponent.getChild(EXPLODED_TAG); if (exploded != null) { final ExplodedDirectoryModuleExtension extension = getService().getOrCreateExplodedDirectoryExtension(module); extension.setExcludeExploded(rootModelComponent.getChild(EXCLUDE_EXPLODED_TAG) != null); extension.setExplodedUrl(exploded.getAttributeValue(URL_ATTRIBUTE)); } }
loadExplodedDirectoryExtension
121
void (JpsModule module, Element rootModelComponent) { final JpsJavaModuleExtension extension = getService().getOrCreateModuleExtension(module); final Element outputTag = rootModelComponent.getChild(OUTPUT_TAG); String outputUrl = outputTag != null ? outputTag.getAttributeValue(URL_ATTRIBUTE) : null; extension.setOutputUrl(outputUrl); final Element testOutputTag = rootModelComponent.getChild(TEST_OUTPUT_TAG); String testOutputUrl = testOutputTag != null ? testOutputTag.getAttributeValue(URL_ATTRIBUTE) : null; extension.setTestOutputUrl(StringUtil.isEmpty(testOutputUrl) ? outputUrl : testOutputUrl); extension.setInheritOutput(Boolean.parseBoolean(rootModelComponent.getAttributeValue(INHERIT_COMPILER_OUTPUT_ATTRIBUTE))); extension.setExcludeOutput(rootModelComponent.getChild(EXCLUDE_OUTPUT_TAG) != null); final String languageLevel = rootModelComponent.getAttributeValue(MODULE_LANGUAGE_LEVEL_ATTRIBUTE); if (languageLevel != null) { extension.setLanguageLevel(readLanguageLevel(languageLevel, null)); } loadAdditionalRoots(rootModelComponent, ANNOTATION_PATHS_TAG, extension.getAnnotationRoots()); loadAdditionalRoots(rootModelComponent, JAVADOC_PATHS_TAG, extension.getJavadocRoots()); }
loadJavaModuleExtension
122
void (Element rootModelComponent, final String rootsTagName, final JpsUrlList result) { final Element roots = rootModelComponent.getChild(rootsTagName); for (Element root : JDOMUtil.getChildren(roots, ROOT_TAG)) { result.addUrl(root.getAttributeValue(URL_ATTRIBUTE)); } }
loadAdditionalRoots
123
JpsJavaExtensionService () { return JpsJavaExtensionService.getInstance(); }
getService
124
JpsProductionModuleOutputPackagingElement (Element element) { JpsModuleReference reference = JpsElementFactory.getInstance().createModuleReference(element.getAttributeValue("name")); return getService().createProductionModuleOutput(reference); }
load
125
JpsProductionModuleSourcePackagingElement (Element element) { JpsModuleReference reference = JpsElementFactory.getInstance().createModuleReference(element.getAttributeValue("name")); return getService().createProductionModuleSource(reference); }
load
126
JpsTestModuleOutputPackagingElement (Element element) { JpsModuleReference reference = JpsElementFactory.getInstance().createModuleReference(element.getAttributeValue("name")); return getService().createTestModuleOutput(reference); }
load
127
LanguageLevel (String level, LanguageLevel defaultLevel) { for (LanguageLevel languageLevel : LanguageLevel.values()) { if (level.equals(languageLevel.name())) { return languageLevel; } } return defaultLevel; }
readLanguageLevel
128
void (@NotNull JpsProject project, @NotNull Element componentTag) { JpsJavaProjectExtension extension = getService().getOrCreateProjectExtension(project); final Element output = componentTag.getChild(OUTPUT_TAG); if (output != null) { String url = output.getAttributeValue(URL_ATTRIBUTE); if (url != null) { extension.setOutputUrl(url); } } String languageLevel = componentTag.getAttributeValue(LANGUAGE_LEVEL_ATTRIBUTE); if (languageLevel != null) { extension.setLanguageLevel(readLanguageLevel(languageLevel, LanguageLevel.HIGHEST)); } }
loadExtension
129
JavaSourceRootProperties (@NotNull Element sourceRootTag) { String packagePrefix = StringUtil.notNullize(sourceRootTag.getAttributeValue(JpsModuleRootModelSerializer.PACKAGE_PREFIX_ATTRIBUTE)); boolean isGenerated = Boolean.parseBoolean(sourceRootTag.getAttributeValue(IS_GENERATED_ATTRIBUTE)); return getService().createSourceRootProperties(packagePrefix, isGenerated); }
loadProperties
130
void (@NotNull JavaSourceRootProperties properties, @NotNull Element sourceRootTag) { String isTestSource = Boolean.toString(getType().equals(JavaSourceRootType.TEST_SOURCE)); sourceRootTag.setAttribute(JpsModuleRootModelSerializer.IS_TEST_SOURCE_ATTRIBUTE, isTestSource); String packagePrefix = properties.getPackagePrefix(); if (!packagePrefix.isEmpty()) { sourceRootTag.setAttribute(JpsModuleRootModelSerializer.PACKAGE_PREFIX_ATTRIBUTE, packagePrefix); } if (properties.isForGeneratedSources()) { sourceRootTag.setAttribute(IS_GENERATED_ATTRIBUTE, Boolean.TRUE.toString()); } }
saveProperties
131
JavaResourceRootProperties (@NotNull Element sourceRootTag) { String relativeOutputPath = StringUtil.notNullize(sourceRootTag.getAttributeValue(RELATIVE_OUTPUT_PATH_ATTRIBUTE)); boolean isGenerated = Boolean.parseBoolean(sourceRootTag.getAttributeValue(IS_GENERATED_ATTRIBUTE)); return getService().createResourceRootProperties(relativeOutputPath, isGenerated); }
loadProperties
132
void (@NotNull JavaResourceRootProperties properties, @NotNull Element sourceRootTag) { String relativeOutputPath = properties.getRelativeOutputPath(); if (!relativeOutputPath.isEmpty()) { sourceRootTag.setAttribute(RELATIVE_OUTPUT_PATH_ATTRIBUTE, relativeOutputPath); } if (properties.isForGeneratedSources()) { sourceRootTag.setAttribute(IS_GENERATED_ATTRIBUTE, Boolean.TRUE.toString()); } }
saveProperties
133
JpsSimpleElement<JpsMavenRepositoryLibraryDescriptor> (@Nullable Element elem) { return JpsElementFactory.getInstance().createSimpleElement(loadDescriptor(elem)); }
loadProperties
134
JpsMavenRepositoryLibraryDescriptor (@Nullable Element elem) { if (elem == null) return new JpsMavenRepositoryLibraryDescriptor(null); String mavenId = elem.getAttributeValue(MAVEN_ID_ATTRIBUTE, (String)null); boolean includeTransitiveDependencies = Boolean.parseBoolean(elem.getAttributeValue(INCLUDE_TRANSITIVE_DEPS_ATTRIBUTE, "true")); String jarRepositoryId = elem.getAttributeValue(JAR_REPOSITORY_ID_ATTRIBUTE); Element excludeTag = elem.getChild(EXCLUDE_TAG); List<Element> dependencyTags = excludeTag != null ? excludeTag.getChildren(DEPENDENCY_TAG) : Collections.emptyList(); List<String> excludedDependencies = ContainerUtil.map(dependencyTags, it -> it.getAttributeValue(MAVEN_ID_ATTRIBUTE)); var verificationProperties = loadArtifactsVerificationProperties(mavenId, elem.getChild(VERIFICATION_TAG)); return new JpsMavenRepositoryLibraryDescriptor(mavenId, includeTransitiveDependencies, excludedDependencies, verificationProperties, jarRepositoryId); }
loadDescriptor
135
List<ArtifactVerification> (@Nullable String mavenId, @Nullable Element element) { if (element == null) { return Collections.emptyList(); } List<Element> children = element.getChildren(ARTIFACT_TAG); List<ArtifactVerification> result = new ArrayList<>(children.size()); for (var child : children) { String artifactUrl = child.getAttributeValue(URL_ATTRIBUTE); if (artifactUrl != null) { Element sha256sumElement = child.getChild(SHA256SUM_TAG); String sha256sum = sha256sumElement != null ? sha256sumElement.getText() : null; if (sha256sum == null) { LOG.warn("Missing sha256sum attribute for verification artifact tag for descriptor maven-id=" + mavenId); } else { result.add(new ArtifactVerification(artifactUrl, sha256sum)); } } else { LOG.warn("Missing url attribute for verification artifact tag for descriptor maven-id=" + mavenId); } } return result; }
loadArtifactsVerificationProperties
136
JpsApplicationRunConfigurationProperties (@Nullable Element runConfigurationTag) { JpsApplicationRunConfigurationState properties = runConfigurationTag != null ? XmlSerializer.deserialize(runConfigurationTag, JpsApplicationRunConfigurationState.class) : new JpsApplicationRunConfigurationState(); return JpsJavaExtensionService.getInstance().createRunConfigurationProperties(properties); }
loadProperties
137
void (ProcessorConfigProfile profile, Element element) { profile.setName(element.getAttributeValue(NAME, "")); profile.setEnabled(Boolean.parseBoolean(element.getAttributeValue(ENABLED, "false"))); profile.setProcOnly(Boolean.parseBoolean(element.getAttributeValue(PROC_ONLY, "false"))); final Element srcOutput = element.getChild("sourceOutputDir"); final String out = srcOutput != null ? srcOutput.getAttributeValue(NAME) : null; profile.setGeneratedSourcesDirectoryName(out != null ? FileUtilRt.toSystemDependentName(out) : null, false); final Element srcTestOutput = element.getChild("sourceTestOutputDir"); final String testOut = srcTestOutput != null ? srcTestOutput.getAttributeValue(NAME) : null; profile.setGeneratedSourcesDirectoryName(testOut != null? FileUtilRt.toSystemDependentName(testOut) : null, true); final Element isRelativeToContentRoot = element.getChild("outputRelativeToContentRoot"); if (isRelativeToContentRoot != null) { profile.setOutputRelativeToContentRoot(Boolean.parseBoolean(isRelativeToContentRoot.getAttributeValue(VALUE))); } profile.clearProcessorOptions(); for (Element optionElement : element.getChildren(OPTION)) { final String key = optionElement.getAttributeValue(NAME); final String value = optionElement.getAttributeValue(VALUE); if (!StringUtil.isEmptyOrSpaces(key) && value != null) { profile.setOption(key, value); } } profile.clearProcessors(); for (Element procElement : element.getChildren("processor")) { final String name = procElement.getAttributeValue(NAME); if (!StringUtil.isEmptyOrSpaces(name)) { profile.addProcessor(name); } } final Element pathElement = element.getChild("processorPath"); if (pathElement != null) { profile.setObtainProcessorsFromClasspath(Boolean.parseBoolean(pathElement.getAttributeValue(USE_CLASSPATH, "true"))); profile.setUseProcessorModulePath(Boolean.parseBoolean(pathElement.getAttributeValue(USE_PROC_MODULE_PATH, "false"))); final StringBuilder pathBuilder = new StringBuilder(); for (Element entry : pathElement.getChildren(ENTRY)) { final String path = entry.getAttributeValue(NAME); if (!StringUtil.isEmptyOrSpaces(path)) { if (pathBuilder.length() > 0) { pathBuilder.append(File.pathSeparator); } pathBuilder.append(FileUtilRt.toSystemDependentName(path)); } } profile.setProcessorPath(pathBuilder.toString()); } profile.clearModuleNames(); for (Element moduleElement : element.getChildren(MODULE)) { final String name = moduleElement.getAttributeValue(NAME); if (!StringUtil.isEmptyOrSpaces(name)) { profile.addModuleName(name); } } }
readExternal
138
void (@NotNull ProcessorConfigProfile profile, @NotNull Element element) { element.setAttribute(NAME, profile.getName()); if (profile.isEnabled()) { element.setAttribute(ENABLED, Boolean.toString(profile.isEnabled())); } if (profile.isProcOnly()) { element.setAttribute(PROC_ONLY, Boolean.toString(profile.isProcOnly())); } final String srcDirName = profile.getGeneratedSourcesDirectoryName(false); if (!StringUtil.equals(ProcessorConfigProfile.DEFAULT_PRODUCTION_DIR_NAME, srcDirName)) { addChild(element, "sourceOutputDir").setAttribute(NAME, FileUtilRt.toSystemIndependentName(srcDirName)); } final String testSrcDirName = profile.getGeneratedSourcesDirectoryName(true); if (!StringUtil.equals(ProcessorConfigProfile.DEFAULT_TESTS_DIR_NAME, testSrcDirName)) { addChild(element, "sourceTestOutputDir").setAttribute(NAME, FileUtilRt.toSystemIndependentName(testSrcDirName)); } if (profile.isOutputRelativeToContentRoot()) { addChild(element, "outputRelativeToContentRoot").setAttribute(VALUE, "true"); } final Map<String, String> options = profile.getProcessorOptions(); if (!options.isEmpty()) { final List<String> keys = new ArrayList<>(options.keySet()); keys.sort(ALPHA_COMPARATOR); for (String key : keys) { addChild(element, OPTION).setAttribute(NAME, key).setAttribute(VALUE, options.get(key)); } } final Set<String> processors = profile.getProcessors(); if (!processors.isEmpty()) { final List<String> processorList = new ArrayList<>(processors); for (String proc : processorList) { addChild(element, "processor").setAttribute(NAME, proc); } } Element pathElement = null; if (!profile.isObtainProcessorsFromClasspath()) { pathElement = addChild(element, "processorPath"); pathElement.setAttribute(USE_CLASSPATH, Boolean.toString(profile.isObtainProcessorsFromClasspath())); if (profile.isUseProcessorModulePath()) { pathElement.setAttribute(USE_PROC_MODULE_PATH, Boolean.toString(profile.isUseProcessorModulePath())); } } final String path = profile.getProcessorPath(); if (!StringUtil.isEmpty(path)) { if (pathElement == null) { pathElement = addChild(element, "processorPath"); if (profile.isUseProcessorModulePath()) { pathElement.setAttribute(USE_PROC_MODULE_PATH, Boolean.toString(profile.isUseProcessorModulePath())); } } final StringTokenizer tokenizer = new StringTokenizer(path, File.pathSeparator, false); while (tokenizer.hasMoreTokens()) { final String token = tokenizer.nextToken(); addChild(pathElement, ENTRY).setAttribute(NAME, FileUtilRt.toSystemIndependentName(token)); } } final Set<String> moduleNames = profile.getModuleNames(); if (!moduleNames.isEmpty()) { final List<String> names = new ArrayList<>(moduleNames); for (String name : names) { addChild(element, MODULE).setAttribute(NAME, name); } } }
writeExternal
139
Element (Element parent, final String childName) { final Element child = new Element(childName); parent.addContent(child); return child; }
addChild
140
void (@NotNull JpsProject project, @NotNull Element componentTag) { JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project); JpsJavaCompilerOptions options = XmlSerializer.deserialize(componentTag, JpsJavaCompilerOptions.class); configuration.setCompilerOptions(myCompilerId, options); }
loadExtension
141
void (@NotNull JpsProject project) { JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project); configuration.setCompilerOptions(myCompilerId, new JpsJavaCompilerOptions()); }
loadExtensionWithDefaultSettings
142
void (@NotNull JpsProject project, @NotNull Element componentTag) { JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project); EclipseCompilerOptions options = XmlSerializer.deserialize(componentTag, EclipseCompilerOptions.class); configuration.setCompilerOptions(myCompilerId, options); }
loadExtension
143
void (@NotNull JpsProject project) { JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project); configuration.setCompilerOptions(myCompilerId, new EclipseCompilerOptions()); }
loadExtensionWithDefaultSettings
144
void (@NotNull JpsProject project, @NotNull Element componentTag) { JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project); Element addNotNullTag = componentTag.getChild(ADD_NOTNULL_ASSERTIONS); if (addNotNullTag != null) { configuration.setAddNotNullAssertions(Boolean.parseBoolean(addNotNullTag.getAttributeValue(ENABLED, "true"))); } readExcludes(componentTag.getChild(EXCLUDE_FROM_COMPILE), configuration.getCompilerExcludes()); Element resourcePatternsTag = componentTag.getChild(WILDCARD_RESOURCE_PATTERNS); if (resourcePatternsTag == null) { for (String pattern : DEFAULT_WILDCARD_PATTERNS) { configuration.addResourcePattern(pattern); } } else { for (Element entry : resourcePatternsTag.getChildren(ENTRY)) { String pattern = entry.getAttributeValue(NAME); if (!StringUtil.isEmpty(pattern)) { configuration.addResourcePattern(pattern); } } } Element annotationProcessingTag = componentTag.getChild(ANNOTATION_PROCESSING); if (annotationProcessingTag != null) { List<Element> profiles = JDOMUtil.getChildren(annotationProcessingTag, "profile"); for (Element profileTag : profiles) { boolean isDefault = Boolean.parseBoolean(profileTag.getAttributeValue("default")); if (isDefault) { AnnotationProcessorProfileSerializer.readExternal(configuration.getDefaultAnnotationProcessingProfile(), profileTag); } else { AnnotationProcessorProfileSerializer.readExternal(configuration.addAnnotationProcessingProfile(), profileTag); } } } Element targetLevelTag = componentTag.getChild(BYTECODE_TARGET_LEVEL); if (targetLevelTag != null) { configuration.setProjectByteCodeTargetLevel(targetLevelTag.getAttributeValue(TARGET_ATTRIBUTE)); for (Element moduleTag : JDOMUtil.getChildren(targetLevelTag, MODULE)) { String moduleName = moduleTag.getAttributeValue(NAME); String level = moduleTag.getAttributeValue(TARGET_ATTRIBUTE); if (moduleName != null && level != null) { configuration.setModuleByteCodeTargetLevel(moduleName, level); } } } String compilerId = JDOMExternalizerUtil.readField(componentTag, "DEFAULT_COMPILER"); if (compilerId != null) { configuration.setJavaCompilerId(compilerId); } String useReleaseOption = JDOMExternalizerUtil.readField(componentTag, "USE_RELEASE_OPTION"); if (useReleaseOption != null) { configuration.setUseReleaseOption(Boolean.parseBoolean(useReleaseOption)); } }
loadExtension
145
void (@NotNull JpsProject project) { JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project); for (String pattern : DEFAULT_WILDCARD_PATTERNS) { configuration.addResourcePattern(pattern); } }
loadExtensionWithDefaultSettings
146
void (Element excludeFromCompileTag, JpsCompilerExcludes excludes) { if (excludeFromCompileTag != null) { for (Element fileTag : JDOMUtil.getChildren(excludeFromCompileTag, "file")) { excludes.addExcludedFile(fileTag.getAttributeValue("url")); } for (Element directoryTag : JDOMUtil.getChildren(excludeFromCompileTag, "directory")) { boolean recursively = Boolean.parseBoolean(directoryTag.getAttributeValue("includeSubdirectories")); excludes.addExcludedDirectory(directoryTag.getAttributeValue("url"), recursively); } } }
readExcludes
147
void (@NotNull JpsProject project, @NotNull Element componentTag) { JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project); ValidationConfigurationState state = XmlSerializer.deserialize(componentTag, ValidationConfigurationState.class); Set<String> disabledValidators = state.VALIDATORS.entrySet().stream() .filter(e -> e.getValue() == Boolean.FALSE) .map(e -> e.getKey()) .collect(Collectors.toSet()); configuration.setValidationConfiguration(state.VALIDATE_ON_BUILD, disabledValidators); }
loadExtension
148
void (@NotNull JpsProject project, @NotNull Element componentTag) { JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project); JpsJavaCompilerConfigurationSerializer.readExcludes(componentTag, configuration.getValidationExcludes()); }
loadExtension
149
void (@NotNull JpsProject project, @NotNull Element componentTag) { JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project); String assertNotNull = JDOMExternalizerUtil.readField(componentTag, "ASSERT_NOT_NULL"); if (assertNotNull != null) { configuration.setAddNotNullAssertions(Boolean.parseBoolean(assertNotNull)); } String clearOutputDirectory = JDOMExternalizerUtil.readField(componentTag, "CLEAR_OUTPUT_DIRECTORY"); configuration.setClearOutputDirectoryOnRebuild(clearOutputDirectory == null || Boolean.parseBoolean(clearOutputDirectory)); }
loadExtension
150
void (@NotNull JpsProject project, @NotNull Element componentTag) { JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project); List<String> annoNames = new ArrayList<>(); for (Element option : componentTag.getChildren("instrumentedNotNulls")) { for (Element item : option.getChildren("option")) { ContainerUtil.addIfNotNull(annoNames, item.getAttributeValue("value")); } } if (annoNames.isEmpty()) { annoNames.add(NotNull.class.getName()); } configuration.setNotNullAnnotations(annoNames); }
loadExtension
151
void (@NotNull JpsProject project) { JpsJavaExtensionService.getInstance().getCompilerConfiguration(project).setNotNullAnnotations( Collections.singletonList(NotNull.class.getName())); }
loadExtensionWithDefaultSettings
152
void (@NotNull JpsProject project, @NotNull Element componentTag) { JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project); RmicCompilerOptions options = XmlSerializer.deserialize(componentTag, RmicCompilerOptions.class); configuration.setCompilerOptions(myCompilerId, options); }
loadExtension
153
void (@NotNull JpsProject project) { JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project); configuration.setCompilerOptions(myCompilerId, new RmicCompilerOptions()); }
loadExtensionWithDefaultSettings
154
JpsDummyElement (Element propertiesElement) { return JpsElementFactory.getInstance().createDummyElement(); }
loadProperties
155
void (@Nullable Element sdkListElement, JpsLibraryCollection result, @NotNull JpsPathMapper pathMapper) { for (Element sdkElement : JDOMUtil.getChildren(sdkListElement, JDK_TAG)) { result.addLibrary(loadSdk(sdkElement, pathMapper)); } }
loadSdks
156
JpsLibrary (Element sdkElement, @NotNull JpsPathMapper pathMapper) { String name = getAttributeValue(sdkElement, NAME_TAG); String typeId = getAttributeValue(sdkElement, TYPE_TAG); LOG.debug("Loading " + typeId + " SDK '" + name + "'"); JpsSdkPropertiesSerializer<?> serializer = getSdkPropertiesSerializer(typeId); final JpsLibrary library = createSdk(name, serializer, pathMapper, sdkElement); final Element roots = sdkElement.getChild(ROOTS_TAG); for (Element rootTypeElement : JDOMUtil.getChildren(roots)) { JpsLibraryRootTypeSerializer rootTypeSerializer = getRootTypeSerializer(rootTypeElement.getName()); if (rootTypeSerializer != null) { for (Element rootElement : rootTypeElement.getChildren()) { loadRoots(rootElement, library, rootTypeSerializer.getType(), pathMapper); } } else { LOG.info("root type serializer not found for " + rootTypeElement.getName()); } } if (LOG.isDebugEnabled()) { List<File> files = library.getFiles(JpsOrderRootType.COMPILED); LOG.debug(name + " SDK classpath (" + files.size() + " roots):"); for (File file : files) { LOG.debug(" " + file.getAbsolutePath()); } } return library; }
loadSdk
157
void (Element rootElement, JpsLibrary library, JpsOrderRootType rootType, @NotNull JpsPathMapper pathMapper) { final String type = rootElement.getAttributeValue(TYPE_ATTRIBUTE); if (type.equals(COMPOSITE_TYPE)) { for (Element element : rootElement.getChildren()) { loadRoots(element, library, rootType, pathMapper); } } else if (type.equals(SIMPLE_TYPE)) { String url = pathMapper.mapUrl(rootElement.getAttributeValue(URL_ATTRIBUTE)); if (url != null) { library.addRoot(url, rootType); } } }
loadRoots
158
JpsLibraryRootTypeSerializer (String typeId) { for (JpsLibraryRootTypeSerializer serializer : PREDEFINED_ROOT_TYPE_SERIALIZERS) { if (serializer.getTypeId().equals(typeId)) { return serializer; } } for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) { for (JpsLibraryRootTypeSerializer serializer : extension.getSdkRootTypeSerializers()) { if (serializer.getTypeId().equals(typeId)) { return serializer; } } } return null; }
getRootTypeSerializer
159
String (Element element, String childName) { final Element child = element.getChild(childName); return child != null ? child.getAttributeValue(VALUE_ATTRIBUTE) : null; }
getAttributeValue
160
JpsDummyElement (@Nullable Element propertiesElement) { return JpsElementFactory.getInstance().createDummyElement(); }
loadProperties
161
void (@Nullable Element libraryTableElement, @NotNull JpsPathMapper pathMapper, JpsLibraryCollection result) { for (Element libraryElement : JDOMUtil.getChildren(libraryTableElement, LIBRARY_TAG)) { result.addLibrary(loadLibrary(libraryElement, pathMapper)); } }
loadLibraries
162
JpsLibrary (Element libraryElement, @NotNull JpsPathMapper pathMapper) { return loadLibrary(libraryElement, libraryElement.getAttributeValue(NAME_ATTRIBUTE), pathMapper); }
loadLibrary
163
JpsLibrary (Element libraryElement, String name, @NotNull JpsPathMapper pathMapper) { String typeId = libraryElement.getAttributeValue(TYPE_ATTRIBUTE); final JpsLibraryPropertiesSerializer<?> loader = getLibraryPropertiesSerializer(typeId); JpsLibrary library = createLibrary(name, loader, libraryElement.getChild(PROPERTIES_TAG)); MultiMap<JpsOrderRootType, String> jarDirectories = new MultiMap<>(); MultiMap<JpsOrderRootType, String> recursiveJarDirectories = new MultiMap<>(); for (Element jarDirectory : JDOMUtil.getChildren(libraryElement, JAR_DIRECTORY_TAG)) { String url = pathMapper.mapUrl(jarDirectory.getAttributeValue(URL_ATTRIBUTE)); String rootTypeId = jarDirectory.getAttributeValue(TYPE_ATTRIBUTE); final JpsOrderRootType rootType = rootTypeId != null ? getRootType(rootTypeId) : JpsOrderRootType.COMPILED; boolean recursive = Boolean.parseBoolean(jarDirectory.getAttributeValue(RECURSIVE_ATTRIBUTE)); jarDirectories.putValue(rootType, url); if (recursive) { recursiveJarDirectories.putValue(rootType, url); } } for (Element rootsElement : libraryElement.getChildren()) { final String rootTypeId = rootsElement.getName(); if (!rootTypeId.equals(JAR_DIRECTORY_TAG) && !rootTypeId.equals(PROPERTIES_TAG) && !rootTypeId.equals("excluded")) { final JpsOrderRootType rootType = getRootType(rootTypeId); for (Element rootElement : JDOMUtil.getChildren(rootsElement, ROOT_TAG)) { String url = pathMapper.mapUrl(rootElement.getAttributeValue(URL_ATTRIBUTE)); JpsLibraryRoot.InclusionOptions options; if (jarDirectories.get(rootType).contains(url)) { final boolean recursive = recursiveJarDirectories.get(rootType).contains(url); options = recursive ? JpsLibraryRoot.InclusionOptions.ARCHIVES_UNDER_ROOT_RECURSIVELY : JpsLibraryRoot.InclusionOptions.ARCHIVES_UNDER_ROOT; } else { options = JpsLibraryRoot.InclusionOptions.ROOT_ITSELF; } library.addRoot(url, rootType, options); } } } return library; }
loadLibrary
164
JpsOrderRootType (String rootTypeId) { for (JpsLibraryRootTypeSerializer serializer : PREDEFINED_ROOT_TYPES_SERIALIZERS) { if (serializer.getTypeId().equals(rootTypeId)) { return serializer.getType(); } } for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) { for (JpsLibraryRootTypeSerializer serializer : extension.getLibraryRootTypeSerializers()) { if (serializer.getTypeId().equals(rootTypeId)) { return serializer.getType(); } } } return JpsOrderRootType.COMPILED; }
getRootType
165
String (JpsElementReference<? extends JpsCompositeElement> reference) { if (reference instanceof JpsModuleReference) { return MODULE_LEVEL; } JpsCompositeElement element = reference.resolve(); if (element instanceof JpsProject) { return PROJECT_LEVEL; } else if (element instanceof JpsGlobal) { return APPLICATION_LEVEL; } for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) { String levelId = extension.getLibraryTableLevelId(reference); if (levelId != null) { return levelId; } } return null; }
getLevelId
166
boolean () { return myWriteIfEmpty; }
isWriteIfEmpty
167
String () { return myTypeId; }
getTypeId
168
JpsOrderRootType () { return myType; }
getType
169
int (JpsLibraryRootTypeSerializer o) { return myTypeId.compareTo(o.myTypeId); }
compareTo
170
void (@NotNull P properties, @NotNull Element element) { }
saveProperties
171
String () { return myComponentName; }
getComponentName
172
void (@NotNull P properties, @NotNull Element componentElement) { }
saveProperties
173
UnknownSourceRootTypeProperties<Element> (@NotNull Element sourceRootTag) { return new UnknownSourceRootTypeProperties<>(sourceRootTag.getParent() != null? sourceRootTag.clone() : sourceRootTag); }
loadProperties
174
void (@NotNull UnknownSourceRootTypeProperties<?> properties, @NotNull Element sourceRootTag) { Object data = properties.getPropertiesData(); if (data instanceof Element) { JDOMUtil.copyMissingContent((Element)data, sourceRootTag); } }
saveProperties
175
UnknownSourceRootPropertiesSerializer (String unknownTypeId) { return forType(UnknownSourceRootType.getInstance(unknownTypeId)); }
forType
176
UnknownSourceRootPropertiesSerializer (UnknownSourceRootType type) { return new UnknownSourceRootPropertiesSerializer(type); }
forType
177
void (JpsModule module, @Nullable Element rootModelComponent, @Nullable JpsSdkType<?> projectSdkType, @NotNull JpsPathMapper pathMapper) { if (rootModelComponent == null) return; for (Element contentElement : getChildren(rootModelComponent, CONTENT_TAG)) { final String url = getRequiredAttribute(contentElement, URL_ATTRIBUTE); module.getContentRootsList().addUrl(url); for (Element sourceElement : getChildren(contentElement, SOURCE_FOLDER_TAG)) { module.addSourceRoot(loadSourceRoot(sourceElement)); } for (Element excludeElement : getChildren(contentElement, EXCLUDE_FOLDER_TAG)) { module.getExcludeRootsList().addUrl(getRequiredAttribute(excludeElement, URL_ATTRIBUTE)); } for (Element excludePatternElement : getChildren(contentElement, EXCLUDE_PATTERN_TAG)) { module.addExcludePattern(url, getRequiredAttribute(excludePatternElement, EXCLUDE_PATTERN_ATTRIBUTE)); } } final JpsDependenciesList dependenciesList = module.getDependenciesList(); dependenciesList.clear(); final JpsElementFactory elementFactory = JpsElementFactory.getInstance(); UniqueNameGenerator nameGenerator = new UniqueNameGenerator(); boolean moduleSourceAdded = false; for (Element orderEntry : getChildren(rootModelComponent, ORDER_ENTRY_TAG)) { String type = orderEntry.getAttributeValue(TYPE_ATTRIBUTE); if (SOURCE_FOLDER_TYPE.equals(type)) { dependenciesList.addModuleSourceDependency(); moduleSourceAdded = true; } else if (JDK_TYPE.equals(type)) { String sdkName = getRequiredAttribute(orderEntry, JDK_NAME_ATTRIBUTE); String sdkTypeId = orderEntry.getAttributeValue(JDK_TYPE_ATTRIBUTE); final JpsSdkType<?> sdkType = JpsSdkTableSerializer.getSdkType(sdkTypeId); dependenciesList.addSdkDependency(sdkType); JpsSdkTableSerializer.setSdkReference(module.getSdkReferencesTable(), sdkName, sdkType); if (sdkType instanceof JpsJavaSdkTypeWrapper) { dependenciesList.addSdkDependency(JpsJavaSdkType.INSTANCE); } } else if (INHERITED_JDK_TYPE.equals(type)) { final JpsSdkType<?> sdkType = projectSdkType != null? projectSdkType : JpsJavaSdkType.INSTANCE; dependenciesList.addSdkDependency(sdkType); if (sdkType instanceof JpsJavaSdkTypeWrapper) { dependenciesList.addSdkDependency(JpsJavaSdkType.INSTANCE); } } else if (LIBRARY_TYPE.equals(type)) { String name = getRequiredAttribute(orderEntry, NAME_ATTRIBUTE); String level = getRequiredAttribute(orderEntry, LEVEL_ATTRIBUTE); JpsElementReference<? extends JpsCompositeElement> ref = JpsLibraryTableSerializer.createLibraryTableReference(level); final JpsLibraryDependency dependency = dependenciesList.addLibraryDependency(elementFactory.createLibraryReference(name, ref)); loadModuleDependencyProperties(dependency, orderEntry); } else if (MODULE_LIBRARY_TYPE.equals(type)) { final Element moduleLibraryElement = orderEntry.getChild(LIBRARY_TAG); if (moduleLibraryElement != null) { String name = moduleLibraryElement.getAttributeValue(NAME_ATTRIBUTE); if (name == null) { name = GENERATED_LIBRARY_NAME_PREFIX; } String uniqueName = nameGenerator.generateUniqueName(name); final JpsLibrary library = JpsLibraryTableSerializer.loadLibrary(moduleLibraryElement, uniqueName, pathMapper); module.addModuleLibrary(library); final JpsLibraryDependency dependency = dependenciesList.addLibraryDependency(library); loadModuleDependencyProperties(dependency, orderEntry); } } else if (MODULE_TYPE.equals(type)) { String name = getRequiredAttribute(orderEntry, MODULE_NAME_ATTRIBUTE); final JpsModuleDependency dependency = dependenciesList.addModuleDependency(elementFactory.createModuleReference(name)); loadModuleDependencyProperties(dependency, orderEntry); } } if (!moduleSourceAdded) { dependenciesList.addModuleSourceDependency(); } for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) { extension.loadRootModel(module, rootModelComponent); } }
loadRootModel
178
String (Element element, String attribute) { final String url = element.getAttributeValue(attribute); if (url == null) { throw new JpsSerializationFormatException("'" + attribute + "' attribute is missing in '" + element.getName() + "' tag"); } return url; }
getRequiredAttribute
179
JpsModuleSourceRoot (Element sourceElement) { final String sourceUrl = getRequiredAttribute(sourceElement, URL_ATTRIBUTE); JpsModuleSourceRootPropertiesSerializer<?> serializer = getSourceRootPropertiesSerializer(sourceElement); return createSourceRoot(sourceUrl, serializer, sourceElement); }
loadSourceRoot
180
void (JpsDependencyElement dependency, Element orderEntry) { for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) { extension.loadModuleDependencyProperties(dependency, orderEntry); } }
loadModuleDependencyProperties
181
String () { return myClasspathId; }
getClasspathId
182
JpsDummyElement (@NotNull Element sourceRootTag) { return JpsElementFactory.getInstance().createDummyElement(); }
loadProperties
183
void (@NotNull JpsDummyElement properties, @NotNull Element sourceRootTag) { }
saveProperties
184
JpsDummyElement (List<ArtifactPropertiesState> stateList) { return JpsElementFactory.getInstance().createDummyElement(); }
loadProperties
185
String () { return myTypeId; }
getTypeId
186
void (E element, Element tag) { }
save
187
void (@NotNull JpsProject project, @Nullable Element componentElement) { JpsArtifactService service = JpsArtifactService.getInstance(); for (Element artifactElement : JDOMUtil.getChildren(componentElement, "artifact")) { ArtifactState state = XmlSerializer.deserialize(artifactElement, ArtifactState.class); JpsArtifactPropertiesSerializer<?> serializer = getTypePropertiesSerializer(state.getArtifactType()); loadArtifact(project, service, state, serializer); } }
loadArtifacts
188
JpsPackagingElement (Element element) { JpsPackagingElement packagingElement = createPackagingElement(element); if (packagingElement instanceof JpsCompositePackagingElement) { for (Element childElement : JDOMUtil.getChildren(element, ELEMENT_TAG)) { JpsPackagingElement child = loadPackagingElement(childElement); if (child != null) { ((JpsCompositePackagingElement)packagingElement).addChild(child); } } } return packagingElement; }
loadPackagingElement
189
JpsPackagingElement (Element element) { String typeId = element.getAttributeValue(ID_ATTRIBUTE); if (typeId == null) return null; JpsPackagingElementSerializer<?> serializer = findElementSerializer(typeId); if (serializer != null) { return serializer.load(element); } return null; }
createPackagingElement
190
JpsArtifactRootElement (Element element) { return JpsPackagingElementFactory.getInstance().createArtifactRoot(); }
load
191
JpsDirectoryPackagingElement (Element element) { return JpsPackagingElementFactory.getInstance().createDirectory(element.getAttributeValue("name")); }
load
192
JpsArchivePackagingElement (Element element) { return JpsPackagingElementFactory.getInstance().createArchive(element.getAttributeValue("name")); }
load
193
JpsFileCopyPackagingElement (Element element) { return JpsPackagingElementFactory.getInstance().createFileCopy(element.getAttributeValue("path"), element.getAttributeValue("output-file-name")); }
load
194
JpsDirectoryCopyPackagingElement (Element element) { return JpsPackagingElementFactory.getInstance().createDirectoryCopy(element.getAttributeValue("path")); }
load
195
JpsExtractedDirectoryPackagingElement (Element element) { return JpsPackagingElementFactory.getInstance().createExtractedDirectory(element.getAttributeValue("path"), element.getAttributeValue("path-in-jar")); }
load
196
JpsLibraryFilesPackagingElement (Element element) { String level = element.getAttributeValue("level"); String libraryName = element.getAttributeValue("name"); String moduleName = element.getAttributeValue("module-name"); JpsElementReference<? extends JpsCompositeElement> parentReference; if (moduleName != null) { parentReference = JpsElementFactory.getInstance().createModuleReference(moduleName); } else { parentReference = JpsLibraryTableSerializer.createLibraryTableReference(level); } return JpsPackagingElementFactory.getInstance() .createLibraryElement(JpsElementFactory.getInstance().createLibraryReference(libraryName, parentReference)); }
load
197
JpsArtifactOutputPackagingElement (Element element) { return JpsPackagingElementFactory.getInstance() .createArtifactOutput(JpsArtifactService.getInstance().createReference(element.getAttributeValue("artifact-name"))); }
load
198
JpsElementChildRole<E> () { return myRole; }
getRole
199
String () { return myId; }
getId