When import-term is used (directly or indirectly) by the testing plugin, it can not find the requested file.

When I try to test a strategy that, for example, uses import-term for pretty printing to SDF, I get import-term failed for Sdf2.pp.af, while the same strategy works fine when executing it from a strategy invoked through the transform menu of the plugin-under-test. (The file Sdf2.pp.af lives in the root dir of that project.)

Attempting to call import-term adds the following error in the error log:


Problem evaluating strategy for testing

org.spoofax.interpreter.core.InterpreterException: import-term failed for one.aterm
at org.spoofax.interpreter.stratego.ImportTerm.eval(ImportTerm.java:42)
at org.spoofax.interpreter.stratego.Strategy.evaluate(Strategy.java:76)
at org.spoofax.interpreter.core.Interpreter.evaluate(Interpreter.java:106)
at org.spoofax.interpreter.core.Interpreter.evaluate(Interpreter.java:99)
at org.strategoxt.HybridInterpreter.evaluate(HybridInterpreter.java:396)
at org.strategoxt.HybridInterpreter.evaluate(HybridInterpreter.java:414)
at org.strategoxt.imp.testing.strategies.plugin_strategy_evaluate_1_2.invoke(plugin_strategy_evaluate_1_2.java:35)
at trans.check_warning_0_0.invoke(check_warning_0_0.java:287)
at org.strategoxt.stratego_lib.i_154.invoke(i_154.java)
at org.strategoxt.lang.SRTS_EXT_crush_3_0.invoke(SRTS_EXT_crush_3_0.java:28)
at org.strategoxt.lang.compat.override.performance_tweaks.foldr_3_0_override.invoke(foldr_3_0_override.java)
at org.strategoxt.stratego_lib.i_154.invoke(i_154.java)
at org.strategoxt.lang.SRTS_EXT_crush_3_0.invoke(SRTS_EXT_crush_3_0.java:28)
at org.strategoxt.lang.compat.override.performance_tweaks.foldr_3_0_override.invoke(foldr_3_0_override.java)
at org.strategoxt.stratego_lib.i_154.invoke(i_154.java)
at org.strategoxt.stratego_lib.collect_all_2_0.invoke(collect_all_2_0.java)
at trans.lifted38.invoke(lifted38.java:116)
at trans.lifted1.invoke(lifted1.java:75)
at org.strategoxt.stratego_lib.dr_scope_1_1.invoke(dr_scope_1_1.java)
at trans.lifted0.invoke(lifted0.java:40)
at org.strategoxt.stratego_lib.dr_scope_1_1.invoke(dr_scope_1_1.java)
at trans.scope_paths_1_2.invoke(scope_paths_1_2.java:39)
at trans.editor_analyze_0_0.invoke(editor_analyze_0_0.java:136)
at org.strategoxt.lang.Strategy.invokeDynamic(Strategy.java:30)
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.spoofax.interpreter.core.Interpreter.evaluate(Interpreter.java:106)
at org.spoofax.interpreter.core.Interpreter.invoke(Interpreter.java:80)
at org.strategoxt.HybridInterpreter.invoke(HybridInterpreter.java:379)
at org.strategoxt.imp.runtime.services.StrategoObserver.invoke(StrategoObserver.java:506)
at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:547)
at org.strategoxt.imp.runtime.services.StrategoObserver.update(StrategoObserver.java:324)
at org.strategoxt.imp.runtime.services.StrategoObserverUpdateJob.analyze(StrategoObserverUpdateJob.java:30)
at org.strategoxt.imp.runtime.services.StrategoAnalysisQueue$UpdateJob.run(StrategoAnalysisQueue.java:88)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.io.FileNotFoundException: …/spoofax-imp/org.strategoxt.imp.testing/one.aterm not specified as an attachment in editor service plugin
at org.strategoxt.imp.runtime.dynamicloading.Descriptor.getAttachmentPath(Descriptor.java:384)
at org.strategoxt.imp.runtime.dynamicloading.Descriptor.openAttachment(Descriptor.java:351)
at org.strategoxt.imp.runtime.dynamicloading.Descriptor.openAttachment(Descriptor.java:356)
at org.strategoxt.imp.runtime.dynamicloading.Descriptor.openAttachment(Descriptor.java:341)
at org.strategoxt.imp.runtime.stratego.EditorIOAgent.openAttachedFile(EditorIOAgent.java:64)
at org.strategoxt.imp.runtime.stratego.EditorIOAgent.openInputStream(EditorIOAgent.java:56)
at org.spoofax.interpreter.stratego.ImportTerm.eval(ImportTerm.java:39)
… 35 more

So it looks like import-term looks in the testing plugin instead of in the plugin-under-test.

Submitted by Tobi Vollebregt on 18 March 2011 at 17:23

On 21 March 2011 at 14:55 Lennart Kats commented:

I had a brief look at the code, and it looks like there’s two problems that can cause this: 1) StrategoObserver.configureRuntime() is never called by plugin_strategy_evaluate_1_2 and 2) the code reassigns the IOAgent of the observer’s interpreter, so if EditorIOAgent.getDescriptor() is called it would return the testing language descriptor and try to find the attachment there. Unfortunately I don’t really have the time to really change and debug this atm.


On 21 March 2011 at 15:03 Lennart Kats tagged 1.0

On 21 March 2011 at 15:03 Lennart Kats tagged testing

On 4 April 2011 at 09:46 Lennart Kats commented:

Alright, I changed the way the observer is initialized in r22476. Let me know if that fixes your problem.


On 4 April 2011 at 12:04 Tobi Vollebregt closed this issue.

On 4 April 2011 at 12:04 Tobi Vollebregt commented:

That works, thanks!


On 28 December 2011 at 13:15 Lennart Kats tagged @lennartkats

Log in to post comments