Skip to content

Commit

Permalink
[NETBEANS-4762] It seems supporting MODULE_PROCESSOR_PATH in Gradle b…
Browse files Browse the repository at this point in the history
…reaks annotation processor detection.
  • Loading branch information
lkishalmi committed Sep 23, 2020
1 parent a04b626 commit 39734a3
Showing 1 changed file with 18 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public final class ClassPathProviderImpl extends ProjectOpenedHook implements Cl
MODULE_COMPILE_PATH,
MODULE_CLASS_PATH,
MODULE_EXECUTE_PATH,
MODULE_EXECUTE_CLASS_PATH,
MODULE_PROCESSOR_PATH
MODULE_EXECUTE_CLASS_PATH
));


Expand All @@ -80,29 +79,25 @@ public final class ClassPathProviderImpl extends ProjectOpenedHook implements Cl

public ClassPathProviderImpl(Project project) {
this.project = project;
this.pcl = new PropertyChangeListener() {
this.pcl = (PropertyChangeEvent evt) -> {
if (NbGradleProject.PROP_PROJECT_INFO.equals(evt.getPropertyName())) {
GradleJavaProject p = GradleJavaProject.get(ClassPathProviderImpl.this.project);
if (p != null) {
updateGroups(p.getSourceSets().keySet());
} else {
//We are no longer a Java Project
updateGroups(Collections.<String>emptySet());

@Override
public void propertyChange(PropertyChangeEvent evt) {
if (NbGradleProject.PROP_PROJECT_INFO.equals(evt.getPropertyName())) {
GradleJavaProject p = GradleJavaProject.get(ClassPathProviderImpl.this.project);
if (p != null) {
updateGroups(p.getSourceSets().keySet());
} else {
//We are no longer a Java Project
updateGroups(Collections.<String>emptySet());

}
}
if (NbGradleProject.PROP_RESOURCES.endsWith(evt.getPropertyName())) {
URI uri = (URI) evt.getNewValue();
if ((uri != null) && (uri.getPath() != null) && uri.getPath().endsWith(MODULE_INFO_JAVA)) {
GradleJavaProject gjp = GradleJavaProject.get(ClassPathProviderImpl.this.project);
if (gjp != null) {
GradleJavaSourceSet ss = gjp.containingSourceSet(Utilities.toFile(uri));
if ((ss != null) && (groups.get(ss.getName()) != null)) {
groups.get(ss.getName()).reset();
}
}
if (NbGradleProject.PROP_RESOURCES.endsWith(evt.getPropertyName())) {
URI uri = (URI) evt.getNewValue();
if ((uri != null) && (uri.getPath() != null) && uri.getPath().endsWith(MODULE_INFO_JAVA)) {
GradleJavaProject gjp = GradleJavaProject.get(ClassPathProviderImpl.this.project);
if (gjp != null) {
GradleJavaSourceSet ss = gjp.containingSourceSet(Utilities.toFile(uri));
if ((ss != null) && (groups.get(ss.getName()) != null)) {
groups.get(ss.getName()).reset();
}
}
}
Expand Down Expand Up @@ -199,7 +194,6 @@ public ClassPath getClassPath(String type) {
case MODULE_EXECUTE_CLASS_PATH: return getModuleLegacyRuntimeClassPath();

case PROCESSOR_PATH: return getJava8AnnotationProcessorPath();
case MODULE_PROCESSOR_PATH: return getModuleAnnotationProcessorPath();

default: return null;
}
Expand Down Expand Up @@ -318,14 +312,6 @@ private synchronized ClassPath getModuleCompilePath() {
return moduleCompile;
}

private synchronized ClassPath getModuleAnnotationProcessorPath() {
if (moduleAnnotationProcessor == null) {
//TODO: This one is pretty identical to the Java8 annotation processor path, maybe it should be removed?
moduleAnnotationProcessor = createMultiplexClassPath(getJava8AnnotationProcessorPath(), getJava8AnnotationProcessorPath());
}
return moduleAnnotationProcessor;
}

private ClassPath createMultiplexClassPath(ClassPath modulePath, ClassPath classPath) {
SourceSetAwareSelector selector = new SourceSetAwareSelector(modulePath, classPath);
selectors.add(selector);
Expand Down

0 comments on commit 39734a3

Please sign in to comment.