lbownik commented on code in PR #5174:
URL: https://github.com/apache/netbeans/pull/5174#discussion_r1059783060


##########
apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/Evaluator.java:
##########
@@ -423,9 +424,15 @@ private PropertyEvaluator createEvaluator(ModuleList ml) {
             buildDefaults.put(CP, "${module.classpath}:${cp.extra}"); // NOI18N
             buildDefaults.put(RUN_CP, 
"${module.run.classpath}:${cp.extra}:${build.classes.dir}"); // NOI18N
             if (type == NbModuleType.NETBEANS_ORG && 
"true".equals(projectProperties.getProperties().get("requires.nb.javac"))) {
-                ModuleEntry javacapi = 
ml.getEntry("org.netbeans.libs.javacapi");
-                if (javacapi != null) {
-                    
buildDefaults.put(ClassPathProviderImpl.BOOTCLASSPATH_PREPEND, 
javacapi.getClassPathExtensions());
+                ModuleEntry javacLibrary = 
ml.getEntry("org.netbeans.libs.javacapi");
+                if (javacLibrary != null) {
+                    List<String> bootstrapAPIs = new ArrayList<>();
+                    for (String ext : 
javacLibrary.getClassPathExtensions().split(Pattern.quote(File.pathSeparator))) 
{
+                        if (ext.endsWith("-api.jar")) {
+                            bootstrapAPIs.add(ext);
+                        }
+                    }
+                    
buildDefaults.put(ClassPathProviderImpl.BOOTCLASSPATH_PREPEND, 
bootstrapAPIs.stream().collect(Collectors.joining(File.pathSeparator)));

Review Comment:
   Would it be more compact to say
   String path = 
Stream.of(javacLibrary.getClassPathExtensions().split(Pattern.quote(File.pathSeparator))).
                         filter(ext -> ext.endsWith("-api.jar")).
                         collect(Collectors.joining(File.pathSeparator)));
   buildDefaults.put(ClassPathProviderImpl.BOOTCLASSPATH_PREPEND, path);
   
   or even extract path calculation into a private method with meaningful name 
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
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