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

Long if-then-else statement crashes language server #669

Open
SimonCockx opened this issue Oct 11, 2023 · 3 comments
Open

Long if-then-else statement crashes language server #669

SimonCockx opened this issue Oct 11, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@SimonCockx
Copy link
Contributor

SimonCockx commented Oct 11, 2023

A long if-then-else expression can results in a null pointer in the generated ANTRL parser, which causes the language server to crash.

Stacktrace:

java.util.concurrent.CompletionException: java.lang.NullPointerException: parseResult is null
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:332)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:347)
	at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:708)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
	at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2162)
	at org.eclipse.xtext.ide.server.concurrent.AbstractRequest.logAndCompleteExceptionally(AbstractRequest.java:73)
	at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$doRun$0(ReadRequest.java:69)
	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.NullPointerException: parseResult is null
	at org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory.create(ContentAssistContextFactory.java:130)
	at org.eclipse.xtext.ide.server.contentassist.ContentAssistService.createProposals(ContentAssistService.java:104)
	at org.eclipse.xtext.ide.server.contentassist.ContentAssistService.createCompletionList(ContentAssistService.java:78)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$completion$23(LanguageServerImpl.java:554)
	at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:438)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.completion(LanguageServerImpl.java:553)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$completion$22(LanguageServerImpl.java:539)
	at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$doRun$0(ReadRequest.java:66)

Reproduce: create an if-then-else expression having 30+ branches.

@SimonCockx SimonCockx added the bug Something isn't working label Oct 11, 2023
@SimonCockx
Copy link
Contributor Author

@SimonCockx
Copy link
Contributor Author

Potential solutions:

@SimonCockx
Copy link
Contributor Author

SimonCockx commented Oct 20, 2023

Since #671, the language server will fail more gracefully by giving back a diagnostic to the user.

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

1 participant