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

Code hovering crash: NullPointerException in NamespaceDefinition$NamespaceDirectiveResolver.addResolvedUsedNamespace() #467

Open
jnpatrick99 opened this issue Apr 11, 2020 · 15 comments

Comments

@jnpatrick99
Copy link

jnpatrick99 commented Apr 11, 2020

I have the new problem. Started after one of the recent updates. I get around 20-30 errors on the Output while Cmd+hovering over keywords. Using version 1.1.1 on macOS 10.14.6, Apache Royale 0.9.6 (swf/js) and Java 1.8.0_201-b09 (latest update from Oracle).

Mostly happens inside .mxml files.

Apr 11, 2020 2:37:18 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError
SEVERE: Internal error: java.lang.NullPointerException
java.util.concurrent.CompletionException: java.lang.NullPointerException
	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:604)
	at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
	at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.addResolvedUsedNamespace(NamespaceDefinition.java:2213)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$UseNamespaceDirective.resolveDirective(NamespaceDefinition.java:1785)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.resolveNamespaceReferenceInDirective(NamespaceDefinition.java:1877)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.resolveNamespaceReferenceInDirective(NamespaceDefinition.java:1834)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$UseNamespaceDirective.resolveNamespaceReference(NamespaceDefinition.java:1792)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetImpl(ASScope.java:552)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.getNamespaceSet(ASScopeCache.java:420)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSet(ASScope.java:515)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetForNameImpl(ASScope.java:484)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.getNamespaceSetForName(ASScopeCache.java:614)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetForName(ASScope.java:447)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.findProperty(ASScopeCache.java:167)
	at org.apache.royale.compiler.internal.scopes.ASScope.findProperty(ASScope.java:1428)
	at org.apache.royale.compiler.internal.tree.as.IdentifierNode.resolve(IdentifierNode.java:383)
	at com.as3mxml.vscode.utils.DefinitionUtils.resolveWithExtras(DefinitionUtils.java:204)
	at com.as3mxml.vscode.providers.DefinitionProvider.actionScriptDefinition(DefinitionProvider.java:135)
	at com.as3mxml.vscode.providers.DefinitionProvider.definition(DefinitionProvider.java:117)
	at com.as3mxml.vscode.ActionScriptServices.lambda$definition$3(ActionScriptServices.java:441)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
	... 5 more

[Error - 2:37:18 PM] Request textDocument/definition failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.NullPointerException
	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:604)
	at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
	at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.addResolvedUsedNamespace(NamespaceDefinition.java:2213)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$UseNamespaceDirective.resolveDirective(NamespaceDefinition.java:1785)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.resolveNamespaceReferenceInDirective(NamespaceDefinition.java:1877)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.resolveNamespaceReferenceInDirective(NamespaceDefinition.java:1834)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$UseNamespaceDirective.resolveNamespaceReference(NamespaceDefinition.java:1792)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetImpl(ASScope.java:552)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.getNamespaceSet(ASScopeCache.java:420)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSet(ASScope.java:515)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetForNameImpl(ASScope.java:484)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.getNamespaceSetForName(ASScopeCache.java:614)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetForName(ASScope.java:447)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.findProperty(ASScopeCache.java:167)
	at org.apache.royale.compiler.internal.scopes.ASScope.findProperty(ASScope.java:1428)
	at org.apache.royale.compiler.internal.tree.as.IdentifierNode.resolve(IdentifierNode.java:383)
	at com.as3mxml.vscode.utils.DefinitionUtils.resolveWithExtras(DefinitionUtils.java:204)
	at com.as3mxml.vscode.providers.DefinitionProvider.actionScriptDefinition(DefinitionProvider.java:135)
	at com.as3mxml.vscode.providers.DefinitionProvider.definition(DefinitionProvider.java:117)
	at com.as3mxml.vscode.ActionScriptServices.lambda$definition$3(ActionScriptServices.java:441)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
	... 5 more
@joshtynjala
Copy link
Member

Looks like a bug in Royale. I'll see if I can reproduce, but I might need your help with that.

@joshtynjala
Copy link
Member

@jnpatrick99 I tried Ctrl+click and Ctrl+hover on various keywords inside an MXML script block in a Royale project (like private, var, function, if, and for), but unfortunately, I could not reproduce this issue.

You may need to share some code with me that can consistently reproduce the issue.

@jfmherokiller
Copy link

I am having a similar issue but its instead with the checker itself.

java.lang.NullPointerException
	at org.apache.royale.compiler.internal.as.codegen.LexicalScope.getNameFromDefinition(LexicalScope.java:1178)
	at org.apache.royale.compiler.internal.as.codegen.LexicalScope.getBinding(LexicalScope.java:1069)
	at org.apache.royale.compiler.internal.as.codegen.ABCGeneratingReducer.generateAssignment(ABCGeneratingReducer.java:1408)
	at org.apache.royale.compiler.internal.as.codegen.ABCGeneratingReducer.generateAssignment(ABCGeneratingReducer.java:1311)
	at org.apache.royale.compiler.internal.as.codegen.ABCGeneratingReducer.reduce_assignToNameExpr_to_void_expression(ABCGeneratingReducer.java:2950)
	at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.action_237(CmcEmitter.java:4451)
	at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.dispatchAction(CmcEmitter.java:8067)
	at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduceAntecedent(CmcEmitter.java:39127)
	at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.dispatchAction(CmcEmitter.java:9362)
	at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduceAntecedent(CmcEmitter.java:39127)
	at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduce(CmcEmitter.java:39104)
	at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduceSubgoals(CmcEmitter.java:39155)
	at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduceAntecedent(CmcEmitter.java:39126)
	at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduce(CmcEmitter.java:39104)
	at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduceSubgoals(CmcEmitter.java:39146)
	at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduceAntecedent(CmcEmitter.java:39126)
	at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduce(CmcEmitter.java:39104)
	at org.apache.royale.compiler.internal.as.codegen.CmcEmitter.burm(CmcEmitter.java:39406)
	at org.apache.royale.compiler.internal.as.codegen.ABCGenerator.generateInstructions(ABCGenerator.java:233)
	at org.apache.royale.compiler.internal.as.codegen.ABCGenerator.generateMethodBodyForFunction(ABCGenerator.java:398)
	at org.apache.royale.compiler.internal.as.codegen.ABCGenerator.generateMethodBodyForFunction(ABCGenerator.java:352)
	at org.apache.royale.compiler.internal.as.codegen.ABCGenerator.generateFunction(ABCGenerator.java:267)
	at org.apache.royale.compiler.internal.as.codegen.ClassDirectiveProcessor.declareFunction(ClassDirectiveProcessor.java:895)
	at org.apache.royale.compiler.internal.as.codegen.DirectiveProcessor.processNode(DirectiveProcessor.java:218)
	at org.apache.royale.compiler.internal.as.codegen.DirectiveProcessor.traverse(DirectiveProcessor.java:192)
	at org.apache.royale.compiler.internal.as.codegen.GlobalDirectiveProcessor.declareClass(GlobalDirectiveProcessor.java:460)
	at org.apache.royale.compiler.internal.as.codegen.DirectiveProcessor.processNode(DirectiveProcessor.java:210)
	at org.apache.royale.compiler.internal.as.codegen.DirectiveProcessor.traverse(DirectiveProcessor.java:192)
	at org.apache.royale.compiler.internal.as.codegen.GlobalDirectiveProcessor.declarePackage(GlobalDirectiveProcessor.java:486)
	at org.apache.royale.compiler.internal.as.codegen.DirectiveProcessor.processNode(DirectiveProcessor.java:227)
	at org.apache.royale.compiler.internal.as.codegen.DirectiveProcessor.traverse(DirectiveProcessor.java:192)
	at org.apache.royale.compiler.internal.as.codegen.ABCGenerator.generate(ABCGenerator.java:124)
	at org.apache.royale.compiler.internal.units.ASCompilationUnit.handleABCBytesRequest(ASCompilationUnit.java:394)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase.processABCBytesRequest(CompilationUnitBase.java:876)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase.access$300(CompilationUnitBase.java:109)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase$4$1.call(CompilationUnitBase.java:313)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase$4$1.call(CompilationUnitBase.java:309)
	at org.apache.royale.compiler.internal.units.requests.RequestMaker$1.call(RequestMaker.java:228)
	at org.apache.royale.compiler.internal.units.requests.RequestMaker$1.call(RequestMaker.java:222)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy.rejectedExecution(ThreadPoolExecutor.java:2038)
	at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
	at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
	at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
	at org.apache.royale.compiler.internal.units.requests.RequestMaker.getRequest(RequestMaker.java:188)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase.getABCBytesRequest(CompilationUnitBase.java:624)
	at org.apache.royale.compiler.internal.units.ASCompilationUnit.handleOutgoingDependenciesRequest(ASCompilationUnit.java:476)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase.processOutgoingDependenciesRequest(CompilationUnitBase.java:892)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase.access$500(CompilationUnitBase.java:109)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase$6$1.call(CompilationUnitBase.java:388)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase$6$1.call(CompilationUnitBase.java:384)
	at org.apache.royale.compiler.internal.units.requests.RequestMaker$1.call(RequestMaker.java:228)
	at org.apache.royale.compiler.internal.units.requests.RequestMaker$1.call(RequestMaker.java:222)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy.rejectedExecution(ThreadPoolExecutor.java:2038)
	at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
	at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
	at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
	at org.apache.royale.compiler.internal.units.requests.RequestMaker.getRequest(RequestMaker.java:188)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase.getOutgoingDependenciesRequest(CompilationUnitBase.java:636)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase.startBuildAsync(CompilationUnitBase.java:1095)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase.startParsingImports(CompilationUnitBase.java:930)
	at org.apache.royale.compiler.internal.units.ASCompilationUnit.handleOutgoingDependenciesRequest(ASCompilationUnit.java:470)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase.processOutgoingDependenciesRequest(CompilationUnitBase.java:892)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase.access$500(CompilationUnitBase.java:109)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase$6$1.call(CompilationUnitBase.java:388)
	at org.apache.royale.compiler.internal.units.CompilationUnitBase$6$1.call(CompilationUnitBase.java:384)
	at org.apache.royale.compiler.internal.units.requests.RequestMaker$1.call(RequestMaker.java:228)
	at org.apache.royale.compiler.internal.units.requests.RequestMaker$1.call(RequestMaker.java:222)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

@joshtynjala
Copy link
Member

@jfmherokiller Yes, that appears to be a completely different issue. It isn't triggered by hover at all. It seems to be a bug in the compiler that powers code intelligence. Unfortunately, I probably won't be able to do much unless you can figure out the ActionScript code that causes that exception. I tried a few things based on what ABCGeneratingReducer.generateAssignment() is doing internally, but no luck reproducing here.

@joshtynjala joshtynjala changed the title Code hovering crash Code hovering crash: NullPointerException in NamespaceDefinition$NamespaceDirectiveResolver.addResolvedUsedNamespace() Aug 7, 2020
@anastasiuspernat
Copy link

I have the same problem here.

Is there a way to at least disable this error in Preferences so it wouldn't pop up infinitely? Thanks.

@joshtynjala
Copy link
Member

@anastasiuspernat Is your stack trace the same as the original report above? If it's different, can you share it? Thanks!

There's no way to disable the error because it's a bug. It's not intentionally being shown to you.

@anastasiuspernat
Copy link

Thanks! Here's the log.

Caused by: java.lang.NullPointerException
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.addResolvedUsedNamespace(NamespaceDefinition.java:2213)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$UseNamespaceDirective.resolveDirective(NamespaceDefinition.java:1785)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.resolveNamespaceReferenceInDirective(NamespaceDefinition.java:1877)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.resolveNamespaceReferenceInDirective(NamespaceDefinition.java:1834)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$UseNamespaceDirective.resolveNamespaceReference(NamespaceDefinition.java:1792)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetImpl(ASScope.java:592)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.getNamespaceSet(ASScopeCache.java:420)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSet(ASScope.java:555)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetForNameImpl(ASScope.java:524)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.getNamespaceSetForName(ASScopeCache.java:614)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetForName(ASScope.java:487)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.findProperty(ASScopeCache.java:167)
	at org.apache.royale.compiler.internal.scopes.ASScope.findProperty(ASScope.java:1468)
	at org.apache.royale.compiler.internal.tree.as.IdentifierNode.resolve(IdentifierNode.java:383)
	at com.as3mxml.vscode.utils.ASTUtils.findIdentifiersForDefinition(ASTUtils.java:399)
	at com.as3mxml.vscode.utils.ASTUtils.findIdentifiersForDefinition(ASTUtils.java:441)
	at com.as3mxml.vscode.utils.ASTUtils.findIdentifiersForDefinition(ASTUtils.java:441)
	at com.as3mxml.vscode.utils.ASTUtils.findIdentifiersForDefinition(ASTUtils.java:441)
	at com.as3mxml.vscode.utils.ASTUtils.findIdentifiersForDefinition(ASTUtils.java:441)
	at com.as3mxml.vscode.utils.ASTUtils.findIdentifiersForDefinition(ASTUtils.java:441)
	at com.as3mxml.vscode.utils.ASTUtils.findIdentifiersForDefinition(ASTUtils.java:441)
	at com.as3mxml.vscode.utils.ASTUtils.findIdentifiersForDefinition(ASTUtils.java:441)
	at com.as3mxml.vscode.utils.ASTUtils.findIdentifiersForDefinition(ASTUtils.java:441)
	at com.as3mxml.vscode.utils.ASTUtils.findIdentifiersForDefinition(ASTUtils.java:441)
	at com.as3mxml.vscode.providers.ReferencesProvider.referencesForDefinitionInCompilationUnit(ReferencesProvider.java:266)
	at com.as3mxml.vscode.providers.ReferencesProvider.referencesForDefinition(ReferencesProvider.java:238)
	at com.as3mxml.vscode.providers.ReferencesProvider.actionScriptReferences(ReferencesProvider.java:148)
	at com.as3mxml.vscode.providers.ReferencesProvider.references(ReferencesProvider.java:128)
	at com.as3mxml.vscode.ActionScriptServices.references2(ActionScriptServices.java:530)
	at com.as3mxml.vscode.ActionScriptServices.lambda$references$8(ActionScriptServices.java:516)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:616)
	... 5 more
  1. It starts randomly on the same file on the random part.
  2. It stops randomly on the same code where it happened before
  3. I tried many versions of royale including beta versions - didn't make a difference

