Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null check annotations for Semantic Tokens API #1852

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BoykoAlex
Copy link
Contributor

The downstream plugins using the new ISemanticTokensProvider API and having JDT null analysis turned on having issues compiling classes deriving from the ISemanticTokensProvider. Whether I add @Nullable or @NonNull the class still fails to compile with

Error: 2,352 [ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:4.0.10:compile (default-compile) on project org.eclipse.lsp4e.jdt: Compilation failure: Compilation failure: 
Error: 2,352 [ERROR] /Users/runner/work/lsp4e/lsp4e/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaSemanticTokensProvider.java:[42] 
Error: 2,352 [ERROR] 	public Collection<ISemanticTokensProvider.SemanticToken> computeSemanticTokens(CompilationUnit ast) {
Error: 2,352 [ERROR] 	       ^^^^^^^^^^
Error: 2,352 [ERROR] The return type is incompatible with 'Collection<ISemanticTokensProvider.SemanticToken>' returned from ISemanticTokensProvider.computeSemanticTokens(CompilationUnit) (mismatching null constraints)
Error: 2,352 [ERROR] 1 problem (1 error)

Adding the @NonNull for the return type and the parameter sets the proper API expectations as well as hopefully would help sorting the downstream compiler errors out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant