You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2023/01/01 14:49:41 UTC

[GitHub] [netbeans] jlahoda opened a new pull request, #5174: For nb.org projects, use the correct nbjavac prepend for the internal (boot)classpath.

jlahoda opened a new pull request, #5174:
URL: https://github.com/apache/netbeans/pull/5174

   When building the bootclasspath for APISupport (nb.org modules in particular), lookup the correct nbjavac API jar in the particular repository, and prepend it to the bootclasspath.
   
   
   
   
   ---
   **^Add meaningful description above**
   
   By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -
   
    - are all your own work, and you have the right to contribute them.
    - are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).
   
   Please make sure (eg. `git log`) that all commits have a valid name and email address for you in the Author field.
   
   If you're a first time contributor, see the Contributing guidelines for more information.
   
   If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.
   


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

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


[GitHub] [netbeans] matthiasblaesing commented on pull request #5174: For nb.org projects, use the correct nbjavac prepend for the internal (boot)classpath.

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on PR #5174:
URL: https://github.com/apache/netbeans/pull/5174#issuecomment-1377797599

   Lets get this in.


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

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


[GitHub] [netbeans] matthiasblaesing merged pull request #5174: For nb.org projects, use the correct nbjavac prepend for the internal (boot)classpath.

Posted by GitBox <gi...@apache.org>.
matthiasblaesing merged PR #5174:
URL: https://github.com/apache/netbeans/pull/5174


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

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


[GitHub] [netbeans] lbownik commented on a diff in pull request #5174: For nb.org projects, use the correct nbjavac prepend for the internal (boot)classpath.

Posted by GitBox <gi...@apache.org>.
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

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


[GitHub] [netbeans] jlahoda commented on pull request #5174: For nb.org projects, use the correct nbjavac prepend for the internal (boot)classpath.

Posted by GitBox <gi...@apache.org>.
jlahoda commented on PR #5174:
URL: https://github.com/apache/netbeans/pull/5174#issuecomment-1368550910

   > If I understand the idea correctly, the indention is, that code completion and type resolution of the IDE will work correctly for projects using the bundled javac. This is very good @jlahoda. However I checked `java.source.base` module and noticed, that only a subset of problems is gone. The module uses classes from the `com.sun.tools.javac.tree` package, which is in `nb-javac-jdk-19+33.jar`. I tested with this change and all problems are gone:
   > 
   > ```diff
   > --- a/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/Evaluator.java
   > +++ b/apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/Evaluator.java
   > @@ -426,15 +426,9 @@
   >              if (type == NbModuleType.NETBEANS_ORG && "true".equals(projectProperties.getProperties().get("requires.nb.javac"))) {
   >                  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, javacLibrary.getClassPathExtensions());
   >                          }
   >                      }
   > -                    buildDefaults.put(ClassPathProviderImpl.BOOTCLASSPATH_PREPEND, bootstrapAPIs.stream().collect(Collectors.joining(File.pathSeparator)));
   > -                }
   > -            }
   >              
   >              baseEval = PropertyUtils.sequentialPropertyEvaluator(predefs, providers.toArray(new PropertyProvider[providers.size()]));
   > ```
   
   That's what I don't want to do blindly - that would mean that any module could seemingly use javac internals, which does not sound right. (There are many limitations on this, so some modules have an impl. dependency even though they should not, the impl might be partially visible in the editor anyway, and the build also uses everything including the impl. OTOH, runtime is strict, and I don't think we should make the situation worse.) But, we may be able to parse the javac dependency, and if it is an impl. dependency, use even the implementation. (Of course, the very correct way would be to only use exported packages, but we don't do that in the IDE for anything.) Please see https://github.com/apache/netbeans/pull/5174/commits/441cd888642002d9e52632d08aa31c08f318bc37. 
   


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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

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