When I simply click Ctrl there are hundreds of messages like this and the cursor gets focused on the Output pane constantly so it's impossible to edit code while this happening.

Is there a way to suppress the exception in com.as3mxml.vscode.utils.ASTUtils.findIdentifiersForDefinition?

@joshtynjala
Copy link
Member

@anastasiuspernat It looks like you're running the "Go to references" command. That's not usually the command that is triggered in VSCode by pressing the ctrl key and clicking. Are you sure that's the only stack trace that you have in your output? I would expect to see com.as3mxml.vscode.providers.DefinitionProvider.definition in the stack trace for an exception thrown from ctrl+click.

@joshtynjala
Copy link
Member

Hmm... I just discovered that if you run "Go to definition", and your cursor is already on the definition, VSCode automatically switches to "Go to references" instead.

@anastasiuspernat Could you share some code where you see this happening? Maybe a simple project with just one .as or .mxml, if possible?

@anastasiuspernat
Copy link

@joshtynjala Thanks for clarifying! Sorry the code's part of a gigantic project, when there's one/two/three files it does not happen. Also there are other exceptions.

I would really really vote to have a checkmark in Settings that suppresses all exceptions in the main code if that's possible. Thanks!

@anastasiuspernat
Copy link

Here's more exceptions:

Jul 29, 2021 3:29:25 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 1325
Jul 29, 2021 3:30:05 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 1372
...
...
...
Jul 29, 2021 4:33:23 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation
WARNING: Unmatched cancel notification for request id 2828
Jul 29, 2021 4:33:27 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError
SEVERE: Internal error: java.lang.NullPointerException
java.util.concurrent.CompletionException: java.lang.NullPointerException
	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:618)
	at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:591)
	at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:456)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.addResolvedUsedNamespace(NamespaceDefinition.java:2213)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$UseNamespaceDirective.resolveDirective(NamespaceDefinition.java:1785)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.resolveNamespaceReferenceInDirective(NamespaceDefinition.java:1877)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.resolveNamespaceReferenceInDirective(NamespaceDefinition.java:1834)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$UseNamespaceDirective.resolveNamespaceReference(NamespaceDefinition.java:1792)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetImpl(ASScope.java:592)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.getNamespaceSet(ASScopeCache.java:420)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSet(ASScope.java:555)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetForNameImpl(ASScope.java:524)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.getNamespaceSetForName(ASScopeCache.java:614)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetForName(ASScope.java:487)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.findProperty(ASScopeCache.java:167)
	at org.apache.royale.compiler.internal.scopes.ASScope.findProperty(ASScope.java:1468)
	at org.apache.royale.compiler.internal.tree.as.IdentifierNode.resolve(IdentifierNode.java:383)
	at com.as3mxml.vscode.utils.DefinitionUtils.resolveWithExtras(DefinitionUtils.java:173)
	at com.as3mxml.vscode.providers.HoverProvider.actionScriptHover(HoverProvider.java:140)
	at com.as3mxml.vscode.providers.HoverProvider.hover(HoverProvider.java:121)
	at com.as3mxml.vscode.ActionScriptServices.hover2(ActionScriptServices.java:368)
	at com.as3mxml.vscode.ActionScriptServices.lambda$hover$3(ActionScriptServices.java:354)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:616)
	... 5 more

Jul 29, 2021 4:33:27 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError
SEVERE: Internal error: java.lang.NullPointerException
java.util.concurrent.CompletionException: java.lang.NullPointerException
	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:618)
	at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:591)
	at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:456)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.addResolvedUsedNamespace(NamespaceDefinition.java:2213)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$UseNamespaceDirective.resolveDirective(NamespaceDefinition.java:1785)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.resolveNamespaceReferenceInDirective(NamespaceDefinition.java:1877)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.resolveNamespaceReferenceInDirective(NamespaceDefinition.java:1834)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$UseNamespaceDirective.resolveNamespaceReference(NamespaceDefinition.java:1792)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetImpl(ASScope.java:592)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.getNamespaceSet(ASScopeCache.java:420)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSet(ASScope.java:555)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetForNameImpl(ASScope.java:524)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.getNamespaceSetForName(ASScopeCache.java:614)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetForName(ASScope.java:487)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.findProperty(ASScopeCache.java:167)
	at org.apache.royale.compiler.internal.scopes.ASScope.findProperty(ASScope.java:1468)
	at org.apache.royale.compiler.internal.tree.as.IdentifierNode.resolve(IdentifierNode.java:383)
	at org.apache.royale.compiler.internal.tree.as.IdentifierNode.resolveType(IdentifierNode.java:458)
	at org.apache.royale.compiler.internal.tree.as.IdentifierNode.resolveMemberRef(IdentifierNode.java:877)
	at org.apache.royale.compiler.internal.tree.as.IdentifierNode.resolve(IdentifierNode.java:376)
	at com.as3mxml.vscode.utils.DefinitionUtils.resolveWithExtras(DefinitionUtils.java:173)
	at com.as3mxml.vscode.providers.HoverProvider.actionScriptHover(HoverProvider.java:140)
	at com.as3mxml.vscode.providers.HoverProvider.hover(HoverProvider.java:121)
	at com.as3mxml.vscode.ActionScriptServices.hover2(ActionScriptServices.java:368)
	at com.as3mxml.vscode.ActionScriptServices.lambda$hover$3(ActionScriptServices.java:354)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:616)
	... 5 more

