spring-projects / sts4

The next generation of tooling for Spring Boot, including support for Cloud Foundry manifest files, Concourse CI pipeline definitions, BOSH deployment manifests, and more... - Available for Eclipse, Visual Studio Code, and Theia
https://spring.io/tools
Eclipse Public License 1.0
884 stars 208 forks source link

[open-rewrite] exception when executing quick fix for project #853

Closed martinlippert closed 2 years ago

martinlippert commented 2 years ago

I have a workspace running that points to the same open-rewrite validation/quick-fix to rename the hello method and configured it via the preferences:

The sample validation/quick fix is unchanged from the sample in the repository.

17:03:12.124 [pool-10-thread-1] ERROR o.e.lsp4j.jsonrpc.RemoteEndpoint - Internal error: java.lang.IllegalStateException: Call reset() on JavaParser before parsing another set of source files that have some of the same fully qualified names. Source file [/Users/mlippert/workspace/workspaces/runtime-spring-boot-ide-test-recipes-smaller-workspace/demo/src/main/java/com/example/demo/MyService.java]
[
package com.example.demo;

public class MyService {

    public void hello() {
        System.out.println();
    }

}

]
java.util.concurrent.CompletionException: java.lang.IllegalStateException: Call reset() on JavaParser before parsing another set of source files that have some of the same fully qualified names. Source file [/Users/mlippert/workspace/workspaces/runtime-spring-boot-ide-test-recipes-smaller-workspace/demo/src/main/java/com/example/demo/MyService.java]
[
package com.example.demo;

public class MyService {

    public void hello() {
        System.out.println();
    }

}

]
    at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:332)
    at java.base/java.util.concurrent.CompletableFuture.uniAcceptNow(CompletableFuture.java:747)
    at java.base/java.util.concurrent.CompletableFuture.uniAcceptStage(CompletableFuture.java:735)
    at java.base/java.util.concurrent.CompletableFuture.thenAccept(CompletableFuture.java:2182)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:279)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
    at org.springframework.ide.vscode.commons.languageserver.util.ParentProcessWatcher.lambda$apply$0(ParentProcessWatcher.java:129)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalStateException: Call reset() on JavaParser before parsing another set of source files that have some of the same fully qualified names. Source file [/Users/mlippert/workspace/workspaces/runtime-spring-boot-ide-test-recipes-smaller-workspace/demo/src/main/java/com/example/demo/MyService.java]
[
package com.example.demo;

public class MyService {

    public void hello() {
        System.out.println();
    }

}

]
    at org.openrewrite.java.isolated.ReloadableJava17Parser.lambda$parseInputsToCompilerAst$2(ReloadableJava17Parser.java:248)
    Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Assembly trace from producer [reactor.core.publisher.MonoFlatMap] :
    reactor.core.publisher.Mono.flatMap(Mono.java:3102)
    org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer.executeCommand(SimpleLanguageServer.java:286)
Error has been observed at the following site(s):
    *__Mono.flatMap ⇢ at org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer.executeCommand(SimpleLanguageServer.java:286)
