vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

Enable annotation-based null analysis

Open CsCherrYY opened this issue 3 years ago • 1 comments

Signed-off-by: Shi Chen [email protected]

related to https://github.com/eclipse/eclipse.jdt.ls/pull/2228

CsCherrYY avatar Sep 15 '22 09:09 CsCherrYY

The workflow is:

  1. project imported
  2. check corresponding jar in the classpath
  3. if exists, update compile options at the server side

since changing compile options needs re-compile to make it effective, I call compile workspace here: https://github.com/redhat-developer/vscode-java/pull/2677/files#diff-c894be06f39638b5cd4094b12af0ae3effd7de5bc75b6a4bdf43d3b283168b65R37

This call is on demand since we will only call this command when the null analysis status has changed. For users don't have related annotation jar on their classpath, it will not execute.

CsCherrYY avatar Sep 21 '22 08:09 CsCherrYY

Thanks @CsCherrYY , you read my mind. I was going to comment on whether the classpath check could be done purely on the server-side to simplify this. My main concern was whether you did it here to avoid performance issues in the preferencesChanged callback, which shouldn't be doing heavy computations.

rgrunber avatar Sep 23 '22 13:09 rgrunber

My main concern was whether you did it here to avoid performance issues in the preferencesChanged callback, which shouldn't be doing heavy computations.

Yeah, we can do things at the client side can make preferencesChanged callback not block the server, but the server still has to check the classpath and full build the affected project to make it work. Currently I just move all the logics to the server side as we discussed (https://github.com/eclipse/eclipse.jdt.ls/pull/2228/files). It will check the classpath when

  • project imported
  • null analysis configurations changed
  • classpath changed

and if the compiler options in specific Java project (when classpath changed) or JavaCore (when null analysis configurations changed) changed, we trigger a full build for the project or the workspace. Is there any place to enhance?

CsCherrYY avatar Sep 26 '22 07:09 CsCherrYY