[Error - 4:33:27 PM] Request textDocument/hover failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.NullPointerException
	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:618)
	at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:591)
	at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:456)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.addResolvedUsedNamespace(NamespaceDefinition.java:2213)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$UseNamespaceDirective.resolveDirective(NamespaceDefinition.java:1785)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.resolveNamespaceReferenceInDirective(NamespaceDefinition.java:1877)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$NamespaceDirectiveResolver.resolveNamespaceReferenceInDirective(NamespaceDefinition.java:1834)
	at org.apache.royale.compiler.internal.definitions.NamespaceDefinition$UseNamespaceDirective.resolveNamespaceReference(NamespaceDefinition.java:1792)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetImpl(ASScope.java:592)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.getNamespaceSet(ASScopeCache.java:420)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSet(ASScope.java:555)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetForNameImpl(ASScope.java:524)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.getNamespaceSetForName(ASScopeCache.java:614)
	at org.apache.royale.compiler.internal.scopes.ASScope.getNamespaceSetForName(ASScope.java:487)
	at org.apache.royale.compiler.internal.scopes.ASScopeCache.findProperty(ASScopeCache.java:167)
	at org.apache.royale.compiler.internal.scopes.ASScope.findProperty(ASScope.java:1468)
	at org.apache.royale.compiler.internal.tree.as.IdentifierNode.resolve(IdentifierNode.java:383)
	at org.apache.royale.compiler.internal.tree.as.IdentifierNode.resolveType(IdentifierNode.java:458)
	at org.apache.royale.compiler.internal.tree.as.IdentifierNode.resolveMemberRef(IdentifierNode.java:877)
	at org.apache.royale.compiler.internal.tree.as.IdentifierNode.resolve(IdentifierNode.java:376)
	at com.as3mxml.vscode.utils.DefinitionUtils.resolveWithExtras(DefinitionUtils.java:173)
	at com.as3mxml.vscode.providers.HoverProvider.actionScriptHover(HoverProvider.java:140)
	at com.as3mxml.vscode.providers.HoverProvider.hover(HoverProvider.java:121)
	at com.as3mxml.vscode.ActionScriptServices.hover2(ActionScriptServices.java:368)
	at com.as3mxml.vscode.ActionScriptServices.lambda$hover$3(ActionScriptServices.java:354)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:616)
	... 5 more

@joshtynjala
Copy link
Member

@anastasiuspernat Interesting! That's the first time I've seen someone report this error happening on mouse hover. Does it happen when you hover over anything, or is it a specific symbol in your code? (such as a particular class, property, or method name?)

@anastasiuspernat
Copy link

@joshtynjala it starts when I click ctrl over random keywords and after that it's happening constantly. The problem is that ctrl is bound to other keyboard shortcuts so every time I hit ctrl I get tons of messaging in the Output, and it gets focused.

@joshtynjala
Copy link
Member

I was finally able to reproduce this issue. I did it with following .mxml file in a Flex project, and Ctrl+click with the mouse over what.

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
	xmlns:s="library://ns.adobe.com/flex/spark"
	xmlns:mx="library://ns.adobe.com/flex/mx">
	<fx:Script>
		<![CDATA[
			use namespace mx.core.mx_internal;

			use namespace what;
		]]>
	</fx:Script>
</s:WindowedApplication>

@joshtynjala
Copy link
Member

apache/royale-compiler@e6e2878

The fix will be included in vscode-as3mxml after a new release of Apache Royale happens.

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

4 participants