You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a tape that seems to be incompatible with Betamax.
This tape generates the following error in Java 6 -
| betamax.tape.TapeLoadException: Invalid tape
at betamax.tape.yaml.YamlTape.readFrom(YamlTape.groovy:34)
at betamax.tape.yaml.YamlTapeLoader.loadTape_closure1(YamlTapeLoader.groovy:37)
But in Java 7 it gives an incompatible runtime exception -
Failure: search returns correct information(com.kickscraper.ScrapeServiceSpec)
| java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.RuntimeException do not match. Expected 4 but got 5
at betamax.tape.yaml.YamlTape.readFrom(YamlTape.groovy:34)
at betamax.tape.yaml.YamlTapeLoader.loadTape_closure1(YamlTapeLoader.groovy:37)
See URL attached on issue 52 for url that is breaking
The text was updated successfully, but these errors were encountered:
All you need to do to fix that is to write your exceptions in java - there was a new constructor added to Exception in JDK7 which currupts Groovy metadata about them. If you write them in java then groovy won't touch them and the problem will be solved.
Does that mean it's no longer possible to write new exceptions in Groovy? Does anyone reading this know what version of Groovy will solve that problem?
You can write your exceptions in Groovy, the problem is that you cannot run Groovy exceptions compiled with JDK6 on JDK7 and you cannot run Groovy exceptions compiled with JDK7 on JDK6. It's pretty well explained why in my blog post. I have no idea why Groovy inspects the number of constructors on classes during compilation and checks if it is still the same during runtime and if/when this could change. You should probably raise that on Groovy user or dev mailing list.
Agreed. My app needs to run in Java 6 and 7, and I don't want to make separate releases for them, so rewriting all my custom exceptions in Java seems like the best workaround for now. However, this limitation of Groovy seems like a significant problem, so hopefully a future version will address it. Thanks for your blog post on the subject.
I have a tape that seems to be incompatible with Betamax.
This tape generates the following error in Java 6 -
| betamax.tape.TapeLoadException: Invalid tape
at betamax.tape.yaml.YamlTape.readFrom(YamlTape.groovy:34)
at betamax.tape.yaml.YamlTapeLoader.loadTape_closure1(YamlTapeLoader.groovy:37)
But in Java 7 it gives an incompatible runtime exception -
Failure: search returns correct information(com.kickscraper.ScrapeServiceSpec)
| java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for java.lang.RuntimeException do not match. Expected 4 but got 5
at betamax.tape.yaml.YamlTape.readFrom(YamlTape.groovy:34)
at betamax.tape.yaml.YamlTapeLoader.loadTape_closure1(YamlTapeLoader.groovy:37)
See URL attached on issue 52 for url that is breaking
The text was updated successfully, but these errors were encountered: