Generic type doesn't support raw dataypes (int, boolean, etc.)?

It seems that Java 5 generics always autoboxes raw datatypes (int, double, boolean, ...) to the wrapper classes (Integer, Double, Boolean, ...), because when I use e.g. Integer.TYPE (instead of Integer.class), I got ClassCastExceptions. Is this non-support somewhere written down or is there a way to handle raw types without autoboxing them to their wrapper class?

[372 byte] By [MartinHilperta] at [2007-10-2 20:27:25]
# 1

I'm having some difficulty understanding your question, but my first suggestion is to see section 4.4 Type Variables of the Java Language Specification, which states: "If no bound is given for a type variable, Object is assumed."

Also, I think you mean "primivite" instead of "raw" types. Raw types are the "name of a generic type declaration used without any accompanying

actual type parameters" (sectoin 4.8 Raw Types).

Regards,

Nick

ndronena at 2007-7-13 23:10:19 > top of Java-index,Core,Core APIs...