Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Alessio Stalla
On 24 Mar, 17:54, Alan wrote: > On Mar 24, 9:47 am, Alessio Stalla wrote: > > > Reflection is aware of generic type > > variables:http://download.oracle.com/javase/6/docs/api/java/lang/reflect/Generi... > > > What is lost at runtime is information about *instantiation* of those > > variables: e.

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Jules
cool :-) I had a feeling that there was some vestige of generics left at runtime - now I know exactly what it is. thanks guys, Jules -- 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

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Alan
On Mar 24, 9:47 am, Alessio Stalla wrote: > Reflection is aware of generic type > variables:http://download.oracle.com/javase/6/docs/api/java/lang/reflect/Generi... > > What is lost at runtime is information about *instantiation* of those > variables: e.g. you can't distinguish a method returning

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Jules
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

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Alan
This is only half-true. The data exists somewhere, as Jules says, so that javac can enforce proper use of generics when calling compiled library code. Eg, rt.jar contains only classes, yet j.u.List still manages to have generics, which are treated correctly by the compiler. The *use* of generic cod

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Alessio Stalla
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

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Andy Fingerhut
I'm not an expert on this, but I believe that whenever you have generics in Java, they have no effect on the bytecode, e.g. a HashMap has the same type in the bytecode as any other HashMap. The part is only used in some checks made by the Java compiler when compiling Java source code, and in

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Jules
Thanks for the reply Armando, This is pretty much where i was until I was asked to write a dot.net client library for my server. I then looked at all my Java code and figured I could write a second copy in C# and then keep the two in sync for ever after, or port it all to Clojure and let Cloju

Re: Java Interop - Generics - Hmmm...

2011-03-24 Thread Armando Blancas
For interop I write interfaces in Java. This way I can provide type- specific signatures, constants, javadocs and generics; then implement them all in Clojure. I also write exception classes in Java for use in Clojure since I find it simpler and cleaner than gen-class. You don't have to give up any

Java Interop - Generics - Hmmm...

2011-03-24 Thread Jules
Guys, I have a hybrid Java/Clojure project. The Java side contains a number of interfaces/classes that make use of generics. Implementing the interfaces Clojure-side is no problem - I just forget about type and get on with it :-) I am slowly migrating more and more code into Clojure and there