groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abosch <arturbo...@gmx.de>
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.:

@CompileStatic
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>();
...
}

greets



--
View this message in context: http://groovy.329449.n5.nabble.com/Undeclared-type-variable-T-when-calling-a-method-from-a-class-with-a-trait-from-java-tp5734382p5734393.html
Sent from the Groovy Users mailing list archive at Nabble.com.

Mime
View raw message