Skip to content

Error reported on subclass of a class implementing trait #673

@mauromol

Description

@mauromol

Consider the following:

package test30

import groovy.transform.CompileStatic

@CompileStatic
trait T {
	String getFoo() { 'foo' }
}
package test30

import groovy.transform.CompileStatic

@CompileStatic
class A implements T {
}
package test30

import groovy.transform.CompileStatic

@CompileStatic
class B extends A {
}

And:

package test30

import groovy.transform.CompileStatic

@CompileStatic
class Test30 {

	static void main(args) {
		println new B().foo
	}

}

Greclipse is reporting an error on B:

Groovy:Can't have an abstract method in a non-abstract class. The class 'test30.B' must be declared abstract or the method 'java.lang.String getFoo()' must be implemented.

I don't expect this error. Also, the Groovy compiler seems to compile this code and if I run Test30 I get the expected result.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions