eppleton commented on code in PR #9650:
URL: https://github.com/apache/netbeans/pull/9650#discussion_r4172217898


##########
java/java.file.launcher/src/org/netbeans/modules/java/file/launcher/SingleSourceFileUtil.java:
##########
@@ -95,9 +98,18 @@ public static boolean isSupportedFile(FileObject file) {
         try {
             FileObject dir = file.getParent();
             File dirFile = dir != null ? FileUtil.toFile(dir) : null;
-            return !MultiSourceRootProvider.DISABLE_MULTI_SOURCE_ROOT
-                    && FileOwnerQuery.getOwner(file) == null
-                    && !file.getFileSystem().isReadOnly()
+            if (MultiSourceRootProvider.DISABLE_MULTI_SOURCE_ROOT) {
+                return false;
+            }
+            Project owner = FileOwnerQuery.getOwner(file);

Review Comment:
   This enables single-file support under a fallback, but 
`MultiSourceRootProvider` (around line 510, 
`RootPathResourceImplementation.includes`) still filters the source path with 
`FileOwnerQuery.getOwner(fo) == null`. So a loose file under a fallback now 
gets a source path, but that path excludes the file itself and its siblings.
   
   I checked it in `MultiSourceRootProviderTest` on this branch: a folder with 
`pack/A.java` and `pack/B.java`, opened via `findProjectOrFallback`. 
`findClassPath(A, SOURCE)` returns a path rooted at the folder, but 
`contains(A)` and `contains(B)` are both false. Without the fallback, both are 
true.
   
   Run/Debug is enabled now, but `A` can't use `B` and the files are probably 
not indexed. Maybe `includes()` should apply the same rule as here (no owner, 
or an owner without Java source groups), ideally through a shared helper so the 
two can't drift apart again.
   



##########
java/java.file.launcher/nbproject/project.xml:
##########
@@ -273,6 +273,21 @@
                         <specification-version>9.29</specification-version>
                     </run-dependency>
                 </dependency>
+                <dependency>
+                    <code-name-base>org.openide.util.ui.svg</code-name-base>
+                    <build-prerequisite/>
+                    <run-dependency>
+                        <specification-version>1.28</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.netbeans.modules.maven</code-name-base>

Review Comment:
   This makes `org.netbeans.modules.maven` (and `org.openide.util.ui.svg` 
above) runtime dependencies of `java.file.launcher`, although no production 
code in the module uses them. Only the new Maven test in `JavaFileTest` needs 
them. As it is, the single-file launcher could not be enabled without Maven 
support. I think both belong under `<test-dependencies>`.
   



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