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

[validation] reconciler throws NPE #1117

Closed
martinlippert opened this issue Oct 5, 2023 · 3 comments
Closed

[validation] reconciler throws NPE #1117

martinlippert opened this issue Oct 5, 2023 · 3 comments
Assignees
Labels
for: vscode something that is specific for VSCode theme: validation type: bug

Comments

@martinlippert
Copy link
Member

I tried the latest pre-release in VSCode with a petclinic sample application, hacking some stuff in some classes. Afterwards, I found these exceptions (a bunch of them) on the log of the language server:

12:34:07.710 [pool-4-thread-6] ERROR o.s.i.v.b.j.r.JdtReconciler - 
java.lang.NullPointerException: Cannot invoke "org.eclipse.jdt.core.dom.CompilationUnit.accept(org.eclipse.jdt.core.dom.ASTVisitor)" because "cu" is null
	at org.springframework.ide.vscode.boot.java.reconcilers.AnnotationNodeReconciler.reconcile(AnnotationNodeReconciler.java:82)
	at org.springframework.ide.vscode.boot.java.reconcilers.JdtReconciler.reconcile(JdtReconciler.java:87)
	at org.springframework.ide.vscode.boot.java.rewrite.RewriteCodeActionHandler.lambda$handle$0(RewriteCodeActionHandler.java:114)
	at org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache.withCompilationUnit(CompilationUnitCache.java:233)
	at org.springframework.ide.vscode.boot.java.rewrite.RewriteCodeActionHandler.handle(RewriteCodeActionHandler.java:109)
	at org.springframework.ide.vscode.boot.java.handlers.BootJavaCodeActionProvider.lambda$handle$0(BootJavaCodeActionProvider.java:52)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(Unknown Source)
	at java.base/java.util.Iterator.forEachRemaining(Unknown Source)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
	at org.springframework.ide.vscode.boot.java.handlers.BootJavaCodeActionProvider.handle(BootJavaCodeActionProvider.java:57)
	at org.springframework.ide.vscode.commons.languageserver.composable.CompositeLanguageServerComponents$3.lambda$handle$0(CompositeLanguageServerComponents.java:119)
	at java.base/java.util.Optional.map(Unknown Source)
	at org.springframework.ide.vscode.commons.languageserver.composable.CompositeLanguageServerComponents$3.handle(CompositeLanguageServerComponents.java:119)
	at org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService.computeCodeActions(SimpleTextDocumentService.java:471)
	at org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService.lambda$codeAction$12(SimpleTextDocumentService.java:517)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

There was also a user visible problem happening on the UI, the content-assist was blocked (did not show any proposals anymore, just loading...), but I am not sure whether it is related or not.

Nevertheless, we need to fix this NPE issue, whether it is related to the auto-complete problem or not.

@martinlippert
Copy link
Member Author

It looks like the exception is thrown by all the various reconcilers, I can see the same or a similar exception from all of them, for example:

12:34:07.710 [pool-4-thread-6] ERROR o.s.i.v.b.j.r.JdtReconciler - 
java.lang.NullPointerException: Cannot invoke "org.eclipse.jdt.core.dom.CompilationUnit.accept(org.eclipse.jdt.core.dom.ASTVisitor)" because "cu" is null
	at org.springframework.ide.vscode.boot.java.reconcilers.BeanMethodNotPublicReconciler.reconcile(BeanMethodNotPublicReconciler.java:135)
	at org.springframework.ide.vscode.boot.java.reconcilers.JdtReconciler.reconcile(JdtReconciler.java:87)
	at org.springframework.ide.vscode.boot.java.rewrite.RewriteCodeActionHandler.lambda$handle$0(RewriteCodeActionHandler.java:114)
	at org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache.withCompilationUnit(CompilationUnitCache.java:233)
	at org.springframework.ide.vscode.boot.java.rewrite.RewriteCodeActionHandler.handle(RewriteCodeActionHandler.java:109)
	at org.springframework.ide.vscode.boot.java.handlers.BootJavaCodeActionProvider.lambda$handle$0(BootJavaCodeActionProvider.java:52)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(Unknown Source)
	at java.base/java.util.Iterator.forEachRemaining(Unknown Source)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
	at org.springframework.ide.vscode.boot.java.handlers.BootJavaCodeActionProvider.handle(BootJavaCodeActionProvider.java:57)
	at org.springframework.ide.vscode.commons.languageserver.composable.CompositeLanguageServerComponents$3.lambda$handle$0(CompositeLanguageServerComponents.java:119)
	at java.base/java.util.Optional.map(Unknown Source)
	at org.springframework.ide.vscode.commons.languageserver.composable.CompositeLanguageServerComponents$3.handle(CompositeLanguageServerComponents.java:119)
	at org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService.computeCodeActions(SimpleTextDocumentService.java:471)
	at org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService.lambda$codeAction$12(SimpleTextDocumentService.java:517)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

or

12:34:07.711 [pool-4-thread-6] ERROR o.s.i.v.b.j.r.JdtReconciler - 
java.lang.NullPointerException: Cannot invoke "org.eclipse.jdt.core.dom.CompilationUnit.getPackage()" because "cu" is null
	at org.springframework.ide.vscode.boot.java.reconcilers.ModulithTypeReferenceViolationReconciler.reconcile(ModulithTypeReferenceViolationReconciler.java:47)
	at org.springframework.ide.vscode.boot.java.reconcilers.JdtReconciler.reconcile(JdtReconciler.java:87)
	at org.springframework.ide.vscode.boot.java.rewrite.RewriteCodeActionHandler.lambda$handle$0(RewriteCodeActionHandler.java:114)
	at org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache.withCompilationUnit(CompilationUnitCache.java:233)
	at org.springframework.ide.vscode.boot.java.rewrite.RewriteCodeActionHandler.handle(RewriteCodeActionHandler.java:109)
	at org.springframework.ide.vscode.boot.java.handlers.BootJavaCodeActionProvider.lambda$handle$0(BootJavaCodeActionProvider.java:52)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(Unknown Source)
	at java.base/java.util.Iterator.forEachRemaining(Unknown Source)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
	at org.springframework.ide.vscode.boot.java.handlers.BootJavaCodeActionProvider.handle(BootJavaCodeActionProvider.java:57)
	at org.springframework.ide.vscode.commons.languageserver.composable.CompositeLanguageServerComponents$3.lambda$handle$0(CompositeLanguageServerComponents.java:119)
	at java.base/java.util.Optional.map(Unknown Source)
	at org.springframework.ide.vscode.commons.languageserver.composable.CompositeLanguageServerComponents$3.handle(CompositeLanguageServerComponents.java:119)
	at org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService.computeCodeActions(SimpleTextDocumentService.java:471)
	at org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService.lambda$codeAction$12(SimpleTextDocumentService.java:517)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

@BoykoAlex
Copy link
Contributor

@martinlippert Wonder if you get the same issues in reconcilers once you restart VSCode/Eclipse...

I have a bad a feeling that what you got into is not an easily reproducible scenario and it has to do something with some issues in CU Cache Java parsing.

@BoykoAlex
Copy link
Contributor

BoykoAlex commented Oct 5, 2023

NPE is fixed 862fd9b It was good to fix it indeed. All other paths to the JdtReconciler#reconole(...) method all check for CU not being null before calling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: vscode something that is specific for VSCode theme: validation type: bug
Projects
None yet
Development

No branches or pull requests

2 participants