ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject Re: AW: a problem compiling a Java 5 project with generics
Date Wed, 18 Oct 2006 14:20:41 GMT
The original code may be slightly incorrect (my understanding
of java generics is not high).

Test1.java is defined as:
public class Test1<T extends Base> {
       public class Inner1 {
               protected T v;
               public Inner1(T v) {this.v = v;}
               public T getV() {return this.v;}
       }
       public Inner1 getInner(T v) {return new Inner1(v);}
}

It could also be defined as:
package test;
public class Test1<T extends Base> {
       public class Inner1<T extends Base> {
               protected T v;
               public Inner1(T v) {this.v = v;}
               public T getV() {return this.v;}
       }
       public Inner1 getInner(T v) {return new Inner1<T>(v);}
}

The second definition makes the Inner1 class explictlly be a generic class,
Test2 then is:
package test;
public class Test2<T extends Base> extends Test1<T> {
       public class Inner2 extends Inner1<T> {
               public Inner2(T v) {super(v);}
       }
}

and Test3 is unchanged.

In this case, compilation works fine.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message