Re: generics not supported
On Fri, 4 Dec 2009, Joshua Cranmer wrote:
On 12/04/2009 06:07 PM, Daniel Pitts wrote:
Class file formats have changed significantly between 1.3 and 1.5, so
unfortunately you can't compile 1.5 source into 1.3 bytecode.
The only changes I'm aware of in the actual bytecode itself (ignoring
the new attributes and flags, as a VM can and would easily ignore those)
are the ldc instruction supporting a ClassInfo and invokedynamic, the
latter of which is not usable from Java.
And the former of which was supported by earlier Sun JVMs, despite not
being in the spec. I have no idea if that extends to their mobile JVMs,
though, nor to any vendor mobile JVMs.
The ClassInfo ldc is fairly easily rewritten into a String ldc followed by
a Class.forName call, although given that J2ME doesn't (?) have the
version of forName which avoids initialising a class, this would change
the semantics in a subtle but strictly incorrect way. There is a more
convoluted trick for loading a class without initialising it discovered by
the Jikes team, but i think that would also be easy enough to rewrite ldc
calls to.
Other than that, things like generics and autoboxing vanish at
compile-time, so they should Just Work.
tom
--
.... including a depiction of evolution that would make a furious Charles
Darwin eat his own beard. -- Ben Croshaw, on Spore