sdedic commented on code in PR #5938:
URL: https://github.com/apache/netbeans/pull/5938#discussion_r1192178399
##########
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java:
##########
@@ -397,6 +398,47 @@ public CompletableFuture<Object>
executeCommand(ExecuteCommandParams params) {
return future;
});
}
+ case Server.JAVA_RESOLVE_STACKTRACE_LOCATION: {
+ CompletableFuture<Object> future = new CompletableFuture<>();
+ try {
+ String uri = ((JsonPrimitive)
params.getArguments().get(0)).getAsString();
Review Comment:
Possibly guard against `params.getArguments().size() < 3`
##########
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java:
##########
@@ -397,6 +398,47 @@ public CompletableFuture<Object>
executeCommand(ExecuteCommandParams params) {
return future;
});
}
+ case Server.JAVA_RESOLVE_STACKTRACE_LOCATION: {
+ CompletableFuture<Object> future = new CompletableFuture<>();
+ try {
+ String uri = ((JsonPrimitive)
params.getArguments().get(0)).getAsString();
+ String methodName = ((JsonPrimitive)
params.getArguments().get(1)).getAsString();
+ String fileName = ((JsonPrimitive)
params.getArguments().get(2)).getAsString();
+
+ FileObject fo = Utils.fromUri(uri);
+ ClassPath classPath =
ClassPathSupport.createProxyClassPath(new ClassPath[] {
+ ClassPath.getClassPath(fo, ClassPath.EXECUTE),
+ ClassPath.getClassPath(fo, ClassPath.BOOT)
+ });
+
+ String name = fileName.substring(0,
fileName.lastIndexOf('.'));
Review Comment:
this could eventually work for `.groovy` source files as well, right ?
##########
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java:
##########
@@ -397,6 +398,47 @@ public CompletableFuture<Object>
executeCommand(ExecuteCommandParams params) {
return future;
});
}
+ case Server.JAVA_RESOLVE_STACKTRACE_LOCATION: {
+ CompletableFuture<Object> future = new CompletableFuture<>();
+ try {
+ String uri = ((JsonPrimitive)
params.getArguments().get(0)).getAsString();
+ String methodName = ((JsonPrimitive)
params.getArguments().get(1)).getAsString();
+ String fileName = ((JsonPrimitive)
params.getArguments().get(2)).getAsString();
+
+ FileObject fo = Utils.fromUri(uri);
+ ClassPath classPath =
ClassPathSupport.createProxyClassPath(new ClassPath[] {
Review Comment:
Guard against `fo == null`, will NPE in `getClassPath`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists