Description
SomeTrait.groovy
trait SomeTrait {
int getMagicNumber() {
42
}
}
SomeClass.groovy
class SomeClass implements SomeTrait { static magicNumber = 'Forty Two' }
$ groovyc SomeClass.groovy org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: SomeClass.groovy: 1: Can't have an abstract method in a non-abstract class. The class 'SomeClass' must be declared abstract or the method 'int getMagicNumber()' must be implemented. @ line 1, column 1. class SomeClass implements SomeTrait { ^ 1 error trait $ groovy -version Groovy Version: 2.3.3 JVM: 1.7.0_45 Vendor: Oracle Corporation OS: Mac OS X
If the code that adds the trait method figures out that it can't or won't add the method, it seems like the system should have enough context at that point to report why and give the user better feedback.
Attachments
Issue Links
- relates to
-
GROOVY-7520 Improve unimplemented message for abstract methods
- Closed