0

I encountered what appeared to be an instance of eclipse Bug 380313 which is marked as fixed. My grammar is the following:

grammar org.xtext.example.hyrule.HyRule with org.eclipse.xtext.common.Terminals
//  with org.eclipse.xtext.xbase.Xbase  

generate hyRule "http://www.xtext.org/example/hyrule/HyRule"

Start:
    rules+=Rule*;

Rule:
    'FOR' 'PAYLOAD' PAYLOAD 'ELEMENTS' elements+=ID+ 'CONSTRAINED''BY'name=ID '!';

PAYLOAD:
    "sse"| "stacons"
;

Which works fine, and with which code generation editor etc. all work. However as soon as I change

with org.eclipse.xtext.common.Terminals

to

with org.eclipse.xtext.xbase.Xbase

And fire up the generated IDE I get the Inconsistent stackmap frames at branch target error exactly as detaied in Bug 380313, as a result of which code generation and auto completion no longer work.

If I change the complier compliance level to 1.6, the Inconsistent stackmap frames at branch target error goes away, and auto completion works, but the code generation still doens't work (no code is generated in src-gen).

I am using Xtext 2.3 installed from scratch, and java 7. The build path for the xtext project is unmodified, and I've added the org.eclipse.xtext.xbase.lib_2.3.0.v201206120633.jar to the build path of the DSL project (i.e. the one in the eclipse instance launched at runtime).

Any help would be much appreciated, I have been racking my brains trying to find the problem.

UPDATE: In the example above I was using the generator.xtend to generate code. If instead I use the JvmModelInferrer, then with compliance set to 1.7 I still get the error mentioned above, and autocompletion is completely broken, but code generation actually works. And of course in this case too, setting compliance level to 1.6 everything works fine. But surely I should be able to use the generator instead of the JvmModelInferrer, and not have to set the compiler compliance level t 1.6?

Marcus Mathioudakis
  • 837
  • 1
  • 6
  • 19
  • Which Eclipse version do you use? – Sebastian Zarnekow Jul 02 '12 at 12:20
  • Eclipse Java EE IDE for Web Developers. Version: Indigo Service Release 2 Build id: 20120216-1857 Release 3.7.2 – Marcus Mathioudakis Jul 02 '12 at 12:29
  • @SebastianZarnekow added an update to the question to make the problem clearer. – Marcus Mathioudakis Jul 02 '12 at 13:45
  • 1
    The bug in Eclipse's Java compiler was fixed in Eclipse 3.8. I'm afraid you have to upgrade your distribution to the Juno release or stick with Java 1.6. – Sebastian Zarnekow Jul 02 '12 at 16:11
  • @SebastianZarnekow thanks for your continuing help, I have installed the Juno release, and the stackframe error is solved :)! However it seems impossible to test if code generation using the generator.xtend still works as it is instead only using the ModelInferrer. if I comment out all the ModelInferrers code, nothing gets generated, so it seem that the generator.xtend generated class is not getting called. How can I get it to invoke the generator.xtend instead of the ModelInferrer, so that I can test code generation? Also please post your comment as an answer so that I can accept it, thanks! – Marcus Mathioudakis Jul 03 '12 at 13:21
  • @SebastianZarnekow Figured out how to use generator instead of modelInferrer with xbase, just need to overwrite the bindIGenerator() method in the runtime module. So I'm sorted! Many thanks and please do add your comment as an answer so that I can accept it, cheers – Marcus Mathioudakis Jul 03 '12 at 16:14

1 Answers1

1

Sebastian Zarnekow: The bug in Eclipse's Java compiler was fixed in Eclipse 3.8. I'm afraid you have to upgrade your distribution to the Juno release or stick with Java 1.6.

Marcus Mathioudakis
  • 837
  • 1
  • 6
  • 19