From 6f4dd5a5f7d5aed6515b79b62bfc624a0abea806 Mon Sep 17 00:00:00 2001 From: Sebastian Thomschke Date: Thu, 15 Aug 2024 19:31:48 +0200 Subject: [PATCH] refact: enable NonNullByDefault for lsp4e.debug and lsp4e.jdt plugins --- .../.settings/org.eclipse.jdt.core.prefs | 29 +- org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF | 8 +- org.eclipse.lsp4e.debug/build.properties | 6 +- .../org/eclipse/lsp4e/debug/DSPImages.java | 3 +- .../org/eclipse/lsp4e/debug/DSPPlugin.java | 11 +- .../breakpoints/DSPBreakpointAdapter.java | 5 +- .../debug/breakpoints/DocumentUtils.java | 60 +-- .../breakpoints/TextSelectionToIVariable.java | 26 +- .../ToggleBreakpointsTargetFactory.java | 9 +- .../lsp4e/debug/breakpoints/package-info.java | 6 + .../lsp4e/debug/console/DSPProcess.java | 15 +- .../lsp4e/debug/console/DSPStreamMonitor.java | 5 +- .../lsp4e/debug/console/DSPStreamsProxy.java | 5 +- .../lsp4e/debug/console/package-info.java | 6 + .../debugmodel/DSPBreakpointManager.java | 9 +- .../debug/debugmodel/DSPDebugElement.java | 14 +- .../debug/debugmodel/DSPDebugTarget.java | 69 +-- .../lsp4e/debug/debugmodel/DSPStackFrame.java | 8 +- .../lsp4e/debug/debugmodel/DSPThread.java | 8 +- .../lsp4e/debug/debugmodel/DSPValue.java | 9 +- .../lsp4e/debug/debugmodel/DSPVariable.java | 3 +- .../JsonParserWithStringSubstitution.java | 23 +- .../debug/debugmodel/TransportStreams.java | 13 +- .../lsp4e/debug/debugmodel/package-info.java | 6 + .../debug/internal/NullSafetyHelper.java | 74 +++ .../lsp4e/debug/internal/package-info.java | 6 + .../debug/launcher/DSPLaunchDelegate.java | 156 ++++--- .../lsp4e/debug/launcher/DSPMainTab.java | 58 ++- .../lsp4e/debug/launcher/package-info.java | 6 + .../org/eclipse/lsp4e/debug/package-info.java | 6 + .../presentation/DAPWatchExpression.java | 11 +- .../DSPDebugModelPresentation.java | 33 +- .../debug/presentation/package-info.java | 6 + .../AbsolutePathSourceContainer.java | 3 +- .../DSPSourceLookupParticipant.java | 3 +- .../DSPSourcePathComputerDelegate.java | 5 +- .../debug/sourcelookup/package-info.java | 6 + .../.settings/org.eclipse.jdt.core.prefs | 437 ++++++++++++++++++ org.eclipse.lsp4e.jdt/META-INF/MANIFEST.MF | 4 +- org.eclipse.lsp4e.jdt/build.properties | 4 + .../jdt/LSJavaCompletionProposalComputer.java | 8 +- .../lsp4e/jdt/LSJavaHoverProvider.java | 23 +- .../org/eclipse/lsp4e/jdt/LSJavaProposal.java | 15 +- .../lsp4e/jdt/LSJavaProposalExtension.java | 19 +- .../lsp4e/jdt/LSJavaProposalExtension2.java | 21 +- .../jdt/LspJavaQuickAssistProcessor.java | 13 +- .../src/org/eclipse/lsp4e/jdt/Messages.java | 10 +- .../org/eclipse/lsp4e/jdt/package-info.java | 6 + .../.settings/org.eclipse.jdt.core.prefs | 2 +- org.eclipse.lsp4e/META-INF/MANIFEST.MF | 3 +- org.eclipse.lsp4e/build.properties | 3 +- org.eclipse.lsp4e/pom.xml | 2 +- .../LaunchConfigurationStreamProvider.java | 15 +- .../lsp4e/command/CommandExecutor.java | 9 +- .../lsp4e/internal/NullSafetyHelper.java | 32 +- .../org/eclipse/lsp4e/internal/StyleUtil.java | 3 +- .../eclipse/lsp4e/outline/CNFOutlinePage.java | 8 +- .../outline/LSSymbolsContentProvider.java | 30 +- .../lsp4e/outline/SymbolsLabelProvider.java | 9 +- .../eclipse/lsp4e/ui/LanguageServersView.java | 3 +- pom.xml | 10 - .../target-platform-latest.target | 19 +- 62 files changed, 1077 insertions(+), 360 deletions(-) create mode 100644 org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/package-info.java create mode 100644 org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/package-info.java create mode 100644 org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/package-info.java create mode 100644 org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/internal/NullSafetyHelper.java create mode 100644 org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/internal/package-info.java create mode 100644 org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/launcher/package-info.java create mode 100644 org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/package-info.java create mode 100644 org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/presentation/package-info.java create mode 100644 org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/package-info.java create mode 100644 org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/package-info.java diff --git a/org.eclipse.lsp4e.debug/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.lsp4e.debug/.settings/org.eclipse.jdt.core.prefs index f69c65979..201bd4daa 100644 --- a/org.eclipse.lsp4e.debug/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.lsp4e.debug/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,5 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.annotationPath.allLocations=enabled org.eclipse.jdt.core.builder.cleanOutputFolder=clean org.eclipse.jdt.core.builder.duplicateResourceTask=warning org.eclipse.jdt.core.builder.invalidClasspath=abort @@ -9,21 +10,30 @@ org.eclipse.jdt.core.classpath.exclusionPatterns=enabled org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=warning org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.notowning=org.eclipse.jdt.annotation.NotOwning org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullable.secondary= -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled +org.eclipse.jdt.core.compiler.annotation.owning=org.eclipse.jdt.annotation.Owning +org.eclipse.jdt.core.compiler.annotation.resourceanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore @@ -44,10 +54,12 @@ org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompatibleOwningContract=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.insufficientResourceAnalysis=warning org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=disabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled @@ -77,14 +89,14 @@ org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullReference=error org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=info org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=error org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning @@ -98,7 +110,8 @@ org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning diff --git a/org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF b/org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF index 0d19c5bac..6ee03a33e 100644 --- a/org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF +++ b/org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF @@ -2,16 +2,16 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Debug Adapter client for Eclipse IDE (Incubation) Bundle-SymbolicName: org.eclipse.lsp4e.debug;singleton:=true -Bundle-Version: 0.15.10.qualifier +Bundle-Version: 0.15.11.qualifier Bundle-Activator: org.eclipse.lsp4e.debug.DSPPlugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.debug.core, org.eclipse.debug.ui, org.eclipse.jface, - org.eclipse.lsp4j.jsonrpc;bundle-version="[0.23.0,0.24.0)", - org.eclipse.lsp4j.jsonrpc.debug;bundle-version="[0.23.0,0.24.0)", - org.eclipse.lsp4j.debug;bundle-version="[0.23.0,0.24.0)", + org.eclipse.lsp4j.jsonrpc;bundle-version="[0.23.1,0.24.0)", + org.eclipse.lsp4j.jsonrpc.debug;bundle-version="[0.23.1,0.24.0)", + org.eclipse.lsp4j.debug;bundle-version="[0.23.1,0.24.0)", org.eclipse.ui.editors, org.eclipse.core.filesystem, org.eclipse.ui.ide;bundle-version="[3.16.0,4.0.0)", diff --git a/org.eclipse.lsp4e.debug/build.properties b/org.eclipse.lsp4e.debug/build.properties index f2f59c946..de7cc0438 100644 --- a/org.eclipse.lsp4e.debug/build.properties +++ b/org.eclipse.lsp4e.debug/build.properties @@ -4,5 +4,9 @@ bin.includes = META-INF/,\ .,\ plugin.xml,\ EPL-2.0.html,\ - .options,\ + .options,\ icons/ + +# JDT Null Analysis for Eclipse +additional.bundles = org.eclipse.jdt.annotation,\ + com.vegardit.no-npe.eea-all diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/DSPImages.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/DSPImages.java index 63a28aa01..8c39112c3 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/DSPImages.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/DSPImages.java @@ -17,6 +17,7 @@ import java.net.URL; import org.eclipse.core.runtime.Platform; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageRegistry; import org.eclipse.swt.graphics.Image; @@ -65,7 +66,7 @@ public static Image get(String key) { return imageRegistry.get(key); } - private static URL makeIconFileURL(String prefix, String name) { + private static @Nullable URL makeIconFileURL(String prefix, String name) { final var buffer = new StringBuilder(prefix); buffer.append(name); try { diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/DSPPlugin.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/DSPPlugin.java index e158ce2e7..634df893b 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/DSPPlugin.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/DSPPlugin.java @@ -8,9 +8,11 @@ *******************************************************************************/ package org.eclipse.lsp4e.debug; +import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.lsp4j.jsonrpc.ResponseErrorException; import org.eclipse.lsp4j.jsonrpc.messages.ResponseError; import org.eclipse.ui.plugin.AbstractUIPlugin; @@ -51,7 +53,7 @@ public class DSPPlugin extends AbstractUIPlugin { public static final String ATTR_CUSTOM_LAUNCH_PARAMS = ID_DSP_DEBUG_MODEL + ".ATTR_CUSTOM_LAUNCH_PARAMS"; // The shared instance - private static DSPPlugin plugin; + private static volatile @Nullable DSPPlugin plugin; public DSPPlugin() { } @@ -74,6 +76,7 @@ public void stop(BundleContext context) throws Exception { * @return the shared instance */ public static DSPPlugin getDefault() { + Assert.isNotNull(plugin); return plugin; } @@ -92,7 +95,7 @@ public static void logError(final Throwable thr) { * @param message User comprehensible message * @param thr The exception through which we noticed the error */ - public static void logError(final String message, final Throwable thr) { + public static void logError(final @Nullable String message, final @Nullable Throwable thr) { log(IStatus.ERROR, message, thr); } @@ -111,11 +114,11 @@ public static void logInfo(final String message) { * @param message User comprehensible message * @param thr The exception through which we noticed the warning */ - public static void logWarning(final String message, final Throwable thr) { + public static void logWarning(final String message, final @Nullable Throwable thr) { log(IStatus.WARNING, message, thr); } - private static void log(int severity, String message, final Throwable thr) { + private static void log(final int severity, @Nullable String message, final @Nullable Throwable thr) { ResponseError error = null; if (thr instanceof ResponseErrorException responseErrorException) { error = responseErrorException.getResponseError(); diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/DSPBreakpointAdapter.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/DSPBreakpointAdapter.java index 58cf73c21..efcd04e72 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/DSPBreakpointAdapter.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/DSPBreakpointAdapter.java @@ -14,6 +14,7 @@ import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.ILineBreakpoint; import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.viewers.ISelection; import org.eclipse.lsp4e.debug.DSPPlugin; @@ -55,12 +56,12 @@ public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selectio return true; } - private ITextEditor getEditor(IWorkbenchPart part) { + private @Nullable ITextEditor getEditor(IWorkbenchPart part) { if (part instanceof ITextEditor textEditor) { return textEditor; } if (part instanceof MultiPageEditorPart multiPageEditorPart - && ((MultiPageEditorPart) part).getSelectedPage() instanceof ITextEditor textEditor) { + && multiPageEditorPart.getSelectedPage() instanceof ITextEditor textEditor) { return textEditor; } return null; diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/DocumentUtils.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/DocumentUtils.java index 6f6029589..a767085e2 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/DocumentUtils.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/DocumentUtils.java @@ -13,6 +13,7 @@ import java.net.URISyntaxException; import org.eclipse.core.filebuffers.FileBuffers; +import org.eclipse.core.filebuffers.IFileBuffer; import org.eclipse.core.filebuffers.ITextFileBuffer; import org.eclipse.core.filebuffers.ITextFileBufferManager; import org.eclipse.core.resources.IFile; @@ -20,54 +21,51 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Adapters; import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.text.IDocument; +import org.eclipse.lsp4e.debug.DSPPlugin; -/* - * All this is mostly copied from LSPEclipseUtils. +/** + * The code is copied from LSPEclipseUtils. */ final class DocumentUtils { - private static ITextFileBuffer toBuffer(IDocument document) { + private static @Nullable ITextFileBuffer toBuffer(@Nullable IDocument document) { + if (document == null) { + return null; + } ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager(); if (bufferManager == null) return null; return bufferManager.getTextFileBuffer(document); } - public static URI toUri(IDocument document) { - IFile file = getFile(document); + public static @Nullable URI toUri(IDocument document) { + ITextFileBuffer buffer = toBuffer(document); + IPath path = toPath(buffer); + IFile file = getFile(path); if (file != null) { return toUri(file); - } else { - ITextFileBuffer buffer = toBuffer(document); - if (buffer != null) { - IPath path = toPath(buffer); - if (path != null) { - return toUri(path.toFile()); - } else { - return buffer.getFileStore().toURI(); - } - } + } else if (path != null) { + return toUri(path.toFile()); + } else if (buffer != null && buffer.getFileStore() != null) { + return buffer.getFileStore().toURI(); } return null; } - private static IPath toPath(ITextFileBuffer buffer) { + private static @Nullable IPath toPath(@Nullable IFileBuffer buffer) { if (buffer != null) { return buffer.getLocation(); } return null; } - private static IPath toPath(IDocument document) { - return toPath(toBuffer(document)); - } - private static URI toUri(IPath absolutePath) { return toUri(absolutePath.toFile()); } - private static URI toUri(IResource resource) { + private static @Nullable URI toUri(IResource resource) { URI adaptedURI = Adapters.adapt(resource, URI.class, true); if (adaptedURI != null) { return adaptedURI; @@ -84,25 +82,27 @@ private static URI toUri(File file) { try { return new URI("file", "", file.getAbsoluteFile().toURI().getPath(), null); //$NON-NLS-1$ //$NON-NLS-2$ } catch (URISyntaxException e) { + DSPPlugin.logError(e); return file.getAbsoluteFile().toURI(); } } - private static IFile getFile(IDocument document) { - IPath path = toPath(document); - return getFile(path); - } - - private static IFile getFile(IPath path) { + /** + * @return null if no file exists at the given path or the given path points to + * a file outside the workspace + */ + private static @Nullable IFile getFile(@Nullable IPath path) { if (path == null) { return null; } - IFile res = ResourcesPlugin.getWorkspace().getRoot().getFile(path); + + final IFile res = path.segmentCount() == 1 // + ? ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path) + : ResourcesPlugin.getWorkspace().getRoot().getFile(path); if (res != null && res.exists()) { return res; - } else { - return null; } + return null; } private DocumentUtils() { diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/TextSelectionToIVariable.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/TextSelectionToIVariable.java index 0aeb16d1e..6adfa208d 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/TextSelectionToIVariable.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/TextSelectionToIVariable.java @@ -25,6 +25,7 @@ import org.eclipse.debug.core.model.IValue; import org.eclipse.debug.core.model.IVariable; import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.TextSelection; @@ -35,7 +36,7 @@ public class TextSelectionToIVariable implements IAdapterFactory { @Override - public T getAdapter(Object adaptableObject, Class adapterType) { + public @Nullable T getAdapter(@Nullable Object adaptableObject, Class adapterType) { if (adaptableObject instanceof TextSelection textSelection && IVariable.class.isAssignableFrom(adapterType)) { return adapterType.cast(getVariableFor(textSelection)); } @@ -47,7 +48,7 @@ public Class[] getAdapterList() { return new Class[] { IVariable.class }; } - private IVariable getVariableFor(TextSelection selection) { + private @Nullable IVariable getVariableFor(TextSelection selection) { if (!hasDAPTarget()) { return null; } @@ -89,7 +90,8 @@ private IVariable getVariableFor(TextSelection selection) { DSPPlugin.logError(de); } - if (Boolean.TRUE.equals(frame.getDebugTarget().getCapabilities().getSupportsEvaluateForHovers())) { + final var capabilities = frame.getDebugTarget().getCapabilities(); + if (capabilities != null && Boolean.TRUE.equals(capabilities.getSupportsEvaluateForHovers())) { try { // ok to call get as it should be a different thread. return frame.evaluate(variableName).get(); @@ -114,14 +116,20 @@ private boolean hasDAPTarget() { } private boolean match(IDocument document, DSPStackFrame frame) { - Object sourceElement = frame.getLaunch().getSourceLocator().getSourceElement(frame); - if (sourceElement instanceof String) { - return Objects.equals(DocumentUtils.toUri(document).getPath(), sourceElement); + final var sourceLocator = frame.getLaunch().getSourceLocator(); + if (sourceLocator == null) + return false; + + if (sourceLocator.getSourceElement(frame) instanceof String sourceElement) { + final var uri = DocumentUtils.toUri(document); + if (uri == null) + return false; + return Objects.equals(uri.getPath(), sourceElement); } return false; } - private String findVariableName(IDocument document, int offset) { + private @Nullable String findVariableName(IDocument document, int offset) { try { if (!Character.isJavaIdentifierPart(document.getChar(offset))) { return null; @@ -140,7 +148,7 @@ private String findVariableName(IDocument document, int offset) { } } - protected DSPStackFrame getFrame() { + protected @Nullable DSPStackFrame getFrame() { IAdaptable adaptable = DebugUITools.getDebugContext(); if (adaptable != null) { return Adapters.adapt(adaptable, DSPStackFrame.class); @@ -148,7 +156,7 @@ protected DSPStackFrame getFrame() { return null; } - private IDocument getDocument(TextSelection sel) { + private @Nullable IDocument getDocument(TextSelection sel) { try { Method documentMethod = TextSelection.class.getDeclaredMethod("getDocument"); //$NON-NLS-1$ documentMethod.setAccessible(true); diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/ToggleBreakpointsTargetFactory.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/ToggleBreakpointsTargetFactory.java index ccfdc23f5..1dd872fd8 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/ToggleBreakpointsTargetFactory.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/ToggleBreakpointsTargetFactory.java @@ -13,6 +13,7 @@ import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget; import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetFactory; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.viewers.ISelection; import org.eclipse.lsp4e.debug.DSPPlugin; import org.eclipse.ui.IWorkbenchPart; @@ -31,12 +32,12 @@ public Set getToggleTargets(IWorkbenchPart part, ISelection selection) { } @Override - public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) { + public @Nullable String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) { return null; } @Override - public IToggleBreakpointsTarget createToggleTarget(String targetID) { + public @Nullable IToggleBreakpointsTarget createToggleTarget(String targetID) { if (TOGGLE_BREAKPOINT_TARGET_ID.equals(targetID)) { return DSP_BREAKPOINT_ADAPTER; } @@ -44,7 +45,7 @@ public IToggleBreakpointsTarget createToggleTarget(String targetID) { } @Override - public String getToggleTargetName(String targetID) { + public @Nullable String getToggleTargetName(String targetID) { if (TOGGLE_BREAKPOINT_TARGET_ID.equals(targetID)) { return "LSP4E Breakpoint"; } @@ -52,7 +53,7 @@ public String getToggleTargetName(String targetID) { } @Override - public String getToggleTargetDescription(String targetID) { + public @Nullable String getToggleTargetDescription(String targetID) { if (TOGGLE_BREAKPOINT_TARGET_ID.equals(targetID)) { return "LSP4E Breakpoint for Debug Adapter"; } diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/package-info.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/package-info.java new file mode 100644 index 000000000..98ec88dc8 --- /dev/null +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/breakpoints/package-info.java @@ -0,0 +1,6 @@ +@NonNullByDefault({ ARRAY_CONTENTS, PARAMETER, RETURN_TYPE, FIELD, TYPE_BOUND, TYPE_ARGUMENT }) +package org.eclipse.lsp4e.debug.breakpoints; + +import static org.eclipse.jdt.annotation.DefaultLocation.*; + +import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/DSPProcess.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/DSPProcess.java index a1b851f35..8ee4474aa 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/DSPProcess.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/DSPProcess.java @@ -18,6 +18,8 @@ import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.model.IProcess; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.lsp4e.debug.debugmodel.DSPDebugTarget; import org.eclipse.lsp4j.debug.ProcessEventArguments; @@ -29,7 +31,7 @@ public class DSPProcess implements IProcess { private final DSPDebugTarget target; private final DSPStreamsProxy proxy; - private final ProcessEventArguments processArgs; + private final @Nullable ProcessEventArguments processArgs; private final Optional handle; private boolean terminated; @@ -37,7 +39,7 @@ public DSPProcess(DSPDebugTarget target) { this(target, null); } - public DSPProcess(DSPDebugTarget dspDebugTarget, ProcessEventArguments args) { + public DSPProcess(DSPDebugTarget dspDebugTarget, @Nullable ProcessEventArguments args) { this.target = dspDebugTarget; this.proxy = new DSPStreamsProxy(target.getDebugProtocolServer()); this.processArgs = args; @@ -68,7 +70,7 @@ public void terminate() throws DebugException { terminated = true; handle.ifPresent(h -> { h.destroy(); // normal termination - CompletableFuture.runAsync(() -> h.destroyForcibly(), CompletableFuture.delayedExecutor(5, TimeUnit.SECONDS)); // forced termination if normal is not sufficient + CompletableFuture.runAsync(h::destroyForcibly, CompletableFuture.delayedExecutor(5, TimeUnit.SECONDS)); // forced termination if normal is not sufficient }); DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { new DebugEvent(this, DebugEvent.TERMINATE) }); target.terminate(); @@ -76,6 +78,7 @@ public void terminate() throws DebugException { @Override public String getLabel() { + final var processArgs = this.processArgs; if (processArgs != null && processArgs.getName() != null) { return processArgs.getName(); } @@ -88,17 +91,17 @@ public ILaunch getLaunch() { } @Override - public DSPStreamsProxy getStreamsProxy() { + public @NonNull DSPStreamsProxy getStreamsProxy() { return proxy; } @Override - public void setAttribute(String key, String value) { + public void setAttribute(String key, @Nullable String value) { // TODO } @Override - public String getAttribute(String key) { + public @Nullable String getAttribute(String key) { if (ATTR_PROCESS_ID.equals(key)) { return handle.map(ProcessHandle::pid).map(Object::toString).orElse(null); } diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/DSPStreamMonitor.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/DSPStreamMonitor.java index 288e9c95f..1a6b3d89f 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/DSPStreamMonitor.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/DSPStreamMonitor.java @@ -12,6 +12,7 @@ import org.eclipse.core.runtime.SafeRunner; import org.eclipse.debug.core.IStreamListener; import org.eclipse.debug.core.model.IFlushableStreamMonitor; +import org.eclipse.jdt.annotation.Nullable; public class DSPStreamMonitor implements IFlushableStreamMonitor { @@ -34,14 +35,14 @@ public void removeListener(IStreamListener listener) { listeners.remove(listener); } - public void append(String text) { + public void append(@Nullable String text) { if (buffer && text != null) { stream.append(text); } notifyAppend(text); } - public void notifyAppend(String text) { + public void notifyAppend(@Nullable String text) { if (text == null) { return; } diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/DSPStreamsProxy.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/DSPStreamsProxy.java index acd6fdb47..5528e3ee6 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/DSPStreamsProxy.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/DSPStreamsProxy.java @@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.debug.core.model.IStreamsProxy2; import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.jdt.annotation.NonNull; import org.eclipse.lsp4e.debug.debugmodel.DSPStackFrame; import org.eclipse.lsp4j.debug.EvaluateArguments; import org.eclipse.lsp4j.debug.EvaluateArgumentsContext; @@ -38,12 +39,12 @@ public DSPStreamsProxy(IDebugProtocolServer debugProtocolServer) { } @Override - public DSPStreamMonitor getErrorStreamMonitor() { + public @NonNull DSPStreamMonitor getErrorStreamMonitor() { return errorStream; } @Override - public DSPStreamMonitor getOutputStreamMonitor() { + public @NonNull DSPStreamMonitor getOutputStreamMonitor() { return outputStream; } diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/package-info.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/package-info.java new file mode 100644 index 000000000..1f912563b --- /dev/null +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/console/package-info.java @@ -0,0 +1,6 @@ +@NonNullByDefault({ ARRAY_CONTENTS, PARAMETER, RETURN_TYPE, FIELD, TYPE_BOUND, TYPE_ARGUMENT }) +package org.eclipse.lsp4e.debug.console; + +import static org.eclipse.jdt.annotation.DefaultLocation.*; + +import org.eclipse.jdt.annotation.NonNullByDefault; 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 503fb0957..214f6bb15 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 @@ -28,6 +28,7 @@ import org.eclipse.debug.core.IBreakpointManagerListener; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.ILineBreakpoint; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.lsp4e.debug.DSPPlugin; import org.eclipse.lsp4j.debug.BreakpointEventArguments; import org.eclipse.lsp4j.debug.Capabilities; @@ -52,10 +53,10 @@ public class DSPBreakpointManager implements IBreakpointManagerListener, IBreakp private final Map> targetBreakpoints = new HashMap<>(); private final IDebugProtocolServer debugProtocolServer; private final IBreakpointManager platformBreakpointManager; - private final Capabilities capabilities; + private final @Nullable Capabilities capabilities; public DSPBreakpointManager(IBreakpointManager platformBreakpointManager, IDebugProtocolServer debugProtocolServer, - Capabilities capabilities) { + @Nullable Capabilities capabilities) { this.debugProtocolServer = debugProtocolServer; this.platformBreakpointManager = platformBreakpointManager; this.capabilities = capabilities; @@ -134,7 +135,7 @@ public void breakpointAdded(IBreakpoint breakpoint) { } @Override - public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { + public void breakpointRemoved(IBreakpoint breakpoint, @Nullable IMarkerDelta delta) { if (supportsBreakpoint(breakpoint)) { deleteBreakpointFromMap(breakpoint); sendBreakpoints(); @@ -142,7 +143,7 @@ public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { } @Override - public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) { + public void breakpointChanged(IBreakpoint breakpoint, @Nullable IMarkerDelta delta) { if (supportsBreakpoint(breakpoint)) { try { if (breakpoint.isEnabled() && platformBreakpointManager.isEnabled()) { diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPDebugElement.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPDebugElement.java index 0b10924dc..1604bbf2f 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPDebugElement.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPDebugElement.java @@ -21,14 +21,15 @@ import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.IBreakpointManager; import org.eclipse.debug.core.model.DebugElement; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.lsp4e.debug.DSPPlugin; import org.eclipse.lsp4j.debug.services.IDebugProtocolServer; public abstract class DSPDebugElement extends DebugElement { - private String errorMessage; + private @Nullable String errorMessage; - public DSPDebugElement(DSPDebugTarget target) { + protected DSPDebugElement(@Nullable DSPDebugTarget target) { super(target); } @@ -75,7 +76,8 @@ protected static T complete(CompletableFuture future) throws DebugExcepti } } - protected static T monitorGet(CompletableFuture future, IProgressMonitor monitor) throws DebugException { + protected static @Nullable T monitorGet(CompletableFuture future, IProgressMonitor monitor) + throws DebugException { try { while (true) { if (monitor.isCanceled()) { @@ -108,12 +110,12 @@ protected static T monitorGet(CompletableFuture future, IProgressMonitor } - protected static DebugException newTargetRequestFailedException(String message, Throwable e) { + protected static DebugException newTargetRequestFailedException(@Nullable String message, @Nullable Throwable e) { return new DebugException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.TARGET_REQUEST_FAILED, message, e)); } - protected void setErrorMessage(String message) { + protected void setErrorMessage(@Nullable String message) { errorMessage = message; } @@ -123,7 +125,7 @@ protected void setErrorMessage(String message) { * * @return error message to display to the user */ - public String getErrorMessage() { + public @Nullable String getErrorMessage() { // TODO Once set, we never clear an error on an element return errorMessage; } 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 4aaf2d77d..44ce7b969 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 @@ -15,6 +15,8 @@ *******************************************************************************/ package org.eclipse.lsp4e.debug.debugmodel; +import static org.eclipse.lsp4e.debug.internal.NullSafetyHelper.*; + import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -41,8 +43,10 @@ import org.eclipse.core.resources.IMarkerDelta; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.SubMonitor; import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugException; @@ -53,6 +57,7 @@ import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IMemoryBlock; import org.eclipse.debug.core.model.IProcess; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.lsp4e.debug.DSPPlugin; import org.eclipse.lsp4e.debug.console.DSPProcess; import org.eclipse.lsp4e.debug.console.DSPStreamsProxy; @@ -100,8 +105,8 @@ public class DSPDebugTarget extends DSPDebugElement implements IDebugTarget, IDe private final ExecutorService threadPool = Executors.newCachedThreadPool(); private final ILaunch launch; - private Future debugProtocolFuture; - private IDebugProtocolServer debugProtocolServer; + private Future debugProtocolFuture = lateNonNull(); + private IDebugProtocolServer debugProtocolServer = lateNonNull(); /** * Debug adapters are not supposed to send initialized event until after * replying to initializeRequest with Capabilities. However some debug adapters @@ -110,11 +115,11 @@ public class DSPDebugTarget extends DSPDebugElement implements IDebugTarget, IDe * arrives before the capabilities are stored. Therefore use a future to guard * reading the capabilities before they are ready. */ - private final CompletableFuture capabilitiesFuture = new CompletableFuture<>(); + private final CompletableFuture<@Nullable Capabilities> capabilitiesFuture = new CompletableFuture<>(); /** * Once we have received initialized event, this member will be "done" as a flag */ - private final CompletableFuture initialized = new CompletableFuture<>(); + private final CompletableFuture<@Nullable Void> initialized = new CompletableFuture<>(); /** * The debuggees that this target has spawned, for example when handling the @@ -131,17 +136,17 @@ public class DSPDebugTarget extends DSPDebugElement implements IDebugTarget, IDe private boolean fTerminated = false; private boolean fSentTerminateRequest = false; - private String targetName = null; + private String targetName = lateNonNull(); - private DSPBreakpointManager breakpointManager; - private DSPProcess process; + private @Nullable DSPBreakpointManager breakpointManager; + private @Nullable DSPProcess process; private TransportStreams transportStreams; // the suppliers can be used to reconnect to running adapter, or for // startDebuggin private final Supplier streamsSupplier; /** - * User supplied debug paramters for {@link IDebugProtocolServer#launch(Map)} + * User supplied debug parameters for {@link IDebugProtocolServer#launch(Map)} * and {@link IDebugProtocolServer#attach(Map)} */ private final Map dspParameters; @@ -298,7 +303,7 @@ private CompletableFuture initialize(Map dspParameters, IProg configurationDoneFuture = configurationDoneFuture.thenCompose(v -> { monitor.worked(30); monitor.subTask("Sending configuration done"); - if (Boolean.TRUE.equals(getCapabilities().getSupportsConfigurationDoneRequest())) { + if (Boolean.TRUE.equals(castNonNull(getCapabilities()).getSupportsConfigurationDoneRequest())) { return getDebugProtocolServer().configurationDone(new ConfigurationDoneArguments()); } return CompletableFuture.completedFuture(null); @@ -315,6 +320,7 @@ private void terminated() { DSPPlugin.logError(e); } }); + final var process = this.process; if (process != null && process.canTerminate()) { try { process.terminate(); @@ -370,7 +376,7 @@ public CompletableFuture startDebugging(StartDebuggingRequestArguments arg * @throws DebugException if a problem is encountered */ @Override - protected void requestFailed(String message, Throwable e) throws DebugException { + protected void requestFailed(String message, @Nullable Throwable e) throws DebugException { throw newTargetRequestFailedException(message, e); } @@ -385,7 +391,7 @@ public ILaunch getLaunch() { } @Override - public T getAdapter(Class adapter) { + public @Nullable T getAdapter(Class adapter) { return null; } @@ -428,7 +434,7 @@ public void terminated(TerminatedEventArguments body) { @Override public void terminate() throws DebugException { boolean shouldSendTerminateRequest = !fSentTerminateRequest - && Boolean.TRUE.equals(getCapabilities().getSupportsTerminateRequest()) + && Boolean.TRUE.equals(castNonNull(getCapabilities()).getSupportsTerminateRequest()) && "launch".equals(dspParameters.getOrDefault("request", "launch")); if (shouldSendTerminateRequest) { fSentTerminateRequest = true; @@ -544,11 +550,12 @@ public boolean supportsStorageRetrieval() { @Override public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException { - return null; + throw new DebugException(new Status(IStatus.OK, DSPPlugin.PLUGIN_ID, DebugException.TARGET_REQUEST_FAILED, + "not implemented", null)); } @Override - public IProcess getProcess() { + public @Nullable IProcess getProcess() { return process; } @@ -581,7 +588,7 @@ public String getName() { @Override public boolean supportsBreakpoint(IBreakpoint breakpoint) { - return !isTerminated() && breakpointManager.supportsBreakpoint(breakpoint); + return !isTerminated() && breakpointManager != null && breakpointManager.supportsBreakpoint(breakpoint); } @Override @@ -632,9 +639,11 @@ public void output(OutputEventArguments args) { } private DSPStreamsProxy getOrCreateStreamsProxy() { + var process = this.process; if (process == null) { // create dummy process to have a console process(null); + process = castNonNull(this.process); } return process.getStreamsProxy(); } @@ -642,17 +651,15 @@ private DSPStreamsProxy getOrCreateStreamsProxy() { @Override public void module(ModuleEventArguments args) { // TODO - } @Override public void loadedSource(LoadedSourceEventArguments args) { // TODO - } @Override - public void process(ProcessEventArguments args) { + public void process(@Nullable ProcessEventArguments args) { process = new DSPProcess(this, args); launch.addProcess(process); } @@ -689,8 +696,8 @@ public CompletableFuture runInTerminal(RunInTerminalReque processBuilder.directory(new File(args.getCwd())); } if (args.getEnv() != null) { - Set> entrySet = args.getEnv().entrySet(); - for (Entry entry : entrySet) { + Set> entrySet = args.getEnv().entrySet(); + for (Entry entry : entrySet) { String name = entry.getKey(); String value = entry.getValue(); if (value == null) { @@ -728,22 +735,29 @@ public CompletableFuture runInTerminal(RunInTerminalReque @Override public void breakpoint(BreakpointEventArguments args) { - breakpointManager.breakpointEvent(args); + if (breakpointManager != null) + breakpointManager.breakpointEvent(args); } @Override public void breakpointAdded(IBreakpoint breakpoint) { - breakpointManager.breakpointAdded(breakpoint); + if (breakpointManager != null) { + breakpointManager.breakpointAdded(breakpoint); + } } @Override - public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { - breakpointManager.breakpointRemoved(breakpoint, delta); + public void breakpointRemoved(IBreakpoint breakpoint, @Nullable IMarkerDelta delta) { + if (breakpointManager != null) { + breakpointManager.breakpointRemoved(breakpoint, delta); + } } @Override - public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) { - breakpointManager.breakpointChanged(breakpoint, delta); + public void breakpointChanged(IBreakpoint breakpoint, @Nullable IMarkerDelta delta) { + if (breakpointManager != null) { + breakpointManager.breakpointChanged(breakpoint, delta); + } } @Override @@ -760,8 +774,7 @@ public IDebugProtocolServer getDebugProtocolServer() { * @return the current capabilities if they have been retrieved, or else * return @{code null} */ - public Capabilities getCapabilities() { + public @Nullable Capabilities getCapabilities() { return capabilitiesFuture.getNow(null); } - } diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPStackFrame.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPStackFrame.java index 8528aa6d9..080fca9b0 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPStackFrame.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPStackFrame.java @@ -17,6 +17,7 @@ import org.eclipse.debug.core.model.IRegisterGroup; import org.eclipse.debug.core.model.IStackFrame; import org.eclipse.debug.core.model.IVariable; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.lsp4j.debug.EvaluateArguments; import org.eclipse.lsp4j.debug.EvaluateArgumentsContext; import org.eclipse.lsp4j.debug.EvaluateResponse; @@ -28,7 +29,7 @@ public class DSPStackFrame extends DSPDebugElement implements IStackFrame { private final DSPThread thread; private StackFrame stackFrame; private final int depth; - private IVariable[] cachedVariables; + private IVariable @Nullable [] cachedVariables; public DSPStackFrame(DSPThread thread, StackFrame stackFrame, int depth) { super(thread.getDebugTarget()); @@ -133,6 +134,7 @@ public boolean hasRegisterGroups() throws DebugException { @Override public IVariable[] getVariables() throws DebugException { + var cachedVariables = this.cachedVariables; if (cachedVariables == null) { final var arguments = new ScopesArguments(); arguments.setFrameId(stackFrame.getId()); @@ -143,7 +145,7 @@ public IVariable[] getVariables() throws DebugException { scope.getVariablesReference()); vars.add(variable); } - cachedVariables = vars.toArray(IVariable[]::new); + cachedVariables = this.cachedVariables = vars.toArray(IVariable[]::new); } return cachedVariables; } @@ -155,7 +157,7 @@ public DSPThread getThread() { @Override public IRegisterGroup[] getRegisterGroups() throws DebugException { - return null; + return new IRegisterGroup[0]; } @Override diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPThread.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPThread.java index e0d226030..080b5bffd 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPThread.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPThread.java @@ -23,6 +23,7 @@ import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IStackFrame; import org.eclipse.debug.core.model.IThread; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.lsp4e.debug.DSPPlugin; import org.eclipse.lsp4j.debug.ContinueArguments; import org.eclipse.lsp4j.debug.NextArguments; @@ -39,7 +40,7 @@ public class DSPThread extends DSPDebugElement implements IThread { * The name may not be known, if it is requested we will ask for it from the * target. */ - private String name; + private @Nullable String name; private final List frames = Collections.synchronizedList(new ArrayList<>()); private final AtomicBoolean refreshFrames = new AtomicBoolean(true); private boolean stepping; @@ -87,7 +88,7 @@ public boolean canTerminate() { return getDebugTarget().canTerminate(); } - private T handleExceptionalResume(Throwable t) { + private @Nullable T handleExceptionalResume(Throwable t) { DSPPlugin.logError("Failed to resume debug adapter", t); setErrorMessage(t.getMessage()); stopped(); @@ -219,7 +220,7 @@ public boolean hasStackFrames() throws DebugException { } @Override - public IStackFrame getTopStackFrame() throws DebugException { + public @Nullable IStackFrame getTopStackFrame() throws DebugException { IStackFrame[] stackFrames = getStackFrames(); if (stackFrames.length > 0) { return stackFrames[0]; @@ -278,6 +279,7 @@ public int getPriority() throws DebugException { @Override public String getName() { + final var name = this.name; if (name == null) { // Queue up a refresh of the threads to get our name getDebugTarget().getThreads(); diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPValue.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPValue.java index 4ab9a7bef..8ff0d70d3 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPValue.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPValue.java @@ -13,15 +13,16 @@ import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IValue; import org.eclipse.debug.core.model.IVariable; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.lsp4j.debug.Variable; import org.eclipse.lsp4j.debug.VariablesArguments; public final class DSPValue extends DSPDebugElement implements IValue { - private final DSPVariable modelVariable; + private final @Nullable DSPVariable modelVariable; private final Integer variablesReference; private final String value; - private IVariable[] cachedVariables; + private IVariable @Nullable [] cachedVariables; public DSPValue(DSPVariable variable, Integer variablesReference, String value) { super(variable.getDebugTarget()); @@ -38,7 +39,7 @@ public DSPValue(DSPDebugTarget debugger, Integer variablesReference, String valu } @Override - public IVariable[] getVariables() throws DebugException { + public IVariable @Nullable [] getVariables() throws DebugException { if (!hasVariables()) { return new IVariable[0]; } @@ -60,7 +61,7 @@ public IVariable[] getVariables() throws DebugException { } @Override - public String getReferenceTypeName() throws DebugException { + public @Nullable String getReferenceTypeName() throws DebugException { if (modelVariable != null) { return modelVariable.getName(); } diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPVariable.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPVariable.java index b0d54bf69..db082ec51 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPVariable.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/DSPVariable.java @@ -58,7 +58,8 @@ public void setValue(IValue value) throws DebugException { @Override public boolean supportsValueModification() { - return Boolean.TRUE.equals(getDebugTarget().getCapabilities().getSupportsSetVariable()); + final var capabilities = getDebugTarget().getCapabilities(); + return capabilities != null && Boolean.TRUE.equals(capabilities.getSupportsSetVariable()); } @Override diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/JsonParserWithStringSubstitution.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/JsonParserWithStringSubstitution.java index ff4f94d96..9e876a9e5 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/JsonParserWithStringSubstitution.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/JsonParserWithStringSubstitution.java @@ -11,9 +11,11 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Objects; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.variables.IStringVariableManager; +import org.eclipse.jdt.annotation.Nullable; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -23,7 +25,7 @@ public class JsonParserWithStringSubstitution { - IStringVariableManager stringVariableManager; + private final IStringVariableManager stringVariableManager; /** * @param stringVariableManager that should be used to substitute variables in @@ -44,14 +46,23 @@ public JsonParserWithStringSubstitution(IStringVariableManager stringVariableMan * @throws CoreException is thrown if undefined variable was referenced * in json. */ - public Map parseJsonObject(String json) throws IllegalStateException, CoreException { + public Map parseJsonObject(final String json) + throws IllegalStateException, CoreException { JsonElement jsonElement = JsonParser.parseString(json); JsonObject jsonObject = jsonElement.getAsJsonObject(); return processJsonObject(jsonObject); } - private Map processJsonObject(JsonObject jsonObject) throws CoreException { - Map resultMap = new LinkedHashMap<>(); + @SuppressWarnings("unchecked") + public Map parseJsonObjectAndRemoveNulls(final String json) + throws IllegalStateException, CoreException { + Map map = parseJsonObject(json); + map.values().removeIf(Objects::isNull); + return (Map) (Map) map; + } + + private Map processJsonObject(JsonObject jsonObject) throws CoreException { + final var resultMap = new LinkedHashMap(); for (Map.Entry entry : jsonObject.entrySet()) { String key = entry.getKey(); JsonElement value = entry.getValue(); @@ -60,7 +71,7 @@ private Map processJsonObject(JsonObject jsonObject) throws Core return resultMap; } - private Object handleJsonElement(JsonElement value) throws CoreException { + private @Nullable Object handleJsonElement(JsonElement value) throws CoreException { if (value.isJsonObject()) { return processJsonObject(value.getAsJsonObject()); } @@ -85,7 +96,7 @@ private Object handleJsonPrimitive(JsonPrimitive primitive) throws CoreException } private Object processJsonArray(JsonArray array) throws CoreException { - ArrayList resultArray = new ArrayList(); + final var resultArray = new ArrayList<@Nullable Object>(); for (JsonElement element : array) { resultArray.add(handleJsonElement(element)); } diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/TransportStreams.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/TransportStreams.java index 60f182933..d148a4f29 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/TransportStreams.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/TransportStreams.java @@ -8,6 +8,8 @@ *******************************************************************************/ package org.eclipse.lsp4e.debug.debugmodel; +import static org.eclipse.lsp4e.debug.internal.NullSafetyHelper.*; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -15,8 +17,8 @@ public abstract class TransportStreams { - public InputStream in = null; - public OutputStream out = null; + public InputStream in = lateNonNull(); + public OutputStream out = lateNonNull(); public void close() { try { @@ -32,7 +34,8 @@ public void close() { } public TransportStreams withTrace() { - return new DefaultTransportStreams(new TraceInputStream(in, System.out), new TraceOutputStream(out, System.out)) { + return new DefaultTransportStreams(new TraceInputStream(in, System.out), + new TraceOutputStream(out, System.out)) { @Override public void close() { TransportStreams.this.close(); @@ -57,7 +60,7 @@ public SocketTransportStreams(String host, int port) { out = socket.getOutputStream(); } catch (Exception ex) { throw new RuntimeException(ex); - } + } } @Override @@ -67,7 +70,7 @@ public void close() { socket.close(); } catch (IOException e) { throw new RuntimeException(e); - } + } } } } \ No newline at end of file diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/package-info.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/package-info.java new file mode 100644 index 000000000..82df0c2b3 --- /dev/null +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/debugmodel/package-info.java @@ -0,0 +1,6 @@ +@NonNullByDefault({ ARRAY_CONTENTS, PARAMETER, RETURN_TYPE, FIELD, TYPE_BOUND, TYPE_ARGUMENT }) +package org.eclipse.lsp4e.debug.debugmodel; + +import static org.eclipse.jdt.annotation.DefaultLocation.*; + +import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/internal/NullSafetyHelper.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/internal/NullSafetyHelper.java new file mode 100644 index 000000000..74a4fa1b5 --- /dev/null +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/internal/NullSafetyHelper.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2022 Sebastian Thomschke and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Sebastian Thomschke - initial implementation + */ +package org.eclipse.lsp4e.debug.internal; + +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; + +/** + * Copied from lsp4e.plugin + */ +public final class NullSafetyHelper { + + /** + * Casts a non-null value marked as {@link Nullable} to {@link NonNull}. + *