Original Stack Trace:
        at org.openrewrite.java.isolated.ReloadableJava17Parser.lambda$parseInputsToCompilerAst$2(ReloadableJava17Parser.java:248)
        at io.micrometer.core.instrument.composite.CompositeTimer.record(CompositeTimer.java:65)
        at org.openrewrite.java.isolated.ReloadableJava17Parser.parseInputsToCompilerAst(ReloadableJava17Parser.java:240)
        at org.openrewrite.java.isolated.ReloadableJava17Parser.parseInputs(ReloadableJava17Parser.java:161)
        at org.openrewrite.java.Java17Parser.parseInputs(Java17Parser.java:43)
        at org.openrewrite.Parser.parse(Parser.java:41)
        at org.springframework.ide.vscode.commons.rewrite.java.ORAstUtils.parse(ORAstUtils.java:229)
        at org.springframework.ide.vscode.boot.java.rewrite.RewriteCompilationUnitCache.getCompiulationUnits(RewriteCompilationUnitCache.java:327)
        at org.springframework.ide.vscode.boot.java.rewrite.RewriteRefactorings.perform(RewriteRefactorings.java:142)
        at org.springframework.ide.vscode.boot.java.rewrite.RewriteRefactorings.createEdit(RewriteRefactorings.java:112)
        at org.springframework.ide.vscode.boot.java.rewrite.RewriteRefactorings.createEdits(RewriteRefactorings.java:89)
        at org.springframework.ide.vscode.commons.languageserver.quickfix.QuickfixRegistry.lambda$handle$0(QuickfixRegistry.java:72)
        at reactor.core.publisher.MonoSupplier.call(MonoSupplier.java:86)
        at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:127)
        at reactor.core.publisher.MonoFlatMap.subscribeOrReturn(MonoFlatMap.java:53)
        at reactor.core.publisher.Mono.subscribe(Mono.java:4382)
        at reactor.core.publisher.Mono.subscribeWith(Mono.java:4512)
        at reactor.core.publisher.Mono.toFuture(Mono.java:4917)
        at org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer.executeCommand(SimpleLanguageServer.java:297)
        at org.springframework.ide.vscode.commons.languageserver.util.SimpleWorkspaceService.executeCommand(SimpleWorkspaceService.java:137)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
        at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
        at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
        at org.springframework.ide.vscode.commons.languageserver.util.ParentProcessWatcher.lambda$apply$0(ParentProcessWatcher.java:129)
        at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
        at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
        at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalStateException: endPosTable already set
    at com.sun.tools.javac.util.DiagnosticSource.setEndPosTable(DiagnosticSource.java:136)
    at com.sun.tools.javac.util.Log.setEndPosTable(Log.java:413)
    at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:659)
    at org.openrewrite.java.isolated.ReloadableJava17Parser.lambda$parseInputsToCompilerAst$2(ReloadableJava17Parser.java:242)
    at io.micrometer.core.instrument.composite.CompositeTimer.record(CompositeTimer.java:65)
    at org.openrewrite.java.isolated.ReloadableJava17Parser.parseInputsToCompilerAst(ReloadableJava17Parser.java:240)
    at org.openrewrite.java.isolated.ReloadableJava17Parser.parseInputs(ReloadableJava17Parser.java:161)
    at org.openrewrite.java.Java17Parser.parseInputs(Java17Parser.java:43)
    at org.openrewrite.Parser.parse(Parser.java:41)
    at org.springframework.ide.vscode.commons.rewrite.java.ORAstUtils.parse(ORAstUtils.java:229)
    at org.springframework.ide.vscode.boot.java.rewrite.RewriteCompilationUnitCache.getCompiulationUnits(RewriteCompilationUnitCache.java:327)
    at org.springframework.ide.vscode.boot.java.rewrite.RewriteRefactorings.perform(RewriteRefactorings.java:142)
    at org.springframework.ide.vscode.boot.java.rewrite.RewriteRefactorings.createEdit(RewriteRefactorings.java:112)
    at org.springframework.ide.vscode.boot.java.rewrite.RewriteRefactorings.createEdits(RewriteRefactorings.java:89)
    at org.springframework.ide.vscode.commons.languageserver.quickfix.QuickfixRegistry.lambda$handle$0(QuickfixRegistry.java:72)
    at reactor.core.publisher.MonoSupplier.call(MonoSupplier.java:86)
    at reactor.core.publisher.MonoCallableOnAssembly.call(MonoCallableOnAssembly.java:91)
    at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:127)
    at reactor.core.publisher.MonoFlatMap.subscribeOrReturn(MonoFlatMap.java:53)
    at reactor.core.publisher.Mono.subscribe(Mono.java:4382)
    at reactor.core.publisher.Mono.subscribeWith(Mono.java:4512)
    at reactor.core.publisher.Mono.toFuture(Mono.java:4917)
    at org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer.executeCommand(SimpleLanguageServer.java:297)
    at org.springframework.ide.vscode.commons.languageserver.util.SimpleWorkspaceService.executeCommand(SimpleWorkspaceService.java:137)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
    at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
    at org.springframework.ide.vscode.commons.languageserver.util.ParentProcessWatcher.lambda$apply$0(ParentProcessWatcher.java:129)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
BoykoAlex commented 2 years ago

Should be fixed with 7d4c7df7effc1f894ec724340f872b7e9b5891ff