There is code in item32 in effective java
public class Item32 {
static <T> T[] toArray(T ... args){
return args;
}
public static void main(String[] args) {
String[] attributes = toArray("1","2","3"); // no problem in Java 17 but problem in Java8
}
}
As there is type erasure, I expect that result of toArray("1","2","3") is Object[], so there is a ClassCastException. However, there is no exception for Java 17 and 11. But in Java 8, there is an exception. What happens in Java 17?