You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ge...@apache.org on 2018/04/03 11:34:09 UTC

[incubator-netbeans] branch master updated: [NETBEANS-577] Fixing modular ClasspathInfo when bulk running hints. (#478)

This is an automated email from the ASF dual-hosted git repository.

geertjan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 250015c  [NETBEANS-577] Fixing modular ClasspathInfo when bulk running hints. (#478)
250015c is described below

commit 250015c51a3f59ef5145c2764eafa517016c4a34
Author: Jan Lahoda <la...@gmail.com>
AuthorDate: Tue Apr 3 13:34:05 2018 +0200

    [NETBEANS-577] Fixing modular ClasspathInfo when bulk running hints. (#478)
---
 .../modules/java/source/parsing/JavacParser.java   |  2 +-
 .../modules/java/hints/spiimpl/Utilities.java      |  4 +++-
 .../java/hints/spiimpl/batch/BatchUtilities.java   | 23 +++++++++++++++++++++-
 3 files changed, 26 insertions(+), 3 deletions(-)

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 baa3508..8d5e178 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 @@ public class JavacParser extends Parser {
                     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 ca5c271..b8d6ce6 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 class Utilities {
                     }
                 }
             }
-            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 1b0e93c..05c5679 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.CheckForNull;
 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 class BatchUtilities {
         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 @@ public class BatchUtilities {
         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 class BatchUtilities {
             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();
         }

-- 
To stop receiving notification emails like this one, please contact
geertjan@apache.org.

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

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