vscode-as3mxml
vscode-as3mxml copied to clipboard
compiler bug: NullPointerException in LexicalScope.getNameFromDefinition()
moving the information to a new issue to prevent cluttering the previous one 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)
from what i can understand the code seems to fail only on specific "functions" in a class
and the class in question has 4 levels of inheritence.
public function enterLocation():void {
clearGameText();
if ((flags[kFLAGS.LOCATION_FLAG1] < 2 && flags[kFLAGS.LOCATION_FLAG1] >= 25) || (flags[kFLAGS.LOCATION_FLAG1] < 3 && flags[kFLAGS.LOCATION_FLAG1] >= 50) || (flags[kFLAGS.LOCATION_FLAG1] < 4 && flags[kFLAGS.LOCATION_FLAG1] >= 75)) {
EnterTransition();
return;
}
inLocation = true;
outputText("You Find your self in Location X");
doNext(roomEntrance);
}
What i find really weird is it thinks
public static var inLocation:Boolean = false;
is read only. that variable is defined in the parent of the class containing that function
@jfmherokiller Thanks for moving to a new issue!
Inside the compiler code, it's failing on trying to handle assignment to a getter/setter property. It has a reference to the getter, and it's trying to find the matching setter. Unfortunately, it doesn't find setter, so that results in a NullReference exception being thrown.
Could there be any getters or setters in your codebase named inLocation? Or maybe there's some [Bindable] metadata on inLocation?
Relatedly, what makes you think that it's inLocation in particular? Does the exception go away when you remove inLocation, or is there some other clue?
well I was guessing inlocation because thats the only line that succeds before it throws that large block of errors
the whole null pointer exception disappeared when i added a setter to the code
Can you post the code for the setter that you added that made the exception go away?
sure
protected function set inLocation(v:Boolean):void
{
LocationAbstractContent.inLocation = v;
}
does that help?
Did you already have a getter named inLocation too? Or was there only the static variable?
i already had a getter the setter was commented out in the past for some reason yet the code would still work.
Okay, thanks. That does indeed help. The compiler seems to be getting confused because you have two different inLocation
fields. A static variable and a non-static getter. Internally, it's doing two different things with your code. First, it validates that something with that name may be set, and second, it generates the bytecode. The validation step decides that the static variable is being set, but it appears that the bytecode step decides that the non-static property is being set instead. The bug in the compiler is that they should both be picking the same inLocation.
I'll see what I can do. It may be a while before any fix makes it into vscode-as3mxml, since this needs to be fixed in an upstream project first.
ok still im happy to help well get your code off the ground.
if there was something i wish was easier, in flash I wish the accessability functions would work correctly.