Skip to content

Commit

Permalink
Dealing with JDT null check annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
BoykoAlex committed Dec 13, 2024
1 parent 310e2d2 commit 2a87bc2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
3 changes: 1 addition & 2 deletions org.eclipse.lsp4e.jdt/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ 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=warning
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
Expand Down Expand Up @@ -109,7 +109,6 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverridin
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.unusedLambdaParameter=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
Expand Down
2 changes: 0 additions & 2 deletions org.eclipse.lsp4e.jdt/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.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.34.0",
org.eclipse.swt,
org.eclipse.core.resources,
org.eclipse.lsp4j,
org.eclipse.jdt.annotation,
org.eclipse.lsp4j.jsonrpc,
org.eclipse.ui.editors
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ public class LSJavaSemanticTokensProvider implements ISemanticTokensProvider {
@Override
public Collection<ISemanticTokensProvider.SemanticToken> computeSemanticTokens(CompilationUnit ast) {
IPreferenceStore prefStore = LanguageServerPlugin.getDefault().getPreferenceStore();
IPreferenceStore jstPrefStore = LanguageServerJdtPlugin.getDefault().getPreferenceStore();
LanguageServerJdtPlugin plugin = LanguageServerJdtPlugin.getDefault();
if (plugin == null) {
throw new IllegalStateException("Plugin hasn't been started!");
}
IPreferenceStore jstPrefStore = plugin.getPreferenceStore();

if (prefStore.getBoolean(SemanticHighlightReconcilerStrategy.SEMANTIC_HIGHLIGHT_RECONCILER_DISABLED)
|| !jstPrefStore.getBoolean(LspJdtConstants.PREF_SEMANTIC_TOKENS_SWITCH)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.lsp4e.jdt;

import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
Expand All @@ -23,7 +24,7 @@

public class LanguageServerJdtPlugin extends AbstractUIPlugin {

private static LanguageServerJdtPlugin plugin;
private static @Nullable LanguageServerJdtPlugin plugin;

private final IPropertyChangeListener prefsLisetner = new IPropertyChangeListener() {

Expand All @@ -45,7 +46,7 @@ public void propertyChange(PropertyChangeEvent event) {
}
};

public static final LanguageServerJdtPlugin getDefault() {
public static final @Nullable LanguageServerJdtPlugin getDefault() {
return plugin;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ public LspJdtPrefsInitializer() {

@Override
public void initializeDefaultPreferences() {
IPreferenceStore store = LanguageServerJdtPlugin.getDefault().getPreferenceStore();
LanguageServerJdtPlugin plugin = LanguageServerJdtPlugin.getDefault();
if (plugin == null) {
throw new IllegalStateException("Plugin hasn't been started!");
}
IPreferenceStore store = plugin.getPreferenceStore();

store.setDefault(LspJdtConstants.PREF_SEMANTIC_TOKENS_SWITCH, true);
}
Expand Down

0 comments on commit 2a87bc2

Please sign in to comment.