groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abosch <>
Subject Re: Undeclared type variable: T when calling a method from a class with a trait from java
Date Mon, 01 Aug 2016 09:36:17 GMT
The groovy version is 2.4.6 and java is 1.8.0_92 (Oracle).

If i use more than one trait in a class and call its methods from within
java, I get the same error message.

Then i removed multiple traits and only used one with @Delegate. This is
possible in Java, when there is no generic type in the trait e.g.:

trait RecursiveDirectoryEntity extends Entity {

	DirectoryEntity successor;
	final List<DirectoryEntity> subEntities = new ArrayList<>();

This is allowed, but that not:

trait RecursiveEntity<T extends RecursiveEntity<T>> extends Entity {
	T successor;
	final List<T> subEntities = new ArrayList<T>();


View this message in context:
Sent from the Groovy Users mailing list archive at

View raw message