andresteingress / gcontracts

GContracts: Programming by Contract for Groovy
http://gcontracts.org
114 stars 11 forks source link

Can't compile groovy trait with gcontracts #51

Open Gary-Shurgin opened 8 years ago

Gary-Shurgin commented 8 years ago

When I attempt to compile a groovy trait, I get the following error:

Groovy:Method '$_gc_computeOldVariables' is protected but should be public in interface '{class}'

I get this message whether I include any gcontract annotations in the trait.

tvinke commented 8 years ago

I have the same! It's been quite a while ago already when this bug has been opened. Any news?

zman0900 commented 7 years ago

Same problem here with latest 1.2.12. Sticking with gcontracts <= 1.2.9 "fixes" the problem.

During groovy compile I get two errors:

Error occurred while calling a method on a Groovy class from classpath.: InvocationTargetException: startup failed:
[ERROR] {my-trait}.groovy: -1: Method '$_gc_computeOldVariables' is protected but should be public in trait '{my-trait}'.
[ERROR]  @ line -1, column -1.
[ERROR] {my-class-implementing-several-traits}.groovy: -1: The method $_gc_computeOldVariables should be public as it implements the corresponding method from interface {my-other-trait}
[ERROR] . At [-1:-1]  @ line -1, column -1.

{my-class-implementing-several-traits} implements 5 traits, the errors above mention two of those traits. This error has been happening for a long time, and continues to happen with the latest groovy 2.4.11 and either Java 7 or 8.