Skip to content

Commit d05fc28

Browse files
committed
addressed review comments
1 parent 83c0fbb commit d05fc28

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/NetBeansRunSinglePlugin.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class NetBeansRunSinglePlugin implements Plugin<Project> {
5151
private static final String RUN_SINGLE_ARGS = "runArgs";
5252
private static final String RUN_SINGLE_JVM_ARGS = "runJvmArgs";
5353
private static final String RUN_SINGLE_CWD = "runWorkingDir";
54-
private static final String RUN_SINGLE_SOURCE_SET_NAME = "runSourceSetName";
54+
private static final String RUN_SINGLE_SOURCE_SET_NAMES = "runSourceSetNames";
5555

5656
private static final String DEPRECATE_RUN_SINGLE =
5757
"runSingle task is deprecated. Inspect your configuration and use just 'run' task instead of 'runSingle'";
@@ -69,18 +69,18 @@ public void apply(Project project) {
6969
}
7070

7171
private void configureJavaExec(Project project, JavaExec je) {
72-
Object sourceSetValue = project.findProperty(RUN_SINGLE_SOURCE_SET_NAME);
72+
Object sourceSetValue = project.findProperty(RUN_SINGLE_SOURCE_SET_NAMES);
7373
if (sourceSetValue != null) {
7474
SourceSetContainer sourceSets = project.getExtensions().findByType(SourceSetContainer.class);
7575
if (sourceSets != null) {
76-
FileCollection additionalClassPath = Arrays.stream(sourceSetValue.toString().split(","))
76+
FileCollection updatedClasspath = Arrays.stream(sourceSetValue.toString().split(","))
7777
.map(String::trim)
7878
.map(sourceSets::findByName)
7979
.filter(Objects::nonNull)
8080
.map(SourceSet::getRuntimeClasspath)
8181
.reduce(project.getObjects().fileCollection(), FileCollection::plus);
8282

83-
je.setClasspath(je.getClasspath().plus(additionalClassPath));
83+
je.setClasspath(updatedClasspath);
8484
}
8585
}
8686
if (project.hasProperty(RUN_SINGLE_MAIN)) {

java/gradle.java/src/org/netbeans/modules/gradle/java/GradleJavaTokenProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ public class GradleJavaTokenProvider implements ReplaceTokenProvider {
5353
private static final String AFFECTED_BUILD_TASK = "affectedBuildTasks";//NOI18N
5454
private static final String TEST_TASK_NAME = "testTaskName"; //NOI18N
5555
private static final String CLEAN_TEST_TASK_NAME = "cleanTestTaskName"; //NOI18N
56-
private static final String SOURCE_SET_NAME = "sourceSetName"; //NOI18N
56+
private static final String SOURCE_SET_NAMES = "sourceSetNames"; //NOI18N
5757

5858
private static final Set<String> SUPPORTED = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
5959
SELECTED_CLASS,
6060
SELECTED_CLASS_NAME,
6161
SELECTED_METHOD,
6262
SELECTED_PACKAGE,
63-
SOURCE_SET_NAME,
63+
SOURCE_SET_NAMES,
6464
AFFECTED_BUILD_TASK
6565
)));
6666

@@ -125,7 +125,7 @@ private void processSourceSets(final Map<String, String> map, Lookup context) {
125125
GradleJavaSourceSet ss = gjp.containingSourceSet(f);
126126
if (ss != null) {
127127
Set<GradleJavaSourceSet.SourceType> types = ss.getSourceTypes(f);
128-
map.merge(SOURCE_SET_NAME, ss.getName(), (oldVal, newVal) -> oldVal + "," + newVal);
128+
map.merge(SOURCE_SET_NAMES, ss.getName(), (oldVal, newVal) -> oldVal.trim() + "," + newVal.trim());
129129
for (GradleJavaSourceSet.SourceType type : types) {
130130
buildTasks.add(ss.getBuildTaskName(type));
131131
}

java/gradle.java/src/org/netbeans/modules/gradle/java/action-mapping.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@
5353
</action>
5454

5555
<action name="run.single">
56-
<args>-PrunClassName=${selectedClass} -PrunSourceSetName=${sourceSetName} ${javaExec.workingDir} ${javaExec.environment} run --stacktrace ${javaExec.jvmArgs} ${javaExec.args}</args>
56+
<args>-PrunClassName=${selectedClass} -PrunSourceSetNames=${sourceSetNames} ${javaExec.workingDir} ${javaExec.environment} run --stacktrace ${javaExec.jvmArgs} ${javaExec.args}</args>
5757
</action>
5858

5959
<action name="debug.single">
60-
<args>-PrunClassName=${selectedClass} -PrunSourceSetName=${sourceSetName} ${javaExec.workingDir} ${javaExec.environment} run --stacktrace --debug-jvm ${javaExec.jvmArgs} ${javaExec.args}</args>
60+
<args>-PrunClassName=${selectedClass} -PrunSourceSetNames=${sourceSetNames} ${javaExec.workingDir} ${javaExec.environment} run --stacktrace --debug-jvm ${javaExec.jvmArgs} ${javaExec.args}</args>
6161
</action>
6262
</apply-for>
6363

@@ -91,7 +91,7 @@
9191
<actions>
9292
<apply-for plugins="java">
9393
<action name="run.single">
94-
<args>-PrunClassName=${selectedClass} -PrunSourceSetName=${sourceSetName} ${javaExec.workingDir} ${javaExec.environment} run --continuous ${javaExec.jvmArgs} ${javaExec.args}</args>
94+
<args>-PrunClassName=${selectedClass} -PrunSourceSetNames=${sourceSetNames} ${javaExec.workingDir} ${javaExec.environment} run --continuous ${javaExec.jvmArgs} ${javaExec.args}</args>
9595
</action>
9696
<action name="test.single">
9797
<args>"${cleanTestTaskName}" "${testTaskName}" --tests "${selectedClass}" --continuous</args>

java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.Collection;
2929
import java.util.Collections;
3030
import java.util.List;
31+
import java.util.Locale;
3132
import java.util.Map;
3233
import java.util.Objects;
3334
import java.util.Optional;
@@ -116,6 +117,7 @@ public abstract class NbLaunchDelegate {
116117

117118
private final RequestProcessor requestProcessor = new RequestProcessor(NbLaunchDelegate.class);
118119
private final Map<DebugAdapterContext, DebuggerManagerListener> debuggerListeners = new ConcurrentHashMap<>();
120+
private final static String JAVA_FILE_EXT = ".java";
119121

120122
public abstract void preLaunch(Map<String, Object> launchArguments, DebugAdapterContext context);
121123

@@ -572,13 +574,13 @@ public void finished(boolean success) {
572574
} else if (launchType == LaunchType.RUN_TEST) {
573575
mainSource = false;
574576
} else {
575-
mainSource = false;
577+
mainSource = true;
576578
if (sourceCP != null) {
577579
FileObject root = sourceCP.findOwnerRoot(toRun);
578580
if (root != null) {
579581
String relativePath = FileUtil.getRelativePath(root, toRun);
580-
if (relativePath != null && relativePath.toLowerCase().endsWith(".java")) {
581-
String className = relativePath.substring(0, relativePath.length() - 5).replace('/', '.');
582+
if (relativePath != null && relativePath.toLowerCase(Locale.ENGLISH).endsWith(JAVA_FILE_EXT)) {
583+
String className = relativePath.substring(0, relativePath.length() - JAVA_FILE_EXT.length()).replace('/', '.');
582584
ClasspathInfo cpi = ClasspathInfo.create(toRun);
583585
mainSource = SourceUtils.isMainClass(className, cpi, true);
584586
}

0 commit comments

Comments
 (0)