-
Notifications
You must be signed in to change notification settings - Fork 151
Remove all warnings in lsp4j #932
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
Remove all warnings in lsp4j #932
Conversation
pisv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for taking care of cleaning all the warnings! 👍
I have just a few minor notes...
org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/services/NotebookDocumentService.java
Outdated
Show resolved
Hide resolved
...onrpc/src/test/java/org/eclipse/lsp4j/jsonrpc/test/annotations/impl/GenericEndpointTest.java
Show resolved
Hide resolved
...e.lsp4j.jsonrpc/src/main/java/org/eclipse/lsp4j/jsonrpc/json/adapters/EitherTypeAdapter.java
Outdated
Show resolved
Hide resolved
|
Awesome! |
Because test code and production code have the same warning settings this commit works around some of the warnings in tests. The warnings were in one of these categories: - Javadoc warnings - Declared exception not thrown - Unused imports - Unused objects (these were the result of testing that constructors throw exceptions) - Possible null usage - Missing try-with-resources
This suppresses an info message about missing default case
87492aa to
2c873b5
Compare
This is a place where we meet the problem of Java vs Typescript. In Typescript, the fields are directly accessible, and matches what the LSP spec says. But in Java we wrap the fields in a get/set pair, meaning the field is not visible and generates a javadoc warning.
There are lots of these warnings and they can be ignored with this setting, or `@param params` can be added to Javadoc block for each of them. As this warning was recently introduced, and is not a common default, I have elected to turn the warning off. To turn this warning on again, ensure that all existing cases are resolved.
The Gson library that LSP4J is heavily dependent on uses the errorprone annotations. If Eclipse supported warning suppression based on the errorprone annotations, the dozens of potential resource leak warnings in the LSP4J code would be automatically suppressed. This happens because Gson classes such as JsonWriter returns `this` in many of its methods, and since JsonWriter is a Closeable, the JDT warns about it. See for example JsonWrite.nullValue. Gson annotates this method as CanIgnoreReturnValue, meaning no potential resource leak. If JDT gets support for error prone annotations, this warning can be re-enabled.
2c873b5 to
25b3003
Compare
pisv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thank you very much for this effort! 👍
See individual commits + commit messages for details of why and how different warnings are handled.
Fixes #923