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

NPE on ASTNode.getParent() codeAction failure in VSCode after getData() is null #454

Open
evie-lau opened this issue May 25, 2023 · 8 comments
Labels
bug Something isn't working
Milestone

Comments

@evie-lau
Copy link
Contributor

evie-lau commented May 25, 2023

Unsure if this is related to the new cursor context code that was merged in #453.

Both of these shift focus to the Output window when the error occurs.

NPE on ASTNode.getParent()

When moving the cursor (clicking or arrow keys) to some highlighted diagnostics in a Jakarta project, this error shows up:

[Error - 5:13:30 PM] Request textDocument/codeAction failed.
  Message: Request jakarta/java/codeaction failed with message: java.lang.NullPointerException: Cannot invoke "org.eclipse.jdt.core.dom.ASTNode.getParent()" because "node" is null
  Code: -32603 

Some examples to reproduce:

ClassCastException moved to #455

@yeekangc
Copy link
Contributor

Let us break each exception into their own issue.

@turkeylurkey turkeylurkey added the bug Something isn't working label May 29, 2023
@turkeylurkey turkeylurkey added this to the GA milestone May 29, 2023
@turkeylurkey turkeylurkey changed the title More codeAction failures in VSCode NPE on ASTNode.getParent() codeAction failure in VSCode May 29, 2023
@yeekangc
Copy link
Contributor

Thanks for breaking out the issues, @turkeylurkey!

@yeekangc
Copy link
Contributor

Need to determine how pervasive this issue is.

@rumanaHaque
Copy link

In my testing with VSCode using the latest driver dated May 29th, liberty-dev-vscode-ext-23.0.6-SNAPSHOT.vsix, I was not able to recreate this exception.

@dshimo
Copy link
Contributor

dshimo commented May 31, 2023

Simply adding the @Resource annotation to a class consistently recreates this error. I was able to hit this with the 23.0.6 driver on Mac and Linux.

image

@cherylking
Copy link

Is this stop ship?

@rumanaHaque
Copy link

With @dshimo's help, I was also able to reproduce in my env.
image

@turkeylurkey
Copy link
Contributor

Adding @resource causes a diagnostic which uses ScopeDeclarationQuickFix. This quick fix uses diagnostic.getData() which returns null and causes the NPE. Caused by microsoft/vscode#181166

@turkeylurkey turkeylurkey changed the title NPE on ASTNode.getParent() codeAction failure in VSCode NPE on ASTNode.getParent() codeAction failure in VSCode using getData() = null Jun 5, 2023
@turkeylurkey turkeylurkey changed the title NPE on ASTNode.getParent() codeAction failure in VSCode using getData() = null NPE on ASTNode.getParent() codeAction failure in VSCode after getData() is null Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants