 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Benji Smith Guest
|
Posted: Fri Feb 06, 2004 9:21 pm Post subject: 1.5.0 Bytecode Compatibility |
|
|
Most of the language changes in the new 1.5.0 Beta seem to be changes
that could be implemented pretty simply by the compiler, without any
changes made to the bytecode format.
So, I'm curious...if I compile code that uses the new 1.5.0 features,
can I subsequently execute those bytecode in the 1.4.2_03 JVM?
|
|
| Back to top |
|
 |
Michael Amling Guest
|
Posted: Sat Feb 07, 2004 3:01 am Post subject: Re: 1.5.0 Bytecode Compatibility |
|
|
Benji Smith wrote:
| Quote: | Most of the language changes in the new 1.5.0 Beta seem to be changes
that could be implemented pretty simply by the compiler, without any
changes made to the bytecode format.
So, I'm curious...if I compile code that uses the new 1.5.0 features,
can I subsequently execute those bytecode in the 1.4.2_03 JVM?
|
I haven't looked, but even if the bytecodes haven't changed (and I
suspect they haven't), there's a danger that a builtin class in 1.5 may
not exist in 1.4 or may not have all the fields or methods that 1.5 has.
--Mike Amling
|
|
| Back to top |
|
 |
Chris Uppal Guest
|
Posted: Sat Feb 07, 2004 10:40 am Post subject: Re: 1.5.0 Bytecode Compatibility |
|
|
Benji Smith wrote:
| Quote: | So, I'm curious...if I compile code that uses the new 1.5.0 features,
can I subsequently execute those bytecode in the 1.4.2_03 JVM?
|
All the new semantics is realized through tricks that work just as well on
pre-1.5 JVMs. A few new attributes have been added, but that's completely
downwards compatible.
However, from a post by Neil Grafter on c.l.j.programmer:
You can translate 1.5-style classfiles into 1.4-style classfiles
by discarding the stackmaps and changing the version number.
Almost. Class literals generate a single bytecode instruction
(ldc) in 1.5, and that must be translated into the mass of code
that was used in previous releases.
So I suspect that (if the feature makes it into the final release) code
compiled with -target 1.5 may not be able to run on a 1.4 JVM (but then, I
don't suppose it would anyway given the version number checking).
-- chris
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|