+ * Only use if you are sure the value is non-null but annotation-based null + * analysis was not able to determine it. + *

+ * This method is not meant for non-null input validation. + * + * @return the input value cast to {@link NonNull} + * @throws IllegalStateException if the given value is {@code null} + */ + public static @NonNull T castNonNull(final @Nullable T value) { + if (value == null) + throw new IllegalStateException("Unexpected null value present!"); //$NON-NLS-1$ + return value; + } + + /** + * Casts the elements of given array to {@link NonNull} without any validation. + *

+ * Only use if you are sure the value is non-null but annotation-based null + * analysis was not able to determine it. + * + * @return the input value cast to {@link NonNull} + */ + @SuppressWarnings("null") + public static @NonNull T castNonNullUnsafe(final T value) { + return value; + } + + /** + * Allows the temporary assignment of {@code null} to a {@code @NonNull} field + * during declaration, deferring proper initialization until a later point when + * the actual non-null value is available. + * + *

+ * This method is useful when a field must be initialized later but cannot be + * left unassigned at the point of declaration (e.g. when a value is provided by + * a later setup step). + * + *

+ * Note: The field must be assigned a non-null value before it + * is accessed to prevent {@link NullPointerException}s. + */ + @SuppressWarnings("null") + public static @NonNull T lateNonNull() { + return (@NonNull T) null; + } + + private NullSafetyHelper() { + } +} diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/internal/package-info.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/internal/package-info.java new file mode 100644 index 000000000..d684826ef --- /dev/null +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/internal/package-info.java @@ -0,0 +1,6 @@ +@NonNullByDefault({ ARRAY_CONTENTS, PARAMETER, RETURN_TYPE, FIELD, TYPE_BOUND, TYPE_ARGUMENT }) +package org.eclipse.lsp4e.debug.internal; + +import static org.eclipse.jdt.annotation.DefaultLocation.*; + +import org.eclipse.jdt.annotation.NonNullByDefault; 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 a3887f365..f76d7abfd 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 @@ -8,6 +8,8 @@ *******************************************************************************/ package org.eclipse.lsp4e.debug.launcher; +import static org.eclipse.lsp4e.debug.internal.NullSafetyHelper.*; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -34,6 +36,7 @@ import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; import org.eclipse.debug.core.model.IProcess; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.lsp4e.debug.DSPPlugin; import org.eclipse.lsp4e.debug.debugmodel.DSPDebugTarget; import org.eclipse.lsp4e.debug.debugmodel.JsonParserWithStringSubstitution; @@ -52,18 +55,18 @@ public class DSPLaunchDelegate implements ILaunchConfigurationDelegate { * of consumers a little easier to read. */ public static class DSPLaunchDelegateLaunchBuilder { - ILaunchConfiguration configuration; - String mode; - ILaunch launch; - IProgressMonitor monitor; - boolean launchNotConnect; - String debugCmd; - List debugCmdArgs; - String[] debugCmdEnvVars; - boolean monitorDebugAdapter; - String server; - int port; - Map dspParameters; + private ILaunchConfiguration configuration; + private String mode; + private ILaunch launch; + private @Nullable IProgressMonitor monitor; + private boolean launchNotConnect; + private @Nullable String debugCmd; + private @Nullable List debugCmdArgs; + private String @Nullable [] debugCmdEnvVars; + private boolean monitorDebugAdapter; + private @Nullable String server; + private int port; + private Map dspParameters; private DSPLaunchDelegateLaunchBuilder(DSPLaunchDelegateLaunchBuilder other) { this.configuration = other.configuration; @@ -93,7 +96,7 @@ private DSPLaunchDelegateLaunchBuilder(DSPLaunchDelegateLaunchBuilder other) { * @param monitor */ public DSPLaunchDelegateLaunchBuilder(ILaunchConfiguration configuration, String mode, ILaunch launch, - IProgressMonitor monitor) { + @Nullable IProgressMonitor monitor) { this.configuration = configuration; this.mode = mode; this.launch = launch; @@ -101,18 +104,19 @@ public DSPLaunchDelegateLaunchBuilder(ILaunchConfiguration configuration, String this.dspParameters = new HashMap<>(); } - public DSPLaunchDelegateLaunchBuilder setLaunchDebugAdapter(String debugCmd, List debugCmdArgs) { + public DSPLaunchDelegateLaunchBuilder setLaunchDebugAdapter(String debugCmd, + @Nullable List debugCmdArgs) { return setLaunchDebugAdapter(debugCmd, debugCmdArgs, (String[]) null); } - public DSPLaunchDelegateLaunchBuilder setLaunchDebugAdapter(String debugCmd, List debugCmdArgs, - Map envVars) { + public DSPLaunchDelegateLaunchBuilder setLaunchDebugAdapter(String debugCmd, + @Nullable List debugCmdArgs, @Nullable Map envVars) { return setLaunchDebugAdapter(debugCmd, debugCmdArgs, envVars == null ? null : envVars.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).toArray(String[]::new)); } - public DSPLaunchDelegateLaunchBuilder setLaunchDebugAdapter(String debugCmd, List debugCmdArgs, - String[] envVars) { + public DSPLaunchDelegateLaunchBuilder setLaunchDebugAdapter(String debugCmd, + @Nullable List debugCmdArgs, String @Nullable [] envVars) { this.launchNotConnect = true; this.debugCmd = debugCmd; this.debugCmdArgs = debugCmdArgs; @@ -149,7 +153,7 @@ public ILaunch getLaunch() { return launch; } - public IProgressMonitor getMonitor() { + public @Nullable IProgressMonitor getMonitor() { return monitor; } @@ -157,15 +161,15 @@ public boolean isLaunchNotConnect() { return launchNotConnect; } - public String getDebugCmd() { + public @Nullable String getDebugCmd() { return debugCmd; } - public List getDebugCmdArgs() { + public @Nullable List getDebugCmdArgs() { return debugCmdArgs; } - public String[] getDebugCmdEnvVars() { + public String @Nullable [] getDebugCmdEnvVars() { return debugCmdEnvVars; } @@ -173,7 +177,7 @@ public boolean isMonitorDebugAdapter() { return monitorDebugAdapter; } - public String getServer() { + public @Nullable String getServer() { return server; } @@ -196,26 +200,26 @@ public String toString() { } @Override - public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) - throws CoreException { + public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, + @Nullable IProgressMonitor monitor) throws CoreException { final var builder = new DSPLaunchDelegateLaunchBuilder(configuration, mode, launch, monitor); builder.launchNotConnect = DSPPlugin.DSP_MODE_LAUNCH .equals(configuration.getAttribute(DSPPlugin.ATTR_DSP_MODE, DSPPlugin.DSP_MODE_LAUNCH)); - builder.debugCmd = configuration.getAttribute(DSPPlugin.ATTR_DSP_CMD, (String) null); - builder.debugCmdArgs = configuration.getAttribute(DSPPlugin.ATTR_DSP_ARGS, (List) null); + builder.debugCmd = configuration.getAttribute(DSPPlugin.ATTR_DSP_CMD, ""); + builder.debugCmdArgs = configuration.getAttribute(DSPPlugin.ATTR_DSP_ARGS, List.of()); builder.debugCmdEnvVars = DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration); builder.monitorDebugAdapter = configuration.getAttribute(DSPPlugin.ATTR_DSP_MONITOR_DEBUG_ADAPTER, false); - builder.server = configuration.getAttribute(DSPPlugin.ATTR_DSP_SERVER_HOST, (String) null); + builder.server = configuration.getAttribute(DSPPlugin.ATTR_DSP_SERVER_HOST, ""); builder.port = configuration.getAttribute(DSPPlugin.ATTR_DSP_SERVER_PORT, 0); - String dspParametersJson = configuration.getAttribute(DSPPlugin.ATTR_DSP_PARAM, (String) null); + String dspParametersJson = configuration.getAttribute(DSPPlugin.ATTR_DSP_PARAM, "{}"); try { JsonParserWithStringSubstitution jsonUtils = new JsonParserWithStringSubstitution( VariablesPlugin.getDefault().getStringVariableManager()); - Map customParams = jsonUtils.parseJsonObject(dspParametersJson); + Map customParams = jsonUtils.parseJsonObjectAndRemoveNulls(dspParametersJson); builder.dspParameters.putAll(customParams); } catch (IllegalStateException e) { - abort("Json launch parameters were not correctly formatted.", e); //$NON-NLS-1$ + throw new CoreException(createErrorStatus("Json launch parameters were not correctly formatted.", null)); } launch(builder); @@ -233,23 +237,26 @@ public void launch(DSPLaunchDelegateLaunchBuilder builderSrc) throws CoreExcepti if (customDebugAdapter) { builder.launchNotConnect = DSPPlugin.DSP_MODE_LAUNCH .equals(builder.configuration.getAttribute(DSPPlugin.ATTR_DSP_MODE, DSPPlugin.DSP_MODE_LAUNCH)); - builder.debugCmd = builder.configuration.getAttribute(DSPPlugin.ATTR_DSP_CMD, (String) null); - builder.debugCmdArgs = builder.configuration.getAttribute(DSPPlugin.ATTR_DSP_ARGS, (List) null); + builder.debugCmd = builder.configuration.getAttribute(DSPPlugin.ATTR_DSP_CMD, ""); + builder.debugCmdArgs = builder.configuration.getAttribute(DSPPlugin.ATTR_DSP_ARGS, List.of()); builder.debugCmdEnvVars = DebugPlugin.getDefault().getLaunchManager().getEnvironment(builder.configuration); builder.monitorDebugAdapter = builder.configuration.getAttribute(DSPPlugin.ATTR_DSP_MONITOR_DEBUG_ADAPTER, false); - builder.server = builder.configuration.getAttribute(DSPPlugin.ATTR_DSP_SERVER_HOST, (String) null); + builder.server = builder.configuration.getAttribute(DSPPlugin.ATTR_DSP_SERVER_HOST, ""); builder.port = builder.configuration.getAttribute(DSPPlugin.ATTR_DSP_SERVER_PORT, 0); } if (customLaunchParameters) { - String dspParametersJson = builder.configuration.getAttribute(DSPPlugin.ATTR_DSP_PARAM, (String) null); - try { - JsonParserWithStringSubstitution jsonUtils = new JsonParserWithStringSubstitution( - VariablesPlugin.getDefault().getStringVariableManager()); - Map customParams = jsonUtils.parseJsonObject(dspParametersJson); - builder.dspParameters.putAll(customParams); - } catch (IllegalStateException | CoreException e) { - abort("Json launch parameters were not correctly formatted.", e); //$NON-NLS-1$ + String dspParametersJson = builder.configuration.getAttribute(DSPPlugin.ATTR_DSP_PARAM, ""); + if (!dspParametersJson.isBlank()) { + try { + JsonParserWithStringSubstitution jsonUtils = new JsonParserWithStringSubstitution( + VariablesPlugin.getDefault().getStringVariableManager()); + Map customParams = jsonUtils.parseJsonObjectAndRemoveNulls(dspParametersJson); + builder.dspParameters.putAll(customParams); + } catch (IllegalStateException | CoreException e) { + throw new CoreException( + createErrorStatus("Json launch parameters were not correctly formatted.", null)); + } } } @@ -262,24 +269,26 @@ public void launch(DSPLaunchDelegateLaunchBuilder builderSrc) throws CoreExcepti subMonitor.setTaskName("Starting run session"); builder.dspParameters.put("noDebug", true); } else { - abort(NLS.bind("Unsupported launch mode '{0}'.", builder.mode), null); + throw new CoreException(createErrorStatus(NLS.bind("Unsupported launch mode '{0}'.", builder.mode), null)); } - Supplier streamSupplier; + final Supplier streamSupplier; try { - if (builder.launchNotConnect) { InputStream inputStream; OutputStream outputStream; Runnable cleanup; final var command = new ArrayList(); - if (builder.debugCmd == null) { - abort("Debug command unspecified.", null); //$NON-NLS-1$ + final var debugCmd = builder.debugCmd; + if (debugCmd == null || debugCmd.isBlank()) { + throw new CoreException(createErrorStatus("Debug command unspecified.", null)); } - command.add(builder.debugCmd); - if (builder.debugCmdArgs != null && !builder.debugCmdArgs.isEmpty()) { - command.addAll(builder.debugCmdArgs); + command.add(debugCmd); + + final var debugCmdArgs = builder.debugCmdArgs; + if (debugCmdArgs != null && !debugCmdArgs.isEmpty()) { + command.addAll(debugCmdArgs); } subMonitor @@ -315,20 +324,22 @@ public int read() throws IOException { } }; DSPLaunchDelegateLaunchBuilder finalBuilder = builder; - debugAdapterIProcess.getStreamsProxy().getOutputStreamMonitor().addListener((text, monitor) -> { - try { - for (byte b : text - .getBytes(finalBuilder.launch.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING))) { - bytes.add(b); - } - } catch (IOException e) { - DSPPlugin.logError(e); - } - }); + castNonNull(castNonNull(debugAdapterIProcess.getStreamsProxy()).getOutputStreamMonitor()) + .addListener((text, monitor) -> { + try { + for (byte b : text.getBytes(castNonNull( + finalBuilder.launch.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING)))) { + bytes.add(b); + } + } catch (IOException e) { + DSPPlugin.logError(e); + } + }); outputStream = new OutputStream() { @Override public void write(int b) throws IOException { - debugAdapterIProcess.getStreamsProxy().write(new String(new byte[] { (byte) b })); + castNonNull(debugAdapterIProcess.getStreamsProxy()) + .write(new String(new byte[] { (byte) b })); } }; cleanup = () -> { @@ -353,15 +364,17 @@ public void close() { } }; } else { - if (builder.server == null) { - abort("Debug server host unspecified.", null); //$NON-NLS-1$ + final var server = builder.server; + if (server == null || server.isBlank()) { + throw new CoreException(createErrorStatus("Debug server host unspecified.", null)); } - if (builder.port < 1 || builder.port > 65535) { - abort("Debug server port unspecified or out of range 1-65535.", null); //$NON-NLS-1$ + throw new CoreException( + createErrorStatus("Debug server port unspecified or out of range 1-65535.", null)); } + subMonitor.subTask(NLS.bind("Connecting to debug adapter: {0}:{1}", builder.server, builder.port)); - streamSupplier = () -> new SocketTransportStreams(builder.server, builder.port); + streamSupplier = () -> new SocketTransportStreams(server, builder.port); } subMonitor.setWorkRemaining(80); @@ -371,7 +384,7 @@ public void close() { IDebugTarget target = createDebugTarget(subMonitor, streamSupplier, launch, dspParameters); builder.launch.addDebugTarget(target); } catch (OperationCanceledException e1) { - abort("Failed to start debugging", e1); + throw new CoreException(createErrorStatus("Failed to start debugging", e1)); } finally { subMonitor.done(); } @@ -392,14 +405,13 @@ protected IDebugTarget createDebugTarget(SubMonitor subMonitor, Suppliernull */ - protected String getAttributeValueFrom(Text text) { + protected @Nullable String getAttributeValueFrom(Text text) { String value = text.getText().trim(); if (!value.isEmpty()) { return value; @@ -332,14 +337,17 @@ public boolean isValid(ILaunchConfiguration launchConfig) { return false; } - try { - int port = Integer.parseInt(getAttributeValueFrom(serverPort)); - if (port < 1 || port > 65535) { - throw new NumberFormatException(); + final var serverPortVal = getAttributeValueFrom(serverPort); + if (serverPortVal != null) { + try { + int port = Integer.parseInt(serverPortVal); + if (port < 1 || port > 65535) { + throw new NumberFormatException(); + } + } catch (NumberFormatException e) { + setMessage("Specify a port as an integer in the range 1-65535"); + return false; } - } catch (NumberFormatException e) { - setMessage("Specify a port as an integer in the range 1-65535"); - return false; } } } diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/launcher/package-info.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/launcher/package-info.java new file mode 100644 index 000000000..0d14af3c8 --- /dev/null +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/launcher/package-info.java @@ -0,0 +1,6 @@ +@NonNullByDefault({ ARRAY_CONTENTS, PARAMETER, RETURN_TYPE, FIELD, TYPE_BOUND, TYPE_ARGUMENT }) +package org.eclipse.lsp4e.debug.launcher; + +import static org.eclipse.jdt.annotation.DefaultLocation.*; + +import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/package-info.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/package-info.java new file mode 100644 index 000000000..9ed96a92c --- /dev/null +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/package-info.java @@ -0,0 +1,6 @@ +@NonNullByDefault({ ARRAY_CONTENTS, PARAMETER, RETURN_TYPE, FIELD, TYPE_BOUND, TYPE_ARGUMENT }) +package org.eclipse.lsp4e.debug; + +import static org.eclipse.jdt.annotation.DefaultLocation.*; + +import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/presentation/DAPWatchExpression.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/presentation/DAPWatchExpression.java index f95c941e8..e6a0c4bc9 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/presentation/DAPWatchExpression.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/presentation/DAPWatchExpression.java @@ -8,6 +8,8 @@ *******************************************************************************/ package org.eclipse.lsp4e.debug.presentation; +import static org.eclipse.lsp4e.debug.internal.NullSafetyHelper.*; + import org.eclipse.core.runtime.Adapters; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IDebugElement; @@ -15,6 +17,7 @@ import org.eclipse.debug.core.model.IWatchExpressionDelegate; import org.eclipse.debug.core.model.IWatchExpressionListener; import org.eclipse.debug.core.model.IWatchExpressionResult; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.lsp4e.debug.debugmodel.DSPDebugTarget; import org.eclipse.lsp4e.debug.debugmodel.DSPStackFrame; import org.eclipse.lsp4e.debug.debugmodel.DSPValue; @@ -28,7 +31,7 @@ public void evaluateExpression(String expression, IDebugElement context, IWatchE if (context.getDebugTarget() instanceof DSPDebugTarget dapDebugger) { final var args = new EvaluateArguments(); args.setExpression(expression); - DSPStackFrame frame = Adapters.adapt(context, DSPStackFrame.class); + DSPStackFrame frame = castNonNull(Adapters.adapt(context, DSPStackFrame.class)); args.setFrameId(frame.getFrameId()); dapDebugger.getDebugProtocolServer().evaluate(args).thenAccept( res -> listener.watchEvaluationFinished(createWatchResult(dapDebugger, expression, res))); @@ -44,7 +47,7 @@ public boolean hasErrors() { } @Override - public IValue getValue() { + public @Nullable IValue getValue() { return new DSPValue(dapDebugger, res.getVariablesReference(), res.getResult()); } @@ -54,13 +57,13 @@ public String getExpressionText() { } @Override - public DebugException getException() { + public @Nullable DebugException getException() { return null; } @Override public String[] getErrorMessages() { - return null; + return new String[0]; } }; } diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/presentation/DSPDebugModelPresentation.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/presentation/DSPDebugModelPresentation.java index e52ba28a2..c8fbd5d9e 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/presentation/DSPDebugModelPresentation.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/presentation/DSPDebugModelPresentation.java @@ -26,6 +26,7 @@ import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.debug.ui.ISourcePresentation; import org.eclipse.debug.ui.IValueDetailListener; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.viewers.IFontProvider; import org.eclipse.jface.viewers.LabelProvider; @@ -48,7 +49,7 @@ public class DSPDebugModelPresentation extends LabelProvider implements IDebugModelPresentation, IFontProvider { - private Font italic; + private @Nullable Font italic; @Override public String getText(Object element) { @@ -81,7 +82,7 @@ public String getText(Object element) { } @Override - public Font getFont(Object element) { + public @Nullable Font getFont(Object element) { if (element instanceof DSPDebugElement debugElement) { if (debugElement.getErrorMessage() != null) { return italic(); @@ -91,17 +92,19 @@ public Font getFont(Object element) { } private Font italic() { - if (italic == null) { - Font dialogFont = JFaceResources.getDialogFont(); - FontData[] fontData = dialogFont.getFontData(); - for (int i = 0; i < fontData.length; i++) { - FontData data = fontData[i]; - data.setStyle(SWT.ITALIC); - } - Display display = getDisplay(); - italic = new Font(display, fontData); + if (this.italic != null) { + return this.italic; + } + + Font dialogFont = JFaceResources.getDialogFont(); + FontData[] fontData = dialogFont.getFontData(); + for (int i = 0; i < fontData.length; i++) { + FontData data = fontData[i]; + data.setStyle(SWT.ITALIC); } - return italic; + Display display = getDisplay(); + this.italic = new Font(display, fontData); + return this.italic; } @Override @@ -113,7 +116,7 @@ public void dispose() { } @Override - public IEditorInput getEditorInput(Object element) { + public @Nullable IEditorInput getEditorInput(Object element) { if (element instanceof ILineBreakpoint lineBreakpoint) { return new FileEditorInput((IFile) lineBreakpoint.getMarker().getResource()); } @@ -135,7 +138,7 @@ public IEditorInput getEditorInput(Object element) { } @Override - public String getEditorId(IEditorInput input, Object element) { + public @Nullable String getEditorId(IEditorInput input, Object element) { String id = null; if (input != null) { IEditorDescriptor descriptor = null; @@ -180,7 +183,7 @@ public String getEditorId(IEditorInput input, Object element) { } @Override - public void setAttribute(String attribute, Object value) { + public void setAttribute(String attribute, @Nullable Object value) { } @Override diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/presentation/package-info.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/presentation/package-info.java new file mode 100644 index 000000000..ae49fd635 --- /dev/null +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/presentation/package-info.java @@ -0,0 +1,6 @@ +@NonNullByDefault({ ARRAY_CONTENTS, PARAMETER, RETURN_TYPE, FIELD, TYPE_BOUND, TYPE_ARGUMENT }) +package org.eclipse.lsp4e.debug.presentation; + +import static org.eclipse.jdt.annotation.DefaultLocation.*; + +import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/AbsolutePathSourceContainer.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/AbsolutePathSourceContainer.java index cf724715f..ff262e6cc 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/AbsolutePathSourceContainer.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/AbsolutePathSourceContainer.java @@ -14,6 +14,7 @@ import org.eclipse.debug.core.sourcelookup.ISourceContainer; import org.eclipse.debug.core.sourcelookup.ISourceContainerType; import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainer; +import org.eclipse.jdt.annotation.Nullable; public class AbsolutePathSourceContainer extends AbstractSourceContainer implements ISourceContainer { @@ -31,7 +32,7 @@ public String getName() { } @Override - public ISourceContainerType getType() { + public @Nullable ISourceContainerType getType() { return null; } diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/DSPSourceLookupParticipant.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/DSPSourceLookupParticipant.java index 9a09a6757..f4e4da76d 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/DSPSourceLookupParticipant.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/DSPSourceLookupParticipant.java @@ -10,12 +10,13 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.lsp4e.debug.debugmodel.DSPStackFrame; public class DSPSourceLookupParticipant extends AbstractSourceLookupParticipant { @Override - public String getSourceName(Object object) throws CoreException { + public @Nullable String getSourceName(Object object) throws CoreException { if (object instanceof String string) { return string; } diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/DSPSourcePathComputerDelegate.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/DSPSourcePathComputerDelegate.java index 9df9fc3cb..71b20cd04 100644 --- a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/DSPSourcePathComputerDelegate.java +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/DSPSourcePathComputerDelegate.java @@ -13,12 +13,13 @@ import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.sourcelookup.ISourceContainer; import org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate; +import org.eclipse.jdt.annotation.Nullable; public class DSPSourcePathComputerDelegate implements ISourcePathComputerDelegate { @Override - public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) - throws CoreException { + public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, + @Nullable IProgressMonitor monitor) throws CoreException { return new ISourceContainer[] { new AbsolutePathSourceContainer() }; } diff --git a/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/package-info.java b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/package-info.java new file mode 100644 index 000000000..49902d090 --- /dev/null +++ b/org.eclipse.lsp4e.debug/src/org/eclipse/lsp4e/debug/sourcelookup/package-info.java @@ -0,0 +1,6 @@ +@NonNullByDefault({ ARRAY_CONTENTS, PARAMETER, RETURN_TYPE, FIELD, TYPE_BOUND, TYPE_ARGUMENT }) +package org.eclipse.lsp4e.debug.sourcelookup; + +import static org.eclipse.jdt.annotation.DefaultLocation.*; + +import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/org.eclipse.lsp4e.jdt/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.lsp4e.jdt/.settings/org.eclipse.jdt.core.prefs index d4540a53f..b8c626f76 100644 --- a/org.eclipse.lsp4e.jdt/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.lsp4e.jdt/.settings/org.eclipse.jdt.core.prefs @@ -1,10 +1,447 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.annotationPath.allLocations=enabled +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=warning +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.notowning=org.eclipse.jdt.annotation.NotOwning +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled +org.eclipse.jdt.core.compiler.annotation.owning=org.eclipse.jdt.annotation.Owning +org.eclipse.jdt.core.compiler.annotation.resourceanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompatibleOwningContract=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.insufficientResourceAnalysis=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=error +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=info +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=error +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.release=enabled org.eclipse.jdt.core.compiler.source=17 +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 +org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/org.eclipse.lsp4e.jdt/META-INF/MANIFEST.MF b/org.eclipse.lsp4e.jdt/META-INF/MANIFEST.MF index b7b6db422..a78b0607d 100644 --- a/org.eclipse.lsp4e.jdt/META-INF/MANIFEST.MF +++ b/org.eclipse.lsp4e.jdt/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: JDT Integration for LSP4E Bundle-SymbolicName: org.eclipse.lsp4e.jdt;singleton:=true -Bundle-Version: 0.13.0.qualifier +Bundle-Version: 0.13.1.qualifier Automatic-Module-Name: org.eclipse.lsp4e.jdt Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ClassPath: . @@ -11,7 +11,7 @@ Bundle-Vendor: Eclipse.org Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0", org.eclipse.jface.text;bundle-version="3.13.0", org.eclipse.ui;bundle-version="3.108.0", - org.eclipse.lsp4e;bundle-version="0.16.0", + org.eclipse.lsp4e;bundle-version="0.18.13", org.eclipse.jdt.core;bundle-version="3.20.0", org.eclipse.jdt.ui;bundle-version="3.20.0", org.eclipse.swt diff --git a/org.eclipse.lsp4e.jdt/build.properties b/org.eclipse.lsp4e.jdt/build.properties index 841466265..a9a253c80 100644 --- a/org.eclipse.lsp4e.jdt/build.properties +++ b/org.eclipse.lsp4e.jdt/build.properties @@ -5,3 +5,7 @@ bin.includes = META-INF/,\ plugin.xml,\ EPL-2.0.html,\ plugin.properties + +# JDT Null Analysis for Eclipse +additional.bundles = org.eclipse.jdt.annotation,\ + com.vegardit.no-npe.eea-all 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 d5a96fe90..c4b154407 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 @@ -20,6 +20,8 @@ import java.util.concurrent.TimeoutException; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext; import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer; import org.eclipse.jface.text.contentassist.ICompletionProposal; @@ -36,13 +38,14 @@ public class LSJavaCompletionProposalComputer implements IJavaCompletionProposal private static final long TIMEOUT_LENGTH = 300; private final LSContentAssistProcessor lsContentAssistProcessor = new LSContentAssistProcessor(false); - private String javaCompletionSpecificErrorMessage; + private @Nullable String javaCompletionSpecificErrorMessage; @Override public void sessionStarted() { } @Override + @NonNullByDefault({}) public List computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) { CompletableFuture future = CompletableFuture.supplyAsync(() -> @@ -99,6 +102,7 @@ private ICompletionProposal[] asJavaProposals(CompletableFuture computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) { IContextInformation[] contextInformation = lsContentAssistProcessor.computeContextInformation(context.getViewer(), context.getInvocationOffset()); @@ -106,7 +110,7 @@ public List computeContextInformation(ContentAssistInvocati } @Override - public String getErrorMessage() { + public @Nullable String getErrorMessage() { return javaCompletionSpecificErrorMessage != null ? javaCompletionSpecificErrorMessage : lsContentAssistProcessor.getErrorMessage(); } diff --git a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaHoverProvider.java b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaHoverProvider.java index a2701a9ba..11e73cc6f 100644 --- a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaHoverProvider.java +++ b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaHoverProvider.java @@ -17,6 +17,7 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicReference; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.internal.ui.text.java.hover.JavadocBrowserInformationControlInput; import org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover; @@ -34,7 +35,7 @@ @SuppressWarnings("restriction") public class LSJavaHoverProvider extends JavadocHover { - private static String fgStyleSheet; + private static @Nullable String fgStyleSheet; private static final String BODY_OPEN = " lsHoverFuture = this.lsBasedHover.getHoverInfoFuture(textViewer, hoverRegion); - final var lsHtmlHoverContent = new AtomicReference(); - final var jdtHoverControlInput = new AtomicReference(); + CompletableFuture<@Nullable String> lsHoverFuture = this.lsBasedHover.getHoverInfoFuture(textViewer, hoverRegion); + final var lsHtmlHoverContent = new AtomicReference<@Nullable String>(); + final var jdtHoverControlInput = new AtomicReference<@Nullable JavadocBrowserInformationControlInput>(); JavadocBrowserInformationControlInput input; IJavaElement javaElement = null; @@ -98,7 +99,7 @@ public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) { return new JavadocBrowserInformationControlInput(previous, javaElement, content, leadingImageWidth); } - private String formatContent(String lsContent, String jdtContent) { + private String formatContent(@Nullable String lsContent, @Nullable String jdtContent) { if (lsContent != null && lsContent.trim().length() > 0 && jdtContent != null && jdtContent.trim().length() > 0) { return concatenateHtml(lsContent, jdtContent); @@ -159,7 +160,7 @@ private static String concatenateHtml(String lsHtml, String jdtHtml) { } @Override - public IRegion getHoverRegion(ITextViewer textViewer, int offset) { + public @Nullable IRegion getHoverRegion(ITextViewer textViewer, int offset) { return this.lsBasedHover.getHoverRegion(textViewer, offset); } @@ -167,14 +168,14 @@ public IRegion getHoverRegion(ITextViewer textViewer, int offset) { * Taken from {@link JavadocHover}. It's private. See {@link JavadocHover#getStyleSheet()}. * @return CSS as string */ - private static String getStyleSheet() { + private static @Nullable String getStyleSheet() { if (fgStyleSheet == null) { fgStyleSheet= JavadocHover.loadStyleSheet("/JavadocHoverStyleSheet.css"); //$NON-NLS-1$ } - String css= fgStyleSheet; + String css = fgStyleSheet; if (css != null) { FontData fontData= JFaceResources.getFontRegistry().getFontData(PreferenceConstants.APPEARANCE_JAVADOC_FONT)[0]; - css= HTMLPrinter.convertTopLevelFont(css, fontData); + css = HTMLPrinter.convertTopLevelFont(css, fontData); } return css; } diff --git a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaProposal.java b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaProposal.java index 129edc67f..8c87c9314 100644 --- a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaProposal.java +++ b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaProposal.java @@ -11,6 +11,7 @@ *******************************************************************************/ package org.eclipse.lsp4e.jdt; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.contentassist.ICompletionProposal; @@ -19,7 +20,7 @@ import org.eclipse.swt.graphics.Point; class LSJavaProposal implements IJavaCompletionProposal { - + protected ICompletionProposal delegate; private int relevance; @@ -30,16 +31,16 @@ public LSJavaProposal(ICompletionProposal delegate, int relevance) { @Override public void apply(IDocument document) { - delegate.apply(document); + delegate.apply(document); } @Override - public String getAdditionalProposalInfo() { + public @Nullable String getAdditionalProposalInfo() { return delegate.getAdditionalProposalInfo(); } @Override - public IContextInformation getContextInformation() { + public @Nullable IContextInformation getContextInformation() { return delegate.getContextInformation(); } @@ -49,12 +50,12 @@ public String getDisplayString() { } @Override - public Image getImage() { + public @Nullable Image getImage() { return delegate.getImage(); } @Override - public Point getSelection(IDocument document) { + public @Nullable Point getSelection(IDocument document) { return delegate.getSelection(document); } @@ -62,5 +63,5 @@ public Point getSelection(IDocument document) { public int getRelevance() { return relevance; } - + } diff --git a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaProposalExtension.java b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaProposalExtension.java index 92e74bca4..3176ead64 100644 --- a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaProposalExtension.java +++ b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaProposalExtension.java @@ -11,6 +11,7 @@ *******************************************************************************/ package org.eclipse.lsp4e.jdt; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.contentassist.ICompletionProposal; import org.eclipse.jface.text.contentassist.ICompletionProposalExtension; @@ -23,31 +24,31 @@ public LSJavaProposalExtension(ICompletionProposal delegate, int relevance) { @Override public void apply(IDocument doc, char trigger, int offset) { - if (delegate instanceof ICompletionProposalExtension) { - ((ICompletionProposalExtension) delegate).apply(doc, trigger, offset); + if (delegate instanceof ICompletionProposalExtension proposalExt) { + proposalExt.apply(doc, trigger, offset); } } @Override public int getContextInformationPosition() { - if (delegate instanceof ICompletionProposalExtension) { - ((ICompletionProposalExtension) delegate).getContextInformationPosition(); + if (delegate instanceof ICompletionProposalExtension proposalExt) { + proposalExt.getContextInformationPosition(); } return -1; } @Override - public char[] getTriggerCharacters() { - if (delegate instanceof ICompletionProposalExtension) { - ((ICompletionProposalExtension) delegate).getTriggerCharacters(); + public char @Nullable [] getTriggerCharacters() { + if (delegate instanceof ICompletionProposalExtension proposalExt) { + proposalExt.getTriggerCharacters(); } return null; } @Override public boolean isValidFor(IDocument doc, int offset) { - if (delegate instanceof ICompletionProposalExtension) { - ((ICompletionProposalExtension) delegate).isValidFor(doc, offset); + if (delegate instanceof ICompletionProposalExtension proposalExt) { + proposalExt.isValidFor(doc, offset); } return false; } diff --git a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaProposalExtension2.java b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaProposalExtension2.java index aa6d50150..14b65cc52 100644 --- a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaProposalExtension2.java +++ b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaProposalExtension2.java @@ -11,6 +11,7 @@ *******************************************************************************/ package org.eclipse.lsp4e.jdt; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.text.DocumentEvent; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextViewer; @@ -25,31 +26,31 @@ public LSJavaProposalExtension2(ICompletionProposal delegate, int relevance) { @Override public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) { - if (delegate instanceof ICompletionProposalExtension2) { - ((ICompletionProposalExtension2) delegate).apply(viewer, trigger, stateMask, offset); + if (delegate instanceof ICompletionProposalExtension2 proposalExt2) { + proposalExt2.apply(viewer, trigger, stateMask, offset); } } @Override public void selected(ITextViewer viewer, boolean smartToggle) { - if (delegate instanceof ICompletionProposalExtension2) { - ((ICompletionProposalExtension2) delegate).selected(viewer, smartToggle); + if (delegate instanceof ICompletionProposalExtension2 proposalExt2) { + proposalExt2.selected(viewer, smartToggle); } } @Override public void unselected(ITextViewer viewer) { - if (delegate instanceof ICompletionProposalExtension2) { - ((ICompletionProposalExtension2) delegate).unselected(viewer); + if (delegate instanceof ICompletionProposalExtension2 proposalExt2) { + proposalExt2.unselected(viewer); } } @Override - public boolean validate(IDocument document, int offset, DocumentEvent event) { - if (delegate instanceof ICompletionProposalExtension2) { - return ((ICompletionProposalExtension2) delegate).validate(document, offset, event); + public boolean validate(IDocument document, int offset, @Nullable DocumentEvent event) { + if (delegate instanceof ICompletionProposalExtension2 proposalExt2) { + return proposalExt2.validate(document, offset, event); } return false; } - + } diff --git a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LspJavaQuickAssistProcessor.java b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LspJavaQuickAssistProcessor.java index 6b8110055..4494cad38 100644 --- a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LspJavaQuickAssistProcessor.java +++ b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LspJavaQuickAssistProcessor.java @@ -12,6 +12,8 @@ package org.eclipse.lsp4e.jdt; import org.eclipse.core.runtime.CoreException; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.ui.text.java.IInvocationContext; import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal; import org.eclipse.jdt.ui.text.java.IProblemLocation; @@ -51,19 +53,22 @@ public int getLength() { } @Override - public boolean hasAssists(IInvocationContext context) throws CoreException { + public boolean hasAssists(@NonNullByDefault({}) IInvocationContext context) throws CoreException { return this.canAssist(getContext(context)); } @Override - public IJavaCompletionProposal[] getAssists(IInvocationContext context, IProblemLocation[] locations) - throws CoreException { + public IJavaCompletionProposal @Nullable [] getAssists(@NonNullByDefault({}) IInvocationContext context, + @NonNullByDefault({}) IProblemLocation[] locations) throws CoreException { ICompletionProposal[] proposals = computeQuickAssistProposals(getContext(context)); + if (proposals == null) + return new IJavaCompletionProposal[0]; + final var javaProposals = new IJavaCompletionProposal[proposals.length]; for (int i = 0; i < proposals.length; i++) { /* - * Different completion extension applied differently, hence each requires a wrapper implementing + * Different completion extension applied differently, hence each requires a wrapper implementing * proper completion proposal extension */ if (proposals[i] instanceof ICompletionProposalExtension2) { diff --git a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/Messages.java b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/Messages.java index 2b5905ff0..6f6f90dd4 100644 --- a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/Messages.java +++ b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/Messages.java @@ -11,13 +11,15 @@ *******************************************************************************/ package org.eclipse.lsp4e.jdt; +import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.osgi.util.NLS; +@NonNullByDefault({}) public class Messages extends NLS { - public static String javaSpecificCompletionError; + public static String javaSpecificCompletionError; - static { - NLS.initializeMessages("org.eclipse.lsp4e.jdt.messages", Messages.class); //$NON-NLS-1$ - } + static { + NLS.initializeMessages("org.eclipse.lsp4e.jdt.messages", Messages.class); //$NON-NLS-1$ + } } diff --git a/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/package-info.java b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/package-info.java new file mode 100644 index 000000000..cf12ea6b6 --- /dev/null +++ b/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/package-info.java @@ -0,0 +1,6 @@ +@NonNullByDefault({ ARRAY_CONTENTS, PARAMETER, RETURN_TYPE, FIELD, TYPE_BOUND, TYPE_ARGUMENT }) +package org.eclipse.lsp4e.jdt; + +import static org.eclipse.jdt.annotation.DefaultLocation.*; + +import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/org.eclipse.lsp4e/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.lsp4e/.settings/org.eclipse.jdt.core.prefs index bb5c97c19..589430cec 100644 --- a/org.eclipse.lsp4e/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.lsp4e/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,7 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.builder.annotationPath.allLocations=enabled org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=warning org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=org.eclipse.lsp4j.jsonrpc.validation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault diff --git a/org.eclipse.lsp4e/META-INF/MANIFEST.MF b/org.eclipse.lsp4e/META-INF/MANIFEST.MF index a5cc761ee..1eb69ee03 100644 --- a/org.eclipse.lsp4e/META-INF/MANIFEST.MF +++ b/org.eclipse.lsp4e/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Language Server Protocol client for Eclipse IDE (Incubation) Bundle-SymbolicName: org.eclipse.lsp4e;singleton:=true -Bundle-Version: 0.18.12.qualifier +Bundle-Version: 0.18.13.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-17 Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0", org.eclipse.equinox.common;bundle-version="3.8.0", @@ -51,6 +51,7 @@ Bundle-Activator: org.eclipse.lsp4e.LanguageServerPlugin Export-Package: org.eclipse.lsp4e;x-internal:=true, org.eclipse.lsp4e.command;x-internal:=true, org.eclipse.lsp4e.format;x-internal:=true, + org.eclipse.lsp4e.internal;x-friends:="org.eclipse.lsp4e.jdt", org.eclipse.lsp4e.operations.codeactions;x-internal:=true, org.eclipse.lsp4e.operations.completion;x-internal:=true, org.eclipse.lsp4e.operations.format;x-internal:=true, diff --git a/org.eclipse.lsp4e/build.properties b/org.eclipse.lsp4e/build.properties index 834e201e3..133852674 100644 --- a/org.eclipse.lsp4e/build.properties +++ b/org.eclipse.lsp4e/build.properties @@ -12,4 +12,5 @@ bin.includes = META-INF/,\ src.includes = schema/ # JDT Null Analysis for Eclipse -additional.bundles = org.eclipse.jdt.annotation +additional.bundles = org.eclipse.jdt.annotation,\ + com.vegardit.no-npe.eea-all diff --git a/org.eclipse.lsp4e/pom.xml b/org.eclipse.lsp4e/pom.xml index 45bd041ce..d9f6afa24 100644 --- a/org.eclipse.lsp4e/pom.xml +++ b/org.eclipse.lsp4e/pom.xml @@ -10,7 +10,7 @@ org.eclipse.lsp4e eclipse-plugin - 0.18.12-SNAPSHOT + 0.18.13-SNAPSHOT diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LaunchConfigurationStreamProvider.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LaunchConfigurationStreamProvider.java index 4d344a551..e21014d2e 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LaunchConfigurationStreamProvider.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LaunchConfigurationStreamProvider.java @@ -161,7 +161,13 @@ public void start() throws IOException { if (launch.getProcesses().length > 0) { final var process = this.process = launch.getProcesses()[0]; final var inputStream = this.inputStream = new StreamProxyInputStream(process); - process.getStreamsProxy().getOutputStreamMonitor().addListener(inputStream); + final var proxy = process.getStreamsProxy(); + if(proxy != null) { + final var mon = proxy.getOutputStreamMonitor(); + if (mon != null) { + mon.addListener(inputStream); + } + } // TODO: Ugly hack, find something better to retrieve stream! try { Method systemProcessGetter = RuntimeProcess.class.getDeclaredMethod("getSystemProcess"); //$NON-NLS-1$ @@ -172,7 +178,12 @@ public void start() throws IOException { LanguageServerPlugin.logError(ex); } final var errorStream = this.errorStream = new StreamProxyInputStream(process); - process.getStreamsProxy().getErrorStreamMonitor().addListener(errorStream); + if(proxy != null) { + final var mon = proxy.getErrorStreamMonitor(); + if (mon != null) { + mon.addListener(errorStream); + } + } } } catch (Exception e) { LanguageServerPlugin.logError(e); diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/command/CommandExecutor.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/command/CommandExecutor.java index be6d9776b..6b164308a 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/command/CommandExecutor.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/command/CommandExecutor.java @@ -90,7 +90,7 @@ public class CommandExecutor { return CompletableFuture.completedFuture(null); } - @SuppressWarnings("unused") // ECJ compiler handlerService cannot be null because getService is declared as + // ECJ compiler handlerService cannot be null because getService is declared as // T getService(Class api), it infers the input is Class and the output // IHandlerService, as it takes over the annotation when inferring the return type, which // is a bug in its implementation @@ -107,10 +107,7 @@ public class CommandExecutor { return null; } try { - CompletableFuture r = CompletableFuture.completedFuture(handlerService.executeCommand(parameterizedCommand, null)); - if (r != null) { - return r; - } + return CompletableFuture.completedFuture(handlerService.executeCommand(parameterizedCommand, null)); } catch (ExecutionException | NotDefinedException e) { LanguageServerPlugin.logError(e); } catch (NotEnabledException | NotHandledException e2) { @@ -128,7 +125,7 @@ public class CommandExecutor { return null; } - @SuppressWarnings("unused") // ECJ compiler thinks commandService cannot be null (see above) + // ECJ compiler thinks commandService cannot be null (see above) private static @Nullable ParameterizedCommand createEclipseCoreCommand(Command command, @Nullable IPath context, IWorkbench workbench) { // Usually commands are defined via extension point, but we synthesize one on diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/internal/NullSafetyHelper.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/internal/NullSafetyHelper.java index 618c5fea9..750b0cd5e 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/internal/NullSafetyHelper.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/internal/NullSafetyHelper.java @@ -22,11 +22,14 @@ public final class NullSafetyHelper { /** * Casts a non-null value marked as {@link Nullable} to {@link NonNull}. *

- * Only use if you are sure the value is non-null but annotation-based null analysis was not able to determine it. + * Only use if you are sure the value is non-null but annotation-based null + * analysis was not able to determine it. *

* This method is not meant for non-null input validation. * - * @throws IllegalStateException if the given value is null + * @return the input value cast to {@link NonNull} + * @throws IllegalStateException + * if the given value is {@code null} */ public static @NonNull T castNonNull(final @Nullable T value) { if (value == null) @@ -37,7 +40,10 @@ public final class NullSafetyHelper { /** * Casts the elements of given array to {@link NonNull} without any validation. *

- * Only use if you are sure the value is non-null but annotation-based null analysis was not able to determine it. + * Only use if you are sure the value is non-null but annotation-based null + * analysis was not able to determine it. + * + * @return the input value cast to {@link NonNull} */ @SuppressWarnings("null") public static @NonNull T castNonNullUnsafe(final T value) { @@ -46,6 +52,8 @@ public final class NullSafetyHelper { /** * Casts a non-null value as {@link Nullable}. + * + * @return the input value cast to {@link Nullable} */ public static @Nullable T castNullable(final T value) { return value; @@ -66,12 +74,22 @@ public static T defaultIfNull(final @Nullable T object, final Supplier de } /** - * Allows to initializes a @NonNull field with null that is - * initialized later. + * Allows the temporary assignment of {@code null} to a {@code @NonNull} field + * during declaration, deferring proper initialization until a later point when + * the actual non-null value is available. + * + *

+ * This method is useful when a field must be initialized later but cannot be + * left unassigned at the point of declaration (e.g. when a value is provided by + * a later setup step). + * + *

+ * Note: The field must be assigned a non-null value before it + * is accessed to prevent {@link NullPointerException}s. */ - @SuppressWarnings("unchecked") + @SuppressWarnings("null") public static @NonNull T lateNonNull() { - return (T) castNonNullUnsafe(null); + return (@NonNull T) null; } private NullSafetyHelper() { diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/internal/StyleUtil.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/internal/StyleUtil.java index a67043b8f..85461e1df 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/internal/StyleUtil.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/internal/StyleUtil.java @@ -11,7 +11,6 @@ *******************************************************************************/ package org.eclipse.lsp4e.internal; -import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jface.viewers.StyledString.Styler; import org.eclipse.swt.graphics.TextStyle; @@ -23,7 +22,7 @@ private StyleUtil() { public static final Styler DEPRECATE = new Styler() { @Override - public void applyStyles(@NonNullByDefault({}) TextStyle textStyle) { + public void applyStyles(final TextStyle textStyle) { textStyle.strikeout = true; } }; diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/outline/CNFOutlinePage.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/outline/CNFOutlinePage.java index 38bfd33ac..5d16a0d28 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/outline/CNFOutlinePage.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/outline/CNFOutlinePage.java @@ -22,7 +22,6 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; @@ -85,7 +84,7 @@ public CNFOutlinePage(LanguageServerWrapper wrapper, @Nullable ITextEditor textE } @Override - public void createControl(@NonNullByDefault({}) Composite parent) { + public void createControl(final Composite parent) { outlineViewer = new CommonViewer(ID, parent, SWT.NONE); if (document != null) { outlineViewer.setInput(new OutlineViewerInput(document, wrapper, textEditor)); @@ -189,7 +188,7 @@ public static void refreshTreeSelection(TreeViewer viewer, int offset, IDocument return; } - Object @Nullable [] objects = contentProvider.getElements(null); + Object[] objects = contentProvider.getElements(null); final var path = new ArrayList(); while (objects != null && objects.length > 0) { boolean found = false; @@ -220,7 +219,6 @@ public static void refreshTreeSelection(TreeViewer viewer, int offset, IDocument } } - @SuppressWarnings("unused") private static @Nullable Range toRange(Object object) { Range range = null; @Nullable @@ -268,7 +266,7 @@ public void dispose() { } @Override - public void setActionBars(@NonNullByDefault({}) IActionBars actionBars) { + public void setActionBars(final IActionBars actionBars) { // nothing to do yet, comment requested by sonar } diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/outline/LSSymbolsContentProvider.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/outline/LSSymbolsContentProvider.java index cab53be9f..5f7fb1366 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/outline/LSSymbolsContentProvider.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/outline/LSSymbolsContentProvider.java @@ -36,7 +36,6 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.text.DocumentEvent; import org.eclipse.jface.text.IDocument; @@ -164,10 +163,12 @@ public void uninstall() { @Override public void preferenceChange(PreferenceChangeEvent event) { - if (viewer != null - && event.getKey().startsWith(CNFOutlinePage.HIDE_DOCUMENT_SYMBOL_KIND_PREFERENCE_PREFIX)) { + final var viewer = LSSymbolsContentProvider.this.viewer; + if (viewer == null) + return; + if (event.getKey().startsWith(CNFOutlinePage.HIDE_DOCUMENT_SYMBOL_KIND_PREFERENCE_PREFIX)) { viewer.getControl().getDisplay().asyncExec(() -> { - if(!viewer.getTree().isDisposed()) { + if (!viewer.getTree().isDisposed()) { viewer.refresh(); } }); @@ -196,17 +197,17 @@ protected void initialProcess() { } @Override - protected void process(@NonNullByDefault({}) DirtyRegion dirtyRegion) { + protected void process(final DirtyRegion dirtyRegion) { refreshTreeContentFromLS(); } @Override - protected void reconcilerDocumentChanged(@NonNullByDefault({}) IDocument newDocument) { + protected void reconcilerDocumentChanged(final IDocument newDocument) { // Do nothing } @Override - public @Nullable IReconcilingStrategy getReconcilingStrategy(@NonNullByDefault({}) String contentType) { + public @Nullable IReconcilingStrategy getReconcilingStrategy(final String contentType) { return null; } } @@ -231,6 +232,10 @@ public void uninstall() { @Override public void resourceChanged(IResourceChangeEvent event) { + final var viewer = LSSymbolsContentProvider.this.viewer; + if (viewer == null) + return; + if ((event.getDelta().getFlags() ^ IResourceDelta.MARKERS) != 0) { try { event.getDelta().accept(delta -> { @@ -250,7 +255,7 @@ public void resourceChanged(IResourceChangeEvent event) { } } - private TreeViewer viewer = lateNonNull(); + private @Nullable TreeViewer viewer; private volatile @Nullable Throwable lastError; private OutlineViewerInput outlineViewerInput = lateNonNull(); @@ -271,7 +276,7 @@ public LSSymbolsContentProvider(boolean refreshOnResourceChanged) { } @Override - public void init(@NonNullByDefault({}) ICommonContentExtensionSite aConfig) { + public void init(final ICommonContentExtensionSite aConfig) { preferencesDependantOutlineUpdater.install(); } @@ -364,6 +369,9 @@ public boolean hasChildren(Object parentElement) { } protected void refreshTreeContentFromLS() { + final var viewer = this.viewer; + if(viewer == null) + return; final URI documentURI = outlineViewerInput.documentURI; if (documentURI == null) { IllegalStateException exception = new IllegalStateException("documentURI == null"); //$NON-NLS-1$ @@ -440,10 +448,10 @@ public void dispose() { } @Override - public void restoreState(@NonNullByDefault({}) IMemento aMemento) { + public void restoreState(final IMemento aMemento) { } @Override - public void saveState(@NonNullByDefault({}) IMemento aMemento) { + public void saveState(final IMemento aMemento) { } } diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/outline/SymbolsLabelProvider.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/outline/SymbolsLabelProvider.java index e6d74ff1b..6025d5136 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/outline/SymbolsLabelProvider.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/outline/SymbolsLabelProvider.java @@ -30,7 +30,6 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.text.BadLocationException; @@ -341,20 +340,20 @@ private boolean isDeprecated(@Nullable List tags) { } @Override - public void restoreState(@NonNullByDefault({}) IMemento aMemento) { + public void restoreState(final IMemento aMemento) { } @Override - public void saveState(@NonNullByDefault({}) IMemento aMemento) { + public void saveState(final IMemento aMemento) { } @Override - public @Nullable String getDescription(@NonNullByDefault({}) Object anElement) { + public @Nullable String getDescription(final Object anElement) { return null; } @Override - public void init(@NonNullByDefault({}) ICommonContentExtensionSite aConfig) { + public void init(final ICommonContentExtensionSite aConfig) { } @Override diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/ui/LanguageServersView.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/ui/LanguageServersView.java index 1826049fa..b1d7610ef 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/ui/LanguageServersView.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/ui/LanguageServersView.java @@ -24,7 +24,6 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ColumnLabelProvider; @@ -118,7 +117,7 @@ public void createPartControl(Composite parent) { createColumn(EMPTY, 26, new ColumnLabelProvider() { @Override - public void update(@NonNullByDefault({}) ViewerCell cell) { + public void update(final ViewerCell cell) { final var lsWrapper = (LanguageServerWrapper) cell.getElement(); final var item = (TableItem) cell.getItem(); final var buttons = actionButtons.computeIfAbsent(lsWrapper, unused -> { diff --git a/pom.xml b/pom.xml index e03f20fb5..1da8884c2 100644 --- a/pom.xml +++ b/pom.xml @@ -40,16 +40,6 @@ repository - - - - com.vegardit.no-npe - no-npe-eea-all - 1.0.4 - provided - - - diff --git a/target-platforms/target-platform-latest/target-platform-latest.target b/target-platforms/target-platform-latest/target-platform-latest.target index 129b67498..c906cc200 100644 --- a/target-platforms/target-platform-latest/target-platform-latest.target +++ b/target-platforms/target-platform-latest/target-platform-latest.target @@ -26,10 +26,21 @@ - - - - + + + + + + + + + com.vegardit.no-npe + no-npe-eea-all + 1.0.5 + jar + + + \ No newline at end of file