diff --git a/README.md b/README.md index 9ddd613..44d9ec6 100644 --- a/README.md +++ b/README.md @@ -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": "
"`. -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 diff --git a/build.xml b/build.xml index 9c5ad2e..fbf0b19 100644 --- a/build.xml +++ b/build.xml @@ -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 diff --git a/patches/8828.diff b/patches/8828.diff new file mode 100644 index 0000000..d3482c8 --- /dev/null +++ b/patches/8828.diff @@ -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 launch(Map launchArguments, DebugAdapterContext context) { +@@ -148,7 +150,10 @@ public CompletableFuture launch(Map 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 mainClassItems = + mainClasses.stream() + .map(eh -> new Item(eh.getQualifiedName(), eh.getQualifiedName()))