harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject [classlib] Switching to a 5.0 compiler
Date Wed, 05 Apr 2006 10:53:11 GMT
A while ago we agreed to switch to a class library compilation story
that would allow us to use 1.5 Java syntax on a 1.4-compatible VM (i.e.
using syntax that is erased by the compiler).

Here's where I'm at...


Using the Sun compiler:

Specifying source=1.5 and target=1.4 (understandably) fails as an
invalid option set, but there is an undocumented and unmaintained option
that, AIUI, was introduced during the syntax transition to full 1.5
support.  On Sun-based compilers we can specify source=1.5 target=jsr14
and get some support for erased 1.5 syntax.


Using the Eclipse compiler:

In the Eclipse JDT UI you *can* specify source=5.0 target=1.4 and I
successfully ran code written using generics on a 1.4 VM.  However, the
Eclipse batch compiler does not allow this source=5.0 target=1.4
combination; and when I asked why the answer was that the UI usage is
wrong and will be fixed to prevent that combination.

Unless we void the warranty on the compiler by making non-API calls into
their code we cannot therefore use the Eclipse to do back-level
compilations.

Geir voted -1 to the proposal if it meant that we could only use one
compiler, so I have looked around thought a bit more about it ...


Using RetroWeaver:

Retroweaver (retroweaver.sourceforge.net) is a bytecode weaver that
takes 1.5 class files and modifies them to run on 1.4-compatible VMs.
It is BSD-licensed.

The weaver does a bit more than we actually want in that it not only
rewrites the class file format (to remove class literals, synthetic
access specifiers etc) but also replaces references to some runtime
dependencies (replaces StringBuilder with StringBuffer,
Float.valueOf(float), etc.)

I've had a brief exchange with Toby (the author) and he indicated that
it would be possible to make some mods to retroweaver to do the format
changes without the runtime changes.  So using retroweaver in our build
process is a possible step.


Putting a v49 requirement on VMs:

Given that the changes in the class file format are relatively modest,
we could require that Harmony compatible VMs are able to consume 1.5
format class files, even if they do not support the full 5.0 APIs at
this point.  We would provide 1.5 level class libraries in all places
except where it requires new VM APIs (reflect, concurrent, etc).  This
is rather distasteful though since it means that we are 1.4++


Stay at 1.4 syntax until the VMs can do full-on 1.5 support

At some point we want the VMs to offer full 1.5 support so perhaps we
just wait for that day.  That would leave some very tasty contributions
languishing in JIRA longer than we would like.


Comments?
Tim

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message