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

wrap all calls to StringLiteral.getLiteralValue via ASTUtils to avoid IllegalStateException #1434

Closed
martinlippert opened this issue Dec 9, 2024 · 2 comments
Assignees
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode theme: spring index & symbols theme: validation type: bug

Comments

@martinlippert
Copy link
Member

Came across the already mentioned multi-threading issue around StringLiteral.getLiteralValue again (see below). Looks like we need to walk through the code and wrap all calls to getLiteralValue via the corresponding method in ASTUtils

21:40:33.329 [pool-2-thread-3] ERROR o.s.i.v.b.j.r.RequestMappingSymbolProvider - problem occured while scanning for request mapping symbols from file:///Users/martinlippert/Engineering/projects/test-projects/spring-petclinic-large/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java
java.lang.IllegalArgumentException: null
	at org.eclipse.jdt.core.dom.StringLiteral.getLiteralValue(StringLiteral.java:233)
	at org.springframework.ide.vscode.boot.java.utils.ASTUtils.getLiteralValue(ASTUtils.java:199)
	at org.springframework.ide.vscode.boot.java.utils.ASTUtils.getExpressionValueAsString(ASTUtils.java:205)
	at org.springframework.ide.vscode.boot.java.utils.ASTUtils.getExpressionValueAsArray(ASTUtils.java:240)
	at org.springframework.ide.vscode.boot.java.requestmapping.RequestMappingSymbolProvider.getPath(RequestMappingSymbolProvider.java:94)
	at org.springframework.ide.vscode.boot.java.requestmapping.RequestMappingSymbolProvider.addSymbolsPass1(RequestMappingSymbolProvider.java:60)
	at org.springframework.ide.vscode.boot.java.handlers.AbstractSymbolProvider.addSymbols(AbstractSymbolProvider.java:31)
	at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.extractSymbolInformation(SpringIndexerJava.java:765)
	at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava$8.visit(SpringIndexerJava.java:641)
	at org.eclipse.jdt.core.dom.SingleMemberAnnotation.accept0(SingleMemberAnnotation.java:151)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:3414)
	at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:660)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:3414)
	at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:498)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:3414)
	at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:258)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
	at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.scanAST(SpringIndexerJava.java:612)
	at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.lambda$13(SpringIndexerJava.java:361)
	at org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache.withCompilationUnit(CompilationUnitCache.java:240)
	at org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.computeSymbols(SpringIndexerJava.java:338)
	at org.springframework.ide.vscode.boot.app.SpringSymbolIndex.getSymbols(SpringSymbolIndex.java:723)
	at org.springframework.ide.vscode.boot.java.BootJavaLanguageServerComponents.lambda$0(BootJavaLanguageServerComponents.java:175)
	at org.springframework.ide.vscode.commons.languageserver.composable.CompositeLanguageServerComponents$6.lambda$2(CompositeLanguageServerComponents.java:203)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at org.springframework.ide.vscode.commons.languageserver.composable.CompositeLanguageServerComponents$6.handle(CompositeLanguageServerComponents.java:204)
	at org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService.lambda$8(SimpleTextDocumentService.java:444)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
21:40:33.328 [Reconciler-1] ERROR o.s.i.v.b.j.u.CompilationUnitCache - 
java.lang.IllegalArgumentException: null
	at org.eclipse.jdt.core.dom.StringLiteral.getLiteralValue(StringLiteral.java:230)
	at org.springframework.ide.vscode.boot.java.reconcilers.ImplicitWebAnnotationNamesReconciler.getAnnotationParameter(ImplicitWebAnnotationNamesReconciler.java:144)
	at org.springframework.ide.vscode.boot.java.reconcilers.ImplicitWebAnnotationNamesReconciler.isApplicableWebAnnotation(ImplicitWebAnnotationNamesReconciler.java:120)
	at org.springframework.ide.vscode.boot.java.reconcilers.ImplicitWebAnnotationNamesReconciler$1.processWebAnnotation(ImplicitWebAnnotationNamesReconciler.java:93)
	at org.springframework.ide.vscode.boot.java.reconcilers.ImplicitWebAnnotationNamesReconciler$1.visit(ImplicitWebAnnotationNamesReconciler.java:88)
	at org.springframework.ide.vscode.boot.java.reconcilers.CompositeASTVisitor.visit(CompositeASTVisitor.java:103)
	at org.eclipse.jdt.core.dom.SingleMemberAnnotation.accept0(SingleMemberAnnotation.java:151)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:3414)
	at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:660)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:3414)
	at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:498)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:3414)
	at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:258)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3343)
	at org.springframework.ide.vscode.boot.java.reconcilers.JdtReconciler.reconcile(JdtReconciler.java:125)
	at org.springframework.ide.vscode.boot.java.reconcilers.JdtReconciler.lambda$2(JdtReconciler.java:91)
	at org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache.withCompilationUnit(CompilationUnitCache.java:240)
	at org.springframework.ide.vscode.boot.java.reconcilers.JdtReconciler.reconcile(JdtReconciler.java:88)
	at org.springframework.ide.vscode.boot.java.handlers.BootJavaReconcileEngine.reconcile(BootJavaReconcileEngine.java:76)
	at org.springframework.ide.vscode.commons.languageserver.composable.CompositeLanguageServerComponents$1.reconcile(CompositeLanguageServerComponents.java:105)
	at org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer.lambda$13(SimpleLanguageServer.java:781)
	at reactor.core.publisher.MonoRunnable.subscribe(MonoRunnable.java:49)
	at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:76)
	at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:241)
	at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.onComplete(MonoIgnoreThen.java:204)
	at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onComplete(FluxOnAssembly.java:549)
	at reactor.core.publisher.MonoPublishOn$PublishOnSubscriber.run(MonoPublishOn.java:182)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
@martinlippert martinlippert added type: bug theme: spring index & symbols for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode theme: validation labels Dec 9, 2024
@martinlippert martinlippert added this to the 4.28.0.RELEASE milestone Dec 9, 2024
@martinlippert martinlippert self-assigned this Dec 9, 2024
@martinlippert
Copy link
Member Author

Looking at the method call hierarchy for StringLiteral.getLiteralValue, there are many invocations appearing in the code base.

@martinlippert
Copy link
Member Author

Also filed this issue for JDT Core: eclipse-jdt/eclipse.jdt.core#3424

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

No branches or pull requests

1 participant