entlicher commented on a change in pull request #2964:
URL: https://github.com/apache/netbeans/pull/2964#discussion_r637291509



##########
File path: 
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java
##########
@@ -198,16 +197,26 @@ public void progressHandleCreated(ProgressOperationEvent 
e) {
                     Lookup.getDefault()
             );
             List<String> args = argsToStringList(launchArguments.get("args"));
+            // Add session's lookup, it may override dialog displayer, etc.
+            Lookup execLookup = new ProxyLookup(launchCtx, 
context.getLspSession().getLookup());
             if (debug) {
                 requestProcessor.post(() -> {
-                    Lookups.executeWith(launchCtx, () -> {
+                    ActionProgress debugProgress = 
ActionProgress.start(launchCtx);
+                    ExecutionDescriptor ed = 
executionDescriptor.postExecution(exitCode -> {
+                        debugProgress.finished(exitCode == 0);
+                    });
+                    Lookups.executeWith(execLookup, () -> {
                         String miDebugger = (String) 
launchArguments.get("miDebugger");
-                        startNativeDebug(nativeImageFile, args, miDebugger, 
context, executionDescriptor, launchFuture);
+                        startNativeDebug(nativeImageFile, args, miDebugger, 
context, ed, launchFuture, debugProgress);
                     });
                 });
             } else {
-                Lookups.executeWith(launchCtx, () -> {
-                    execNative(nativeImageFile, args, context, 
executionDescriptor, launchFuture);//, success);
+                ExecutionDescriptor ed = 
executionDescriptor.postExecution(exitCode -> {
+                    ioContext.stop();
+                    notifyFinished(context, exitCode == 0);

Review comment:
       That's a catch! It's unexpected. This fact is not clear from the 
Javadoc. The annotation and the Javadoc says, that `postExecution` argument is 
allowed to be `null`. Not that the exit code passed to the Consumer can be 
`null`.
   It'd be good to explicitly stress that.
   Unfortunately, the functional features hurt the safeness of Java. It's 
impossible to put `@NullAllowed` on the `exitCode` parameter. I'd need to do it 
myself (which misses the point).




-- 
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.

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

Reply via email to