Generics Axiom disproved?
Hello,
today I was toying with the combination of Generics and varargs (see also my other post: http://forum.java.sun.com/thread.jspa?threadID=5138461). To my own surprise, I came up with the following program which seems to disprove the fundamental claim made by the inventors of Java Generics:
if a Java program compiles without any "unchecked" warnings, it is guaranteed not to fail at runtime with ClassCastException.
Am I overlooking something?
publicclass FailsAtRuntime{
publicstatic <T> T[] getArray(){
return propagate();
}
privatestatic <T> T[] propagate(T... argv){
return argv;
}
publicstaticvoid main(String[] args){
String[] a = getArray();
System.out.println(a);
}
}

