diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPBreakpointManager.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPBreakpointManager.java index 0d4154971..93200fb32 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPBreakpointManager.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPBreakpointManager.java @@ -68,7 +68,7 @@ public DSPBreakpointManager(IBreakpointManager platformBreakpointManager, IDebug * * @return the completeable future to signify when the breakpoints are all sent. */ - public CompletableFuture initialize() { + public CompletableFuture<@Nullable Void> initialize() { platformBreakpointManager.addBreakpointListener(this); platformBreakpointManager.addBreakpointManagerListener(this); return resendAllTargetBreakpoints(platformBreakpointManager.isEnabled()); @@ -101,7 +101,7 @@ public void breakpointManagerEnablementChanged(boolean enabled) { resendAllTargetBreakpoints(enabled); } - private CompletableFuture resendAllTargetBreakpoints(boolean enabled) { + private CompletableFuture<@Nullable Void> resendAllTargetBreakpoints(boolean enabled) { IBreakpoint[] breakpoints = platformBreakpointManager.getBreakpoints(); for (IBreakpoint breakpoint : breakpoints) { if (supportsBreakpoint(breakpoint)) { @@ -211,7 +211,7 @@ private void deleteBreakpointFromMap(IBreakpoint breakpoint) { } } - private CompletableFuture sendBreakpoints() { + private CompletableFuture<@Nullable Void> sendBreakpoints() { final var all = new ArrayList>(); for (Iterator>> iterator = targetBreakpoints.entrySet() .iterator(); iterator.hasNext();) { @@ -228,7 +228,7 @@ private CompletableFuture sendBreakpoints() { arguments.setBreakpoints(sourceBps); arguments.setSourceModified(false); CompletableFuture future = debugProtocolServer.setBreakpoints(arguments); - CompletableFuture future2 = future.thenAccept((SetBreakpointsResponse bpResponse) -> { + CompletableFuture<@Nullable Void> future2 = future.thenAccept((SetBreakpointsResponse bpResponse) -> { // TODO update platform breakpoint with new info }); all.add(future2); diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPDebugTarget.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPDebugTarget.java index 665fd3dfd..c42721536 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPDebugTarget.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPDebugTarget.java @@ -288,10 +288,8 @@ private CompletableFuture initialize(Map dspParameters, IProg } return q; }); - CompletableFuture configurationDoneFuture = CompletableFuture.allOf(initialized, capabilitiesFuture) - .thenRun(() -> { - monitor.worked(10); - }); + CompletableFuture<@Nullable Void> configurationDoneFuture = CompletableFuture + .allOf(initialized, capabilitiesFuture).thenRun(() -> monitor.worked(10)); if (ILaunchManager.DEBUG_MODE.equals(launch.getLaunchMode())) { configurationDoneFuture = configurationDoneFuture.thenCompose(v -> { monitor.worked(10); diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/launcher/DSPLaunchDelegate.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/launcher/DSPLaunchDelegate.java index 14eb3e632..adadf8ddb 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/launcher/DSPLaunchDelegate.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/launcher/DSPLaunchDelegate.java @@ -193,7 +193,8 @@ public Map getDspParameters() { public String toString() { return "DSPLaunchDelegateLaunchBuilder [configuration=" + configuration + ", mode=" + mode + ", launch=" + launch + ", monitor=" + monitor + ", launchNotConnect=" + launchNotConnect + ", debugCmd=" - + debugCmd + ", debugCmdArgs=" + debugCmdArgs + ", debugCmdEnvVars=" + List.of(debugCmdEnvVars) + + debugCmd + ", debugCmdArgs=" + debugCmdArgs // + + ", debugCmdEnvVars=" + (debugCmdEnvVars == null ? null : List.of(debugCmdEnvVars)) + ", monitorDebugAdapter=" + monitorDebugAdapter + ", server=" + server + ", port=" + port + ", dspParameters=" + dspParameters + "]"; } diff --git a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaCompletionProposalComputer.java b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaCompletionProposalComputer.java index 407a16b06..8fa5035e7 100644 --- a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaCompletionProposalComputer.java +++ b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaCompletionProposalComputer.java @@ -105,7 +105,7 @@ private ICompletionProposal[] asJavaProposals(CompletableFuture computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) { IContextInformation[] contextInformation = lsContentAssistProcessor.computeContextInformation(context.getViewer(), context.getInvocationOffset()); - return List.of(contextInformation); + return contextInformation == null ? List.of() : List.of(contextInformation); } @Override diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/DocumentContentSynchronizer.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/DocumentContentSynchronizer.java index bde10d855..79f826d01 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/DocumentContentSynchronizer.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/DocumentContentSynchronizer.java @@ -374,7 +374,7 @@ public void documentSaved(IFileBuffer buffer) { } - public CompletableFuture documentClosed() { + public CompletableFuture<@Nullable Void> documentClosed() { final var identifier = LSPEclipseUtils.toTextDocumentIdentifier(fileUri); WILL_SAVE_WAIT_UNTIL_TIMEOUT_MAP.remove(identifier.getUri()); // When LS is shut down all documents are being disconnected. No need to send diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageClientImpl.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageClientImpl.java index 1eb4b7b75..124fba801 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageClientImpl.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageClientImpl.java @@ -141,12 +141,12 @@ public IStatus run(IProgressMonitor monitor) { } @Override - public CompletableFuture registerCapability(RegistrationParams params) { + public CompletableFuture<@Nullable Void> registerCapability(RegistrationParams params) { return CompletableFuture.runAsync(() -> wrapper.registerCapability(params)); } @Override - public CompletableFuture unregisterCapability(UnregistrationParams params) { + public CompletableFuture<@Nullable Void> unregisterCapability(UnregistrationParams params) { return CompletableFuture.runAsync(() -> wrapper.unregisterCapability(params)); } @@ -182,12 +182,12 @@ private void updateCodeMinings() { } @Override - public CompletableFuture refreshCodeLenses() { + public CompletableFuture<@Nullable Void> refreshCodeLenses() { return CompletableFuture.runAsync(() -> UI.getDisplay().syncExec(this::updateCodeMinings)); } @Override - public CompletableFuture refreshInlayHints() { + public CompletableFuture<@Nullable Void> refreshInlayHints() { return CompletableFuture.runAsync(() -> UI.getDisplay().syncExec(this::updateCodeMinings)); } diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java index aa8835bc5..f8cca5cc8 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java @@ -159,7 +159,7 @@ public void dirtyStateChanged(IFileBuffer buffer, boolean isDirty) { protected @Nullable StreamConnectionProvider lspStreamProvider; private @Nullable Future launcherFuture; - private @Nullable CompletableFuture initializeFuture; + private @Nullable CompletableFuture<@Nullable Void> initializeFuture; private final AtomicReference<@Nullable IProgressMonitor> initializeFutureMonitorRef = new AtomicReference<>(); private final int initializeFutureNumberOfStages = 7; private @Nullable LanguageServer languageServer; @@ -389,7 +389,7 @@ private Job createInitializeLanguageServerJob() { protected IStatus run(IProgressMonitor monitor) { final var initializeFutureMonitor = SubMonitor.convert(monitor, initializeFutureNumberOfStages); initializeFutureMonitorRef.set(initializeFutureMonitor); - CompletableFuture currentInitializeFuture = initializeFuture; + CompletableFuture<@Nullable Void> currentInitializeFuture = initializeFuture; try { if (currentInitializeFuture != null) { currentInitializeFuture.join(); @@ -714,9 +714,9 @@ private boolean supportsWorkspaceFolderCapability() { * @param uri * @return null if not disconnection has happened, a future tracking the disconnection state otherwise */ - public @Nullable CompletableFuture disconnect(URI uri) { + public @Nullable CompletableFuture<@Nullable Void> disconnect(URI uri) { DocumentContentSynchronizer documentListener = this.connectedDocuments.remove(uri); - CompletableFuture documentClosedFuture = null; + CompletableFuture<@Nullable Void> documentClosedFuture = null; if (documentListener != null) { documentListener.getDocument().removePrenotifiedDocumentListener(documentListener); documentClosedFuture = documentListener.documentClosed(); @@ -778,7 +778,7 @@ protected LanguageServer getServer() { protected CompletableFuture getInitializedServer() { start(); - final CompletableFuture currentInitializeFuture = initializeFuture; + final CompletableFuture<@Nullable Void> currentInitializeFuture = initializeFuture; if (currentInitializeFuture != null && !currentInitializeFuture.isDone()) { return currentInitializeFuture.thenApply(r -> castNonNull(this.languageServer)); } diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServers.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServers.java index 800650e72..88d14dd37 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServers.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServers.java @@ -31,7 +31,6 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.Assert; -import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.text.IDocument; import org.eclipse.lsp4e.LanguageServersRegistry.LanguageServerDefinition; @@ -267,10 +266,9 @@ public IDocument getDocument() { CompletableFuture<@Nullable LanguageServerWrapper> connect(CompletableFuture<@Nullable LanguageServerWrapper> wrapperFuture) { return wrapperFuture.thenCompose(wrapper -> { if (wrapper != null) { - @NonNullByDefault({}) CompletableFuture serverFuture = wrapper.connectDocument(document); if (serverFuture != null) { - return serverFuture; + return (CompletableFuture<@Nullable LanguageServerWrapper>) serverFuture; } } return CompletableFuture.completedFuture(null); @@ -422,7 +420,7 @@ public static CompletableFuture> addAll(CompletableFuture> a * (not chained with other futures) so cancelling the futures in * this stream will send a cancellation event to the LSs.

*/ - private Stream> executeOnServers( + private <@Nullable T> Stream> executeOnServers( BiFunction> fn) { return getServers().stream().map(serverFuture -> { // wrap in AtomicReference to allow dereferencing in downstream future diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/codelens/LSPCodeMining.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/codelens/LSPCodeMining.java index bd2a0cb66..9fd2f5c71 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/codelens/LSPCodeMining.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/codelens/LSPCodeMining.java @@ -50,7 +50,7 @@ public LSPCodeMining(CodeLens codeLens, IDocument document, LanguageServerWrappe } @Override - protected CompletableFuture doResolve(ITextViewer viewer, IProgressMonitor monitor) { + protected CompletableFuture<@Nullable Void> doResolve(ITextViewer viewer, IProgressMonitor monitor) { final ServerCapabilities serverCapabilities = languageServerWrapper.getServerCapabilities(); if (serverCapabilities == null) { return CompletableFuture.completedFuture(null); diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/completion/LSContentAssistProcessor.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/completion/LSContentAssistProcessor.java index 1c3328422..3a56f45cc 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/completion/LSContentAssistProcessor.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/completion/LSContentAssistProcessor.java @@ -74,9 +74,9 @@ public class LSContentAssistProcessor implements IContentAssistProcessor { private @Nullable IDocument currentDocument; private @Nullable String errorMessage; private final boolean errorAsCompletionItem; - private @Nullable CompletableFuture> completionLanguageServersFuture; + private @Nullable CompletableFuture> completionLanguageServersFuture; private volatile char[] completionTriggerChars = NO_CHARS; - private @Nullable CompletableFuture> contextInformationLanguageServersFuture; + private @Nullable CompletableFuture> contextInformationLanguageServersFuture; private volatile char[] contextTriggerChars = NO_CHARS; private final boolean incompleteAsCompletionItem; @@ -327,7 +327,7 @@ private static IContextInformation toContextInformation(SignatureInformation inf return new ContextInformation(information.getLabel(), signature.toString()); } - private void getFuture(@Nullable CompletableFuture> future) { + private void getFuture(@Nullable CompletableFuture future) { if (future == null) { return; } diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/documentLink/LSPDocumentLinkPresentationReconcilingStrategy.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/documentLink/LSPDocumentLinkPresentationReconcilingStrategy.java index 2bc8359e3..46015f002 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/documentLink/LSPDocumentLinkPresentationReconcilingStrategy.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/documentLink/LSPDocumentLinkPresentationReconcilingStrategy.java @@ -46,7 +46,7 @@ public class LSPDocumentLinkPresentationReconcilingStrategy /** The target viewer. */ private @Nullable ITextViewer viewer; - private @Nullable CompletableFuture request; + private @Nullable CompletableFuture<@Nullable Void> request; private @Nullable IDocument document; diff --git a/target-platforms/target-platform-latest/target-platform-latest.target b/target-platforms/target-platform-latest/target-platform-latest.target index c906cc200..c548884ef 100644 --- a/target-platforms/target-platform-latest/target-platform-latest.target +++ b/target-platforms/target-platform-latest/target-platform-latest.target @@ -36,7 +36,7 @@ com.vegardit.no-npe no-npe-eea-all - 1.0.5 + 1.1.0 jar