You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by naveen varma <no...@yahoo.com> on 2009/04/07 04:08:34 UTC

Generics Compiling in Eclipse(3.4) and compilation fails in ANT(1.7). JRE 1.6.0_07

Hi All 
 
I am seeking help from you guys for my below problem. 
 
I have following classes : 
 
Class TestAntError 
public class TestANtError {

	
final protected<K extends SetDS<?, ?>>  void add(final K setDS) throws Exception {
		
		//synchronized final protected<K extends SetDS>  void add(final K setDS) throws Exception {
			if(setDS == null) {
				throw new NullPointerException("setDS cannot be null !!");
			}
			K thisSetDS =(K) new SetDS();
			
			thisSetDS.add(setDS);
			
		}

}
Class SetDS 
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;



public class SetDS<K extends Set<K>, T extends Comparable<T>> {

	private Map<K, T> vecMap_ = new TreeMap<K, T>();
	
	final public boolean add(SetDS<K, T> rhs) {
		if(rhs == null) {
			throw new NullPointerException("rhs cannot be null !!");
		}		
		return false;
	}
	
	public SetDS()
	{
		
	}
}
In Eclipse it compiles fine with just warnings but when I try to build it with ANT, Build fails with following error. 
TestANtError.java:14: add(SetDS<capture#4 of ?,capture#583 of ?>) in SetDS<capture#4 of ?,capture#583 of ?> cannot 
be applied to (K)
    [javac] 			thisSetDS.add(setDS);
    [javac] 			         ^
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 1 error
I am not sure whats the problem. 

Please help. 

Regards Nony