Skip to content

Commit

Permalink
Reflecting review feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
lahodaj committed Nov 29, 2023
1 parent 2fd9342 commit 5f0f098
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ public static String joinCommandLines(Iterable<? extends String> inputLines) {
if (testVersion.startsWith("1.")) {
testVersion = testVersion.substring(2);
}
String existingVersion = joinedOptions.get("--source");
String existingVersion = joinedOptions.get(SOURCE);
if (existingVersion != null) {
if (existingVersion.startsWith("1.")) {
existingVersion = existingVersion.substring(2);
}
if (new SpecificationVersion(testVersion).compareTo(new SpecificationVersion(existingVersion)) > 0) {
joinedOptions.put("--source", version);
joinedOptions.put(SOURCE, version);
}
} else {
joinedOptions.put("--source", version);
joinedOptions.put(SOURCE, version);
}
i++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.netbeans.modules.java.file.launcher.queries;

import java.util.List;
import java.util.Objects;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.netbeans.api.java.platform.JavaPlatformManager;
Expand Down Expand Up @@ -72,11 +73,19 @@ private void updateDelegate() {
}
}

boolean modified;

synchronized (this) {
this.sourceLevel = sourceLevel;
modified = !Objects.equals(this.sourceLevel, sourceLevel);

if (modified) {
this.sourceLevel = sourceLevel;
}
}

cs.fireChange();
if (modified) {
cs.fireChange();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private ClassPath getSourcePath(FileObject file) {
}
}

return root2SourceCP.computeIfAbsent(root, r -> { //XXX: weak....
return root2SourceCP.computeIfAbsent(root, r -> {
ClassPath srcCP = ClassPathSupport.createClassPath(r);
GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {srcCP});
return srcCP;
Expand Down Expand Up @@ -145,7 +145,7 @@ private ClassPath getSourcePath(FileObject file) {

private synchronized FileObject getSourceRootImpl(FileObject file) {
for (FileObject root : root2SourceCP.keySet()) {
if (FileUtil.isParentOf(root, file) || root.equals(file)) {
if (root.equals(file) || FileUtil.isParentOf(root, file)) {
return root;
}
}
Expand Down Expand Up @@ -186,10 +186,12 @@ private ClassPath getBootPath(FileObject file) {
);

private static final Set<JavaTokenId> STOP_TOKENS = EnumSet.of(
JavaTokenId.IMPORT,
JavaTokenId.PUBLIC,
JavaTokenId.PROTECTED,
JavaTokenId.PRIVATE,
JavaTokenId.CLASS
JavaTokenId.CLASS,
JavaTokenId.LBRACE
);

static String findPackage(String fileContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ public void didChangeConfiguration(DidChangeConfigurationParams params) {
}
});
String fullAltConfigPrefix = client.getNbCodeCapabilities().getAltConfigurationPrefix();
String altConfigPrefix = fullConfigPrefix.substring(0, fullAltConfigPrefix.length() - 1);
String altConfigPrefix = fullAltConfigPrefix.substring(0, fullAltConfigPrefix.length() - 1);
boolean modified = false;
String newVMOptions = "";
JsonObject javaPlus = ((JsonObject) params.getSettings()).getAsJsonObject(altConfigPrefix);
Expand Down
4 changes: 2 additions & 2 deletions java/java.lsp.server/vscode/src/nbcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export function launch(
}
ideArgs.push(...extraArgs);

if (extraArgs && extraArgs.find(s => s.includes("--list"))) {
ideArgs.push(...['-J-Xdebug', '-J-Dnetbeans.logger.console=true', '-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000']);
if (env['netbeans_debug'] && extraArgs && extraArgs.find(s => s.includes("--list"))) {
ideArgs.push(...['-J-Dnetbeans.logger.console=true', '-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000']);
}

console.log(`Launching NBLS with arguments: ` + ideArgs);
Expand Down

0 comments on commit 5f0f098

Please sign in to comment.