geertjanw closed pull request #478: [NETBEANS-577] Fixing modular ClasspathInfo 
when bulk running hints.
URL: https://github.com/apache/incubator-netbeans/pull/478
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
 
b/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
index baa350827..8d5e17866 100644
--- 
a/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
+++ 
b/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
@@ -1005,7 +1005,7 @@ private static JavacTaskImpl createJavacTask(
                     LOGGER.log(warnLevel,
                                "Even though the source level of {0} is set to: 
{1}, java.util.zip.CRC32C cannot be found on the system module path: {2}\n" +   
//NOI18N
                                "Changing source level to 1.8",  //NOI18N
-                               new Object[]{srcClassPath, sourceLevel, 
bootClassPath}); //NOI18N
+                               new Object[]{srcClassPath, sourceLevel, 
moduleBoot}); //NOI18N
                     return SourceLevelUtils.JDK1_8;
                 }
                 return source;
diff --git 
a/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java 
b/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java
index ca5c2714e..b8d6ce6f2 100644
--- a/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java
+++ b/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java
@@ -1069,7 +1069,9 @@ public synchronized ClasspathInfo createUniversalCPInfo() 
{
                     }
                 }
             }
-            final ClasspathInfo result = 
ClasspathInfo.create(select.getBootstrapLibraries(), ClassPath.EMPTY, 
ClassPath.EMPTY);
+            final ClasspathInfo result = new 
ClasspathInfo.Builder(select.getBootstrapLibraries())
+                                                          
.setModuleBootPath(select.getBootstrapLibraries())
+                                                          .build();
             if (cached != null) {
                     this.cached = new WeakReference<>(result);
             }
diff --git 
a/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchUtilities.java
 
b/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchUtilities.java
index 1b0e93cb0..05c56796b 100644
--- 
a/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchUtilities.java
+++ 
b/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/batch/BatchUtilities.java
@@ -49,6 +49,7 @@
 import org.netbeans.api.annotations.common.NonNull;
 import org.netbeans.api.java.classpath.ClassPath;
 import org.netbeans.api.java.classpath.ClassPath.PathConversionMode;
+import org.netbeans.api.java.classpath.JavaClassPathConstants;
 import org.netbeans.api.java.platform.JavaPlatformManager;
 import org.netbeans.api.java.source.ClasspathInfo;
 import org.netbeans.api.java.source.CompilationController;
@@ -415,7 +416,15 @@ public void run(WorkingCopy parameter) throws Exception {
         Map<ClasspathInfo, Collection<FileObject>> result = new 
IdentityHashMap<ClasspathInfo, Collection<FileObject>>();
 
         for (Entry<CPCategorizer, Collection<FileObject>> e : m.entrySet()) {
-            result.put(ClasspathInfo.create(e.getKey().boot, 
e.getKey().compile, e.getKey().source), e.getValue());
+            ClasspathInfo cpInfo = new ClasspathInfo.Builder(e.getKey().boot)
+                                                    
.setClassPath(e.getKey().compile)
+                                                    
.setSourcePath(e.getKey().source)
+                                                    
.setModuleSourcePath(e.getKey().moduleSrcPath)
+                                                    
.setModuleBootPath(e.getKey().moduleBootPath)
+                                                    
.setModuleCompilePath(e.getKey().moduleCompilePath)
+                                                    
.setModuleClassPath(e.getKey().moduleClassPath)
+                                                    .build();
+            result.put(cpInfo, e.getValue());
         }
         
         return result;
@@ -440,12 +449,20 @@ private static final ClassPath getClassPath(FileObject 
forFO, String id) {
         private final ClassPath boot;
         private final ClassPath compile;
         private final ClassPath source;
+        private final ClassPath moduleSrcPath;
+        private final ClassPath moduleBootPath;
+        private final ClassPath moduleCompilePath;
+        private final ClassPath moduleClassPath;
         private final FileObject sourceRoot;
 
         public CPCategorizer(FileObject file) {
             this.boot = getClassPath(file, ClassPath.BOOT);
             this.compile = getClassPath(file, ClassPath.COMPILE);
             this.source = getClassPath(file, ClassPath.SOURCE);
+            this.moduleSrcPath = getClassPath(file, 
JavaClassPathConstants.MODULE_SOURCE_PATH);
+            this.moduleBootPath = getClassPath(file, 
JavaClassPathConstants.MODULE_BOOT_PATH);
+            this.moduleCompilePath = getClassPath(file, 
JavaClassPathConstants.MODULE_COMPILE_PATH);
+            this.moduleClassPath = getClassPath(file, 
JavaClassPathConstants.MODULE_CLASS_PATH);
             this.sourceRoot = source != null ? source.findOwnerRoot(file) : 
null;
             
             StringBuilder cps = new StringBuilder();
@@ -453,6 +470,10 @@ public CPCategorizer(FileObject file) {
             if (boot != null) 
cps.append(boot.toString(PathConversionMode.PRINT));
             if (compile != null) 
cps.append(compile.toString(PathConversionMode.PRINT));
             if (source != null) 
cps.append(source.toString(PathConversionMode.PRINT));
+            if (moduleSrcPath != null) 
cps.append(moduleSrcPath.toString(PathConversionMode.PRINT));
+            if (moduleBootPath != null) 
cps.append(moduleBootPath.toString(PathConversionMode.PRINT));
+            if (moduleCompilePath != null) 
cps.append(moduleCompilePath.toString(PathConversionMode.PRINT));
+            if (moduleClassPath != null) 
cps.append(moduleClassPath.toString(PathConversionMode.PRINT));
             
             this.cps = cps.toString();
         }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to