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 2022/12/28 04:57:18 UTC

[GitHub] [netbeans] jtulach opened a new pull request, #5157: Recognize nbjrt: protocol and locate JDK9+ src.zip

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

   The `PlatformForSourceBinaryQuery` class contains support for so called _"unregistered platforms"_. However it seems that the code hasn't been updated to JDK9+ layout. This PR does that. The previously existing test (for JDK8 layout) has been copied and modified to mimic the layout of JDK9+.


-- 
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] mbien commented on a diff in pull request #5157: Recognize nbjrt: protocol and locate JDK9+ src.zip

Posted by GitBox <gi...@apache.org>.
mbien commented on code in PR #5157:
URL: https://github.com/apache/netbeans/pull/5157#discussion_r1059247320


##########
java/java.platform/src/org/netbeans/modules/java/platform/queries/PlatformSourceForBinaryQuery.java:
##########
@@ -94,24 +94,46 @@ public SourceForBinaryQueryImplementation2.Result findSourceRoots2(URL binaryRoo
             this.cache.put (binaryRoot, res);
             return res;
         }
-        String binaryRootS = binaryRoot.toExternalForm();
-        if (binaryRootS.startsWith(JAR_FILE)) {
-            if (binaryRootS.endsWith(RTJAR_PATH)) {
-                //Unregistered platform
-                String srcZipS = binaryRootS.substring(4,binaryRootS.length() - RTJAR_PATH.length()) + SRC_ZIP;
-                try {
-                    URL srcZip = FileUtil.getArchiveRoot(new URL(srcZipS));
-                    FileObject fo = URLMapper.findFileObject(srcZip);
-                    if (fo != null) {
-                        return new UnregisteredPlatformResult (fo);
-                    }
-                } catch (MalformedURLException mue) {
-                    Exceptions.printStackTrace(mue);
-                }
-            }
+        return searchUnregisteredPlatform(binaryRoot.toExternalForm());
+    }
+
+  static SourceForBinaryQueryImplementation2.Result searchUnregisteredPlatform(String binaryRootS) {
+    String srcZipS = null;
+    String srcZipIn = null;
+    if (binaryRootS.startsWith(JAR_FILE)) {
+      if (binaryRootS.endsWith(RTJAR_PATH)) {

Review Comment:
   awesome thanks.
   
   Yeah its probably a good idea to copy a few selected IDE defaults to the project settings. Its probably not worth it though if it has to be set up for every single module, would be too much noise for little gain IMO.



-- 
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] lkishalmi commented on a diff in pull request #5157: Recognize nbjrt: protocol and locate JDK9+ src.zip

Posted by GitBox <gi...@apache.org>.
lkishalmi commented on code in PR #5157:
URL: https://github.com/apache/netbeans/pull/5157#discussion_r1059473233


##########
java/java.platform/src/org/netbeans/modules/java/platform/queries/PlatformSourceForBinaryQuery.java:
##########
@@ -94,24 +94,46 @@ public SourceForBinaryQueryImplementation2.Result findSourceRoots2(URL binaryRoo
             this.cache.put (binaryRoot, res);
             return res;
         }
-        String binaryRootS = binaryRoot.toExternalForm();
-        if (binaryRootS.startsWith(JAR_FILE)) {
-            if (binaryRootS.endsWith(RTJAR_PATH)) {
-                //Unregistered platform
-                String srcZipS = binaryRootS.substring(4,binaryRootS.length() - RTJAR_PATH.length()) + SRC_ZIP;
-                try {
-                    URL srcZip = FileUtil.getArchiveRoot(new URL(srcZipS));
-                    FileObject fo = URLMapper.findFileObject(srcZip);
-                    if (fo != null) {
-                        return new UnregisteredPlatformResult (fo);
-                    }
-                } catch (MalformedURLException mue) {
-                    Exceptions.printStackTrace(mue);
-                }
-            }
+        return searchUnregisteredPlatform(binaryRoot.toExternalForm());
+    }
+
+  static SourceForBinaryQueryImplementation2.Result searchUnregisteredPlatform(String binaryRootS) {
+    String srcZipS = null;
+    String srcZipIn = null;
+    if (binaryRootS.startsWith(JAR_FILE)) {
+      if (binaryRootS.endsWith(RTJAR_PATH)) {

Review Comment:
   NetBeans Formatter needs one more level of indirection, as it currently uses the project's auxiliary properties directly. If I had time...



-- 
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] jtulach commented on a diff in pull request #5157: Recognize nbjrt: protocol and locate JDK9+ src.zip

Posted by GitBox <gi...@apache.org>.
jtulach commented on code in PR #5157:
URL: https://github.com/apache/netbeans/pull/5157#discussion_r1059465689


##########
java/java.platform/test/unit/src/org/netbeans/modules/java/platform/queries/PlatformSourceForBinaryQueryTest.java:
##########
@@ -82,6 +80,23 @@ public void testUnregisteredPlatform() throws Exception {
         assertNull(result);
     }
 
+    public void testUnregisteredJDK11Platform() throws Exception {
+        File wd = getWorkDir();

Review Comment:
   [PlatformSourceForBinaryQueryTest](https://github.com/apache/netbeans/actions/runs/3804935671/jobs/6473338798#step:20:579) seems to pass OK.



-- 
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] mbien commented on a diff in pull request #5157: Recognize nbjrt: protocol and locate JDK9+ src.zip

Posted by GitBox <gi...@apache.org>.
mbien commented on code in PR #5157:
URL: https://github.com/apache/netbeans/pull/5157#discussion_r1059158712


##########
java/java.platform/src/org/netbeans/modules/java/platform/queries/PlatformSourceForBinaryQuery.java:
##########
@@ -94,24 +94,46 @@ public SourceForBinaryQueryImplementation2.Result findSourceRoots2(URL binaryRoo
             this.cache.put (binaryRoot, res);
             return res;
         }
-        String binaryRootS = binaryRoot.toExternalForm();
-        if (binaryRootS.startsWith(JAR_FILE)) {
-            if (binaryRootS.endsWith(RTJAR_PATH)) {
-                //Unregistered platform
-                String srcZipS = binaryRootS.substring(4,binaryRootS.length() - RTJAR_PATH.length()) + SRC_ZIP;
-                try {
-                    URL srcZip = FileUtil.getArchiveRoot(new URL(srcZipS));
-                    FileObject fo = URLMapper.findFileObject(srcZip);
-                    if (fo != null) {
-                        return new UnregisteredPlatformResult (fo);
-                    }
-                } catch (MalformedURLException mue) {
-                    Exceptions.printStackTrace(mue);
-                }
-            }
+        return searchUnregisteredPlatform(binaryRoot.toExternalForm());
+    }
+
+  static SourceForBinaryQueryImplementation2.Result searchUnregisteredPlatform(String binaryRootS) {
+    String srcZipS = null;
+    String srcZipIn = null;
+    if (binaryRootS.startsWith(JAR_FILE)) {
+      if (binaryRootS.endsWith(RTJAR_PATH)) {

Review Comment:
   would be good to use standard indentation settings for new code.



-- 
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] jtulach merged pull request #5157: Recognize nbjrt: protocol and locate JDK9+ src.zip

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


-- 
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] jtulach commented on a diff in pull request #5157: Recognize nbjrt: protocol and locate JDK9+ src.zip

Posted by GitBox <gi...@apache.org>.
jtulach commented on code in PR #5157:
URL: https://github.com/apache/netbeans/pull/5157#discussion_r1059244099


##########
java/java.platform/src/org/netbeans/modules/java/platform/queries/PlatformSourceForBinaryQuery.java:
##########
@@ -94,24 +94,46 @@ public SourceForBinaryQueryImplementation2.Result findSourceRoots2(URL binaryRoo
             this.cache.put (binaryRoot, res);
             return res;
         }
-        String binaryRootS = binaryRoot.toExternalForm();
-        if (binaryRootS.startsWith(JAR_FILE)) {
-            if (binaryRootS.endsWith(RTJAR_PATH)) {
-                //Unregistered platform
-                String srcZipS = binaryRootS.substring(4,binaryRootS.length() - RTJAR_PATH.length()) + SRC_ZIP;
-                try {
-                    URL srcZip = FileUtil.getArchiveRoot(new URL(srcZipS));
-                    FileObject fo = URLMapper.findFileObject(srcZip);
-                    if (fo != null) {
-                        return new UnregisteredPlatformResult (fo);
-                    }
-                } catch (MalformedURLException mue) {
-                    Exceptions.printStackTrace(mue);
-                }
-            }
+        return searchUnregisteredPlatform(binaryRoot.toExternalForm());
+    }
+
+  static SourceForBinaryQueryImplementation2.Result searchUnregisteredPlatform(String binaryRootS) {
+    String srcZipS = null;
+    String srcZipIn = null;
+    if (binaryRootS.startsWith(JAR_FILE)) {
+      if (binaryRootS.endsWith(RTJAR_PATH)) {

Review Comment:
   It would help if NetBeans apisupport projects specified the proper indentation settings. Otherwise the source gets formatted by my _global defaults_ (which are set to Google Java standards, not Sun/Oracle now).
   
   Reformatted in [5b0d432](https://github.com/apache/netbeans/pull/5157/commits/5b0d432b4d1e0b87ad92486b56e90cfe80c8d1f2)



-- 
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] jtulach commented on a diff in pull request #5157: Recognize nbjrt: protocol and locate JDK9+ src.zip

Posted by GitBox <gi...@apache.org>.
jtulach commented on code in PR #5157:
URL: https://github.com/apache/netbeans/pull/5157#discussion_r1059466485


##########
java/java.platform/src/org/netbeans/modules/java/platform/queries/PlatformSourceForBinaryQuery.java:
##########
@@ -94,24 +94,46 @@ public SourceForBinaryQueryImplementation2.Result findSourceRoots2(URL binaryRoo
             this.cache.put (binaryRoot, res);
             return res;
         }
-        String binaryRootS = binaryRoot.toExternalForm();
-        if (binaryRootS.startsWith(JAR_FILE)) {
-            if (binaryRootS.endsWith(RTJAR_PATH)) {
-                //Unregistered platform
-                String srcZipS = binaryRootS.substring(4,binaryRootS.length() - RTJAR_PATH.length()) + SRC_ZIP;
-                try {
-                    URL srcZip = FileUtil.getArchiveRoot(new URL(srcZipS));
-                    FileObject fo = URLMapper.findFileObject(srcZip);
-                    if (fo != null) {
-                        return new UnregisteredPlatformResult (fo);
-                    }
-                } catch (MalformedURLException mue) {
-                    Exceptions.printStackTrace(mue);
-                }
-            }
+        return searchUnregisteredPlatform(binaryRoot.toExternalForm());
+    }
+
+  static SourceForBinaryQueryImplementation2.Result searchUnregisteredPlatform(String binaryRootS) {
+    String srcZipS = null;
+    String srcZipIn = null;
+    if (binaryRootS.startsWith(JAR_FILE)) {
+      if (binaryRootS.endsWith(RTJAR_PATH)) {

Review Comment:
   A project type can provide some default `AuxiliarySettings` - [java.mx.project module](https://github.com/apache/netbeans/blob/master/java/java.mx.project/src/org/netbeans/modules/java/mx/project/SuiteProperties.java#L54) is doing that to influence the Eclipse formatter (used for mx projects).



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