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

quick fix to convert '@RequestMapping' to '@GetMapping' fails in VSCode #1105

Closed
martinlippert opened this issue Aug 31, 2023 · 2 comments
Closed
Assignees

Comments

@martinlippert
Copy link
Member

(Using the latest pre-release in VSCode...)

Executing the quick fix to turn a @RequestMapping into a @GetMapping fails. In VSCode, this shows up in the error log:

java.util.concurrent.CompletionException: java.lang.NullPointerException: Property must not be null: edit
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.uniAcceptNow(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.uniAcceptStage(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.thenAccept(Unknown Source)
	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(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.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)
Caused by: java.lang.NullPointerException: Property must not be null: edit
	at org.eclipse.lsp4j.util.Preconditions.checkNotNull(Preconditions.java:29)
	Suppressed: The stacktrace has been enhanced by Reactor, refer to additional information below: 
Assembly trace from producer [reactor.core.publisher.MonoFlatMap] :
	reactor.core.publisher.Mono.flatMap(Mono.java:3100)
	org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer.executeCommand(SimpleLanguageServer.java:287)
Error has been observed at the following site(s):
	*__Mono.flatMap ⇢ at org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer.executeCommand(SimpleLanguageServer.java:287)
Original Stack Trace:
		at org.eclipse.lsp4j.util.Preconditions.checkNotNull(Preconditions.java:29)
		at org.eclipse.lsp4j.ApplyWorkspaceEditParams.<init>(ApplyWorkspaceEditParams.java:41)
		at org.eclipse.lsp4j.ApplyWorkspaceEditParams.<init>(ApplyWorkspaceEditParams.java:45)
		at org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer.lambda$executeCommand$3(SimpleLanguageServer.java:288)
		at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:132)
		at reactor.core.publisher.MonoCompletionStage$MonoCompletionStageSubscription.apply(MonoCompletionStage.java:125)
		at reactor.core.publisher.MonoCompletionStage$MonoCompletionStageSubscription.apply(MonoCompletionStage.java:71)
		at java.base/java.util.concurrent.CompletableFuture.uniHandle(Unknown Source)
		at java.base/java.util.concurrent.CompletableFuture.uniHandleStage(Unknown Source)
		at java.base/java.util.concurrent.CompletableFuture.handle(Unknown Source)
		at java.base/java.util.concurrent.CompletableFuture.handle(Unknown Source)
		at reactor.core.publisher.MonoCompletionStage$MonoCompletionStageSubscription.request(MonoCompletionStage.java:149)
		at reactor.core.publisher.MonoFlatMap$FlatMapMain.request(MonoFlatMap.java:194)
		at reactor.core.publisher.MonoToCompletableFuture.onSubscribe(MonoToCompletableFuture.java:53)
		at reactor.core.publisher.MonoFlatMap$FlatMapMain.onSubscribe(MonoFlatMap.java:117)
		at reactor.core.publisher.MonoCompletionStage.subscribe(MonoCompletionStage.java:60)
		at reactor.core.publisher.Mono.subscribe(Mono.java:4495)
		at reactor.core.publisher.Mono.subscribeWith(Mono.java:4561)
		at reactor.core.publisher.Mono.toFuture(Mono.java:5073)
		at org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer.executeCommand(SimpleLanguageServer.java:298)
		at org.springframework.ide.vscode.commons.languageserver.util.SimpleWorkspaceService.executeCommand(SimpleWorkspaceService.java:150)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
		at java.base/java.lang.reflect.Method.invoke(Unknown Source)
		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(Unknown Source)
		at java.base/java.util.concurrent.FutureTask.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 Rewrite folks have changed the recipe to work only if request method parameter is specified. The justification is that if method not specified the request matches all types which means it cannot be converted to @GetMapping... Hmm... I was under the impression that default method is GET...

@BoykoAlex
Copy link
Contributor

Fixed with 5b49715 - only flag @RequestMapping with single request method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants