Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,7 @@ The extension will analyze the content of the opened workspace, and relevant oth
1. Check the `pom.xml` file for any duplicated tags.
2. If duplicated tags are found, remove the extra tags and attempt to compile again.
3. Add the `--enable-preview` VM argument to the *exec-maven-plugin* or *maven-surefile-plugin* configurations if they are used execution or test runs.
2. If the "*Launch Java App*" configuration is being used to *Run and Debug* an application, the following issues may occur if no `mainClass` field value is defined.
- Issues:
1. If more than 2 main classes are present in the project, then using the *Run and Debug* button does not launch execution and appears as stuck prior to run.
2. If the editor window open is a file that is not within the src root of the maven/gradle project, then using the *Run and Debug* button launches the projects tests.
- Resolution or Workaround:
1. Open the `launch.json` file.
2. Edit the configuration for the "*Launch Java App*", i.e. the one which has `"type": "jdk"` and `"request": "launch"`.
3. Define a value for the *mainClass* field, i.e. `"mainClass": "<main class fully-qualified-name or file-path>"`.
3. The *Project: Test Project* command executes the project's tests but does not update the Testing or the Tests Results panels. The test output is present only in the Terminal or Debug Console panel.
2. The *Project: Test Project* command executes the project's tests but does not update the Testing or the Tests Results panels. The test output is present only in the Terminal or Debug Console panel.

## Telemetry

Expand Down
1 change: 1 addition & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
patches/8038-draft.diff
patches/8690.diff
patches/8829.diff
patches/8828.diff
patches/7893-draft.diff
patches/8460-draft.diff
patches/8745-draft.diff
Expand Down
47 changes: 47 additions & 0 deletions patches/8828.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java
index a8ca4f2143de..e503da42bd4b 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java
@@ -571,7 +571,7 @@ public void finished(boolean success) {
mainSource = false;
} else {
FileObject fileRoot = sourceCP != null ? sourceCP.findOwnerRoot(toRun) : null;
- mainSource = fileRoot != null && UnitTestForSourceQuery.findUnitTests(fileRoot).length > 0;
+ mainSource = fileRoot == null || UnitTestForSourceQuery.findSources(fileRoot).length == 0;
}
ActionProvider provider = null;
String command = null;
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchRequestHandler.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchRequestHandler.java
index b1a472ce99a4..5e6242c6e89d 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchRequestHandler.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchRequestHandler.java
@@ -32,6 +32,8 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -70,7 +72,7 @@
* @author martin
*/
public final class NbLaunchRequestHandler {
-
+ private static final Logger LOG = Logger.getLogger(NbLaunchRequestHandler.class.getName());
private NbLaunchDelegate activeLaunchHandler;

public CompletableFuture<Void> launch(Map<String, Object> launchArguments, DebugAdapterContext context) {
@@ -148,7 +150,10 @@ public CompletableFuture<Void> launch(Map<String, Object> launchArguments, Debug
case 1:
handleSelectedMainClass.accept(mainClasses.get(0));
break;
- case 2:
+ default:
+ if(mainClasses.size() > 10){
+ LOG.log(Level.WARNING, "The number of main classes is large :{0}", mainClasses.size());
+ }
List<NotifyDescriptor.QuickPick.Item> mainClassItems =
mainClasses.stream()
.map(eh -> new Item(eh.getQualifiedName(), eh.getQualifiedName()))