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/07/20 15:54:54 UTC

[GitHub] [netbeans] mbien commented on a diff in pull request #4414: Fix #4411 - ensure moduleLocations is initialized.

mbien commented on code in PR #4414:
URL: https://github.com/apache/netbeans/pull/4414#discussion_r925774701


##########
java/java.source.base/src/org/netbeans/modules/java/source/parsing/PatchModuleFileManager.java:
##########
@@ -296,7 +296,8 @@ public FileObject getFileForOutput(Location location, String packageName, String
 
     private Location fixLocation(Location input) throws IOException {
         if (input == StandardLocation.CLASS_OUTPUT && overrideModuleName != null) {
-            return this.moduleLocations.stream().filter(pl -> overrideModuleName.equals(pl.getModuleName())).map(pl -> (Location) pl).findAny().orElse(input);
+            return moduleLocations(StandardLocation.PATCH_MODULE_PATH)
+                    .stream().filter(pl -> overrideModuleName.equals(pl.getModuleName())).map(pl -> (Location) pl).findAny().orElse(input);

Review Comment:
   this looks good to me, I actually wanted to propose the same but you were faster this time :)
   
   The confusing part while looking through the code however was that `moduleLocations(foo)` only allows foo to be the constant `StandardLocation.PATCH_MODULE_PATH`, everything else throws an exception. So it would be more intuitive to simply make that a `getModueLocations()` without parameter.



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