> It looks like the JRE classes that come with the 1.5.0 beta have their
> major version set to 49. Does anyone know of any documentation
> available for this new version of the class file format? It appears
> that the signatures can now have "+" prepended to them, which I am
> assuming has something to do with generics. I have no idea what other
> changes may be in there.
I don't know of any documentation either, but looking at the output of the beta
compiler (and its source), I've seen 5 new attributes.
"Enum": a flag attribute added to classes to signify that they were synthesised
from an enum declaration.
"Bridge": a flag added to methods to indicate that they are the forwarding
methods synthesised to fake covariant returns*.
"Varargs": a flag attribute added to methods to indicate that they were
declared to accept varargs.
"Signature": a new string-values attribute that is used to hold the signature
of generic classes and members before they were subjected to erasure. These
are separate from the real signatures used to name and refer to the real (post
erasure) classes and members. The syntax of the new signature strings is
extended with a T (used the same way as L) to refer to a template type name. I
have no idea what the "+" signatures you mention are, I have not seen them
myself yet -- do you have an easy way to reproduce them ?
"StackMap": a new sub-attribute added to "Code" attributes. I haven't bothered
to try to decode them; the code in the beta compiler that generates them
suggests a fairly complicated internal structure, and they are of no particular
interest for my purposes. AFAIK they hold data generated by the compiler
indicating the layout of the stack and locals at various points of execution,
and are (I'm guessing) intended to ease the job of verification in
resource-restricted environments.
Of course, that's all from observing what the beta compiler does now -- there
is no guarantee that the final compiler will do quite the same thing...
I've read that some of the limits on method and/or constant pool size are to be
removed too, but I have no idea what classfile format changes that will entail.
The beta compiler generates the same basic layout as 1.4 javac, so I assume
that it doesn't have support for the "big" classfile format.
-- chris
[*] Or do I mean variant returns ? I can never sort out varient from
covarient...
Daniel - 10 Feb 2004 14:02 GMT
> I
> have no idea what the "+" signatures you mention are, I have not seen them
> myself yet -- do you have an easy way to reproduce them ?
I noticed this when playing with the 1.5 beta in Netbeans. I added a
type parameter to one of my classes, e.g. MyClass<T>, recompiled it,
and a class appeared in the Netbeans browser with "+" on the end of
its name. I guess a future version of Netbeans will interpret this
information properly in some way.
Artur Biesiadowski - 14 Feb 2004 11:54 GMT
> [*] Or do I mean variant returns ? I can never sort out varient from
> covarient...
AFAIK, it is covariant versus contravariant.
For me, memo technique is quite easy. Contra means opposite. So
covariance goes in same direction as inheritance (subclass can
specialize return types/arguments), contravariance other way around
(subclass can generalize return type/argument). In short -
covariance - specialization specializes (return types/arguments)
contravariance - specialization generalizes (return types/arguments)
Artur
Chris Uppal - 14 Feb 2004 13:04 GMT
> > [*] Or do I mean variant returns ? I can never sort out varient from
> > covarient...
>
> AFAIK, it is covariant versus contravariant.
Yes, you are right -- but you see the difficulty I have remembering it ;-)
> For me, memo technique is quite easy. Contra means opposite. So
> covariance goes in same direction as inheritance (subclass can
> specialize return types/arguments), contravariance other way around
> (subclass can generalize return type/argument).
Very clear, thanks.
But I bet I'll have fogotten again by the time I next come to talk about the
concepts. Some things just *won't* stay stuck.
Sigh...
-- chris