errael commented on code in PR #4672:
URL: https://github.com/apache/netbeans/pull/4672#discussion_r977147721


##########
java/spi.java.hints/src/org/netbeans/modules/java/hints/spiimpl/Utilities.java:
##########
@@ -1083,7 +1083,7 @@ public synchronized ClasspathInfo createUniversalCPInfo() 
{
             final JavaPlatformManager man = JavaPlatformManager.getDefault();
             if (select.getSpecification().getVersion() != null) {
                 for (JavaPlatform p : 
JavaPlatformManager.getDefault().getInstalledPlatforms()) {
-                    if (!"j2se".equals(p.getSpecification().getName()) || 
p.getSpecification().getVersion() == null) continue;
+                    if (!p.isValid() || 
!"j2se".equals(p.getSpecification().getName()) || 
p.getSpecification().getVersion() == null) continue;
                     if 
(p.getSpecification().getVersion().compareTo(select.getSpecification().getVersion())
 > 0) {
                         select = p;
                     }

Review Comment:
   > f the default platform has no spec version, it would simply select the 
default platform without searching further?
   
   Yes, I see that; but is it wrong?
   
   I'm not familiar with this code. Your suggestion makes sense in principle; 
but I don't know, and can't readily discern, if there might be some 
significance to a default platform with no spec.version. Clearly the original 
author made a decision about how to handle this. I'm uncomfortable changing the 
behavior of code paths I don't grok.
   
   > not pick a version which goes beyond (nb-)javac
   
   What would be the implication here if jdk-20 was picked and nb-javac only 
supported 19?
   
   About the `Stream.concat`: isn't it required that the default platform be an 
installed platform?
   
   ---
   
   Once I new how to fix the hints for my usage, it became a puzzle. I tried to 
see if I could find the **spot** without a lot of debugger action. I got lucky. 
I'm OK with closing this PR if you want to play with it, and would certainly 
watch for any discussion/changes. But I'm not qualified, without lots of 
effort, to go beyond avoiding a !valid platform
   
   BTW, thanks for the `Stream` implementation. I've done little work with 
them. The more I work through some examples the better.



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