NullPointerException on single element in annotation
harvest-types: e@Expression(Assign(Identifier(x), type)) -> e {error} with if <debug(!4); IdentifierType; debug(!5)> x; not(?type) then error := "error" else rules ( IdentifierType : x -> <resolve-to-type> type ) end
Error log:
java.lang.NullPointerException
Submitted on 22 June 2010 at 15:44
at org.spoofax.interpreter.stratego.Build.buildAnno(Build.java:283)
at org.spoofax.interpreter.stratego.Build.buildTerm(Build.java:56)
at org.spoofax.interpreter.stratego.Build.eval(Build.java:42)
at org.spoofax.interpreter.stratego.Strategy.evaluate(Strategy.java:96)
at org.spoofax.interpreter.stratego.SDefT.evaluate(SDefT.java:170)
at org.strategoxt.lang.InteropStrategy.invokeDynamic(InteropStrategy.java:55)
at org.strategoxt.lang.DynamicStrategy.invoke(DynamicStrategy.java:22)
at org.strategoxt.stratego_lib.m_135.invoke(m_135.java:26)
at org.strategoxt.lang.SRTS_all.map(SRTS_all.java:60)
at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:21)
at org.strategoxt.stratego_lib.m_135.invoke(m_135.java:32)
at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28)
at org.strategoxt.stratego_lib.m_135.invoke(m_135.java:32)
at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28)
at org.strategoxt.stratego_lib.m_135.invoke(m_135.java:32)
at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28)
at org.strategoxt.stratego_lib.m_135.invoke(m_135.java:32)
at org.strategoxt.lang.SRTS_all.mapMaintainAnnos(SRTS_all.java:101)
at org.strategoxt.lang.SRTS_all.mapMaintainAnnos(SRTS_all.java:108)
at org.strategoxt.lang.SRTS_all.map(SRTS_all.java:66)
at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:21)
at org.strategoxt.stratego_lib.m_135.invoke(m_135.java:32)
at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28)
at org.strategoxt.stratego_lib.m_135.invoke(m_135.java:32)
at org.strategoxt.lang.SRTS_all.mapMaintainAnnos(SRTS_all.java:101)
at org.strategoxt.lang.SRTS_all.mapMaintainAnnos(SRTS_all.java:108)
at org.strategoxt.lang.SRTS_all.mapMaintainAnnos(SRTS_all.java:108)
at org.strategoxt.lang.SRTS_all.mapMaintainAnnos(SRTS_all.java:108)
at org.strategoxt.lang.SRTS_all.map(SRTS_all.java:66)
at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:21)
at org.strategoxt.stratego_lib.m_135.invoke(m_135.java:32)
at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28)
at org.strategoxt.stratego_lib.m_135.invoke(m_135.java:32)
at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28)
at org.strategoxt.stratego_lib.m_135.invoke(m_135.java:32)
at org.strategoxt.stratego_lib.alltd_1_0.invoke(alltd_1_0.java:24)
at org.strategoxt.lang.Strategy.invokeDynamic(Strategy.java:40)
at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:194)
at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:185)
at org.strategoxt.lang.InteropSDefT$StrategyBody.evaluate(InteropSDefT.java:247)
at org.strategoxt.lang.InteropSDefT$StrategyBody.eval(InteropSDefT.java:240)
at org.spoofax.interpreter.stratego.Strategy.evaluate(Strategy.java:96)
at org.spoofax.interpreter.core.Interpreter.invoke(Interpreter.java:69)
at org.strategoxt.HybridInterpreter.invoke(HybridInterpreter.java:348)
at org.strategoxt.imp.runtime.Environment$1.invoke(Environment.java:189)
at org.strategoxt.imp.runtime.services.StrategoObserver.invoke(StrategoObserver.java:552)
at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:591)
at org.strategoxt.imp.runtime.services.StrategoObserver.update(StrategoObserver.java:286)
at org.strategoxt.imp.runtime.services.StrategoObserverUpdateJob.analyze(StrategoObserverUpdateJob.java:29)
at org.strategoxt.imp.runtime.services.StrategoAnalysisQueue$UpdateJob.runInternal(StrategoAnalysisQueue.java:85)
at org.strategoxt.imp.runtime.services.StrategoAnalysisQueue$UpdateJob.run(StrategoAnalysisQueue.java:70)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Issue Log
(issue was reported by Danny)
This issue should be fixed in 0.5.1 (released today). Note that your rule only assigns the
error
annotation in theelse
branch: the rule will fail iferror
is not set.What you could also try if you don’t want it to fail for the
else
case:
harvest-types:
e@Expression(Assign(Identifier(x), type)) -> e {error*}
with
if <debug(!4); IdentifierType; debug(!5)> x; not(?type) then
error* := [“error”]
else
error* := [];
rules (
IdentifierType : x -> type
)
end
Log in to post comments