Hi

For some reason, the mailing server included only the first
attachment. Since this is the fourth or the fifth time I am trying to
send the java files, I give up. I'll inline them in the message.

// src/test/Base.java
package test;
public class Base {}


// src/test/Sub.java
package test;
public class Sub extends Base {}

// src/test/Test1.java
package test;
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);}     
}

// src/test/Test2.java
package test;
public class Test2<T extends Base> extends Test1<T> {
        public class Inner2 extends Inner1 {
                public Inner2(T v) {super(v);}          
                //public T getV() {return this.v;}
        }
}

// src/test/Test3.java
package test;
public class Test3 extends Test2<Sub> {
        public class Inner3 extends Inner2 {
                public Inner3(Sub v) {super(v);}
                public Sub p() {return this.getV();}
        }

        public Inner3 g() {
                return new Inner3(new Sub());
        }
}


HTH,
Chavdar


On 10/16/06, Petar Tahchiev <[EMAIL PROTECTED]> wrote:
On 17/10/06, Chavdar Botev <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I've come accross the following problem trying to compile Java 5
> classes with generics using Ant 1.6.5. I've attached project
> with sample Java classes and a build.xml file.
>
> NOTE: Please create a src/test subdirectory and save the attached
> .java files into it. The mailing list server gave me a hard time
> acepting an email with the archived project files. :(
>
> A clean build of the above project works just fine and compiles
> without a problem. If after that, I touch the Test3.java file the
> build fails with the following error:
>
[javac] C:\src\appforge\test\src\test\Test3.java:5: incompatible types
> [javac] found   : test.Base
> [javac] required: test.Sub
> [javac] public Sub p() {return this.getV();}
> [javac] ^
> [javac] 1 error


I must admit that this behaviour is really strange. I am interested in
helping you but the problem is that I didn't receive any .java files. Please
try to prvide them again.


Initially, I thought that this was a problem with the Java compiler.
> After touching Test3.java, I tried running javac manually:
>
> javac -sourcepath src -d bin -g -source 1.5 -target 1.5 src\test\*.java
>
> It turned out that with the above command-line the project compiled
> OK. The project also compiles without a problem in Eclipse 3.2.1.
>
> Am I missing anything? It is my understanding that the build file and
> the command line should produce the same results.
>
> Upon further experimentation, if I uncomment the method in Test2.java
> fixes the problem. Touching Test3.java does not break the build.
>
> Thanks,
> Chavdar
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>


--
Regards, Petar!
Karlovo, Bulgaria.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to