On Thursday, March 24, 2011 5:29:56 PM UTC+1, Jules wrote: > > Thanks Andy, > > I agree that there is no practical remnant of generics in the runtime as I > have poked around with reflection as well, but I think there might be in the > bytecode, otherwise if I compiled a generic interface, stuck it into a jar > and gave it to you to link against, the compiler would know nothing about > the genericness of my interface ? Surely this can't be right as generics DO > exist at compile time, so I think that there is compile-time generics info > stashed somewhere in the bytecode that is not loaded at runtime. >
Reflection is aware of generic type variables: http://download.oracle.com/javase/6/docs/api/java/lang/reflect/GenericDeclaration.html What is lost at runtime is information about *instantiation* of those variables: e.g. you can't distinguish a method returning List<String> from one returning List<Integer>. (Actually, not even all instantiations of generic type variables are lost at runtime, see http://gafter.blogspot.com/2006/12/super-type-tokens.html for an example). hth, Alessio -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en