You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "lahodaj (via GitHub)" <gi...@apache.org> on 2024/09/05 07:34:10 UTC
[PR] Roots (and directories) containing multi-file launcher sources should respond to ClassPath queries. [netbeans]
lahodaj opened a new pull request, #7733:
URL: https://github.com/apache/netbeans/pull/7733
The multi-file source launcher support has been tweaked under:
https://github.com/apache/netbeans/pull/7509
to only respond to files that are source launcher files. But, that means the queries no longer respond when asked about directories, especially the root. But, the Java indexing, and other features, need the ClassPath to work also on the root directories. As a consequence, the multi-file source launcher is now broken.
The proposal herein is to respond not only for source launcher files as before, but also for enclosing directories up to the package hierarchy root. This will happen only if the root has already been recognized, so it should not alter cases where source file launcher is not used.
--
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
Re: [PR] Roots (and directories) containing multi-file launcher sources should respond to ClassPath queries. [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #7733:
URL: https://github.com/apache/netbeans/pull/7733#issuecomment-2332792410
I tested this with the following setup:
`/tmp/sources/Main.java`
```java
public class Main {
public static void main(String args[]) {
System.out.println("hello");
System.out.println(Runtime.version());
dev.test.Util.foo();
}
}
```
`/tmp/sources/dev/test/Util.java`
```java
package dev.test;
public class Util {
public static void foo() {
System.out.println("foo called");
}
}
```
and added `/tmp `to the favorites window.
this caused:
```
WARNING [org.netbeans.modules.java.source.tasklist.IncorrectErrorBadges]: Incorrect error badges detected, file=/tmp/sources/Main.java.
WARNING [org.netbeans.modules.java.source.tasklist.IncorrectErrorBadges]: Not PathRegistry controlled root: /tmp/sources@5c553aa0:17939bbf
```
although the error badges were sometimes not visible until I restarted NetBeans.
--
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
Re: [PR] Roots (and directories) containing multi-file launcher sources should respond to ClassPath queries. [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on PR #7733:
URL: https://github.com/apache/netbeans/pull/7733#issuecomment-2334806738
> > Wouldn't it make sense to use the same approach as CPPLite? I.e. ask the user to create a "virtual" project? That way we could get rid of the hacks and use the "normal" NetBeans architecture.
>
> I don't recall any positive feedback on CPPLite (but plenty, plenty of negative). So no, forcing the users to create manually a project does not sound like a good idea, unless there are piles of positive feedback on CPPLite hiding somewhere.
From my POV CPPLite suffers from the problem, that you need to configure much more, than just the root of the project. You'll need the metadata file, that described compilation. I tried once to get small step improvements by allowing to use the language server without additional configuration, which was rejected.
The same does not apply to this kind of java project.
--
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
Re: [PR] Roots (and directories) containing multi-file launcher sources should respond to ClassPath queries. [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #7733:
URL: https://github.com/apache/netbeans/pull/7733#issuecomment-2334758100
> Wouldn't it make sense to use the same approach as CPPLite? I.e. ask the user to create a "virtual" project? That way we could get rid of the hacks and use the "normal" NetBeans architecture.
could the main class not simply have a check box in the file properties to opt into a project-less compilation/execution model?
I think at some point there must be some way to specify the classpath anyway, otherwise "java scripts" like https://github.com/apache/netbeans/blob/master/.github/scripts/BinariesListUpdates.java will never work properly in NB (since the jar dependencies are not necessarily in the same folder).
The file properties already have JVM/program args and a JDK selector https://github.com/apache/netbeans/pull/7605
--
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
Re: [PR] Roots (and directories) containing multi-file launcher sources should respond to ClassPath queries. [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on PR #7733:
URL: https://github.com/apache/netbeans/pull/7733#issuecomment-2340296126
Here:
https://github.com/apache/netbeans/pull/7733/commits/ef4a2e520a5fd46130f5f5ba7786162a99b68d11
I tried to add a checkbox to enable/disable the registration of the root.
--
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
Re: [PR] Roots (and directories) containing multi-file launcher sources should respond to ClassPath queries. [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on PR #7733:
URL: https://github.com/apache/netbeans/pull/7733#issuecomment-2334759302
> Whether or not my finding is really a problem I did not investigate, but the hits on the breakpoints invalidated the claim that it is save because it is only relevant if multi-file launcher is used.
What I meant was that the root must first be discovered through a file. But I admit I wrote that ambiguously.
>
> Wouldn't it make sense to use the same approach as CPPLite? I.e. ask the user to create a "virtual" project? That way we could get rid of the hacks and use the "normal" NetBeans architecture.
I don't recall any positive feedback on CPPLite (but plenty, plenty of negative). So no, forcing the users to create manually a project does not sound like a good idea, unless there are piles of positive feedback on CPPLite hiding somewhere.
When I was doing this, I tried to create a project automatically, but a) it was extremely complicated; b) it wouldn't solve anything if the project was created automatically anyway.
>
> I'll be away from keyboard for the next week, I won't stay in the way of this, but it would be nice if new features (the problem exists since the introduction of support for source file launchers) would not break the IDE.
While I am trying to not break things, sometimes I do, I am afraid. The only way how one can not introduce (new) breakages is to do nothing (and live with the existing breakages).
--
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
Re: [PR] Roots (and directories) containing multi-file launcher sources should respond to ClassPath queries. [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on PR #7733:
URL: https://github.com/apache/netbeans/pull/7733#issuecomment-2334713213
Whether or not my finding is really a problem I did not investigate, but the hits on the breakpoints invalidated the claim that it is save because it is only relevant if multi-file launcher is used.
Wouldn't it make sense to use the same approach as CPPLite? I.e. ask the user to create a "virtual" project? That way we could get rid of the hacks and use the "normal" NetBeans architecture.
I'll be away from keyboard for the next week, I won't stay in the way of this, but it would be nice if new features (the problem exists since the introduction of support for source file launchers) would not break the IDE.
--
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
Re: [PR] Roots (and directories) containing multi-file launcher sources should respond to ClassPath queries. [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on PR #7733:
URL: https://github.com/apache/netbeans/pull/7733#issuecomment-2337150810
> could the main class not simply have a check box in the file properties to opt into a project-less compilation/execution model?
Hm, that should be doable, thanks!
--
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
Re: [PR] Roots (and directories) containing multi-file launcher sources should respond to ClassPath queries. [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on PR #7733:
URL: https://github.com/apache/netbeans/pull/7733#issuecomment-2334317203
> The proposal herein is to respond not only for source launcher files as before, but also for enclosing directories up to the package hierarchy root. This will happen only if the root has already been recognized, so it should not alter cases where source file launcher is not used.
I checked it and I think it does not work. Here is what I did:
1. Build NetBeans from this branch
2. Place breakpoints in `MultiSourceRootProvider.java`, lines 110 and 164
3. Remove `nbbuild/testuserdir`
4. Run "Debug" from the "Java File Launcher" project
5. Enable "Java SE" in the Plugin manager
6. Ensure there is a "test.java" file in your home directory
7. Open "Favorites" tab
8. Expand the "Home" node
The breakpoint in line 164 is hit with the home directory as `root`. The letting the IDE continue running the breakpoint in line 110 is hit, reporting `true` for my home directory.
I did not use the source file launcher, yet the file and the directory are now recognized.
What is more I see similar reports as @mbien. I opened java files from a JDK checkout and see:
```
INFO [org.netbeans.modules.java.hints.WrongPackageSuggestion]: source cp is either null or does not contain the compiled source cp=
INFO [org.netbeans.modules.java.hints.WrongPackageSuggestion]: source cp is either null or does not contain the compiled source cp=
WARNING [org.netbeans.modules.java.source.tasklist.IncorrectErrorBadges]: Incorrect error badges detected, file=/home/matthias/src/jdk/src/java.desktop/unix/classes/sun/font/X11GB18030_1.java.
WARNING [org.netbeans.modules.java.source.tasklist.IncorrectErrorBadges]: The file is not on its own source classpath, ignoring.
```
--
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
Re: [PR] Roots (and directories) containing multi-file launcher sources should respond to ClassPath queries. [netbeans]
Posted by "lahodaj (via GitHub)" <gi...@apache.org>.
lahodaj commented on PR #7733:
URL: https://github.com/apache/netbeans/pull/7733#issuecomment-2334650682
I am not quite sure what exactly is (or better said was) the problem with the ClassPathProvider returning the ClassPath for the root or directory, except that debugger stopped at some line. The behavior before #7509 was I believe to return the ClassPath, and neither that PR nor the associated bug provide any clues what was the problem.
Anyway, I've updated this patch to only return the ClassPath when the branding is set to register the roots. I hereby also apologize I didn't quite realize the full impact of #7509, that was my mistake.
Regarding the:
```
WARNING [org.netbeans.modules.java.source.tasklist.IncorrectErrorBadges]: Incorrect error badges detected, file=/home/jlahoda/test-projects/multi-file-unnamed/test/TryGson.java.
WARNING [org.netbeans.modules.java.source.tasklist.IncorrectErrorBadges]: Not PathRegistry controlled root: /home/jlahoda/test-projects/multi-file-unnamed@e38edfdb:28505e6d
```
I am getting that even when running on master. Quite unsurprisingly: the file reports an error in the editor, but there are no errors in the index (since there's no index). `IncorrectErrorBadges` will try to force re-index, but finds out the root is not registered (and therefore not indexed), and prints a warning. So, the only options to solve this warning is either to register the root, or disable the warning. And since we are not going to do the former, feel free to do the later. I just don't think it is related to fixing this regression.
--
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