classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JDK 1.5 support?


From: Robert Schuster
Subject: Re: JDK 1.5 support?
Date: Thu, 01 Jul 2004 02:31:52 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.6) Gecko/20040521

< In principle because generics are based on type erasure, they are primarily
< a compile-time concept. So code that uses generics that is compiled with a
< 1.5 compiler may be runnable on a non-1.5 JVM.
yepp thats true. the reason for not having "-source 1.5 -target 1.4" is definetely not a technical one. there was a talk with developers in the Java forums about that.
the latest answer is retroweaver. it 'reweaves' 1.5-compatible classfiles and makes them runnable on 1.4 runtimes. its license is modified BSD. you can find it here: retroweaver.sf.net

cu
Robert Schuster

David Holmes wrote:
Andrew Hughes wrote:
  
The hardest thing would seem to be the generics (Java's templates -- is
it or me or does it seem strange that Java 1.5/5.0 is basically bringing
back in lots of C++ features, mainly as a result of C# having them?).
    

It's you :) Java has had generics on the cards for a long time - too long,
but that's another story - since before C# existed. C# didn't define
generics initially either - have they added it yet? Java Generics is nothing
like C++ templates except for the <> syntax. You could say that a key goal
for Java generics was to NOT provide something like C++ templates. :)

  
Generics are added to a lot of the core classes, notably java.util's
collections.  Would adding this mean that compilers and code would need
to be 1.5 ready?
    

In principle because generics are based on type erasure, they are primarily
a compile-time concept. So code that uses generics that is compiled with a
1.5 compiler may be runnable on a non-1.5 JVM. That said, some of the
information is stored in the extensions to the class file format for
run-time introspection (don't know the details of what you can and can't do
here). So compiling with generics tends to produce class files that won't be
understood by non-1.5 supporting VM's. I suspect you would need a compiler
that knows how to compile generics whilst producing a non-1.5 specific class
file.

David Holmes



_______________________________________________
Classpath mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/classpath


  
  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]