On Tue, Sep 14, 2004 at 12:13:39PM +0100, Ganesh Sittampalam wrote:
> Hi all,
>
> Just trying to work through this whole initializers of static final fields
> issue.
>
> Here's the situation:
>
> * The JVM spec (4.5.3) says that the JVM - and I guess by implication
> tools, compilers etc - must understand the ConstantValue attribute, which
> could be on any static field (not necessarily final, but I don't think
> that matters). This means that it is valid for a compiler to make this
> attribute and leave out the code to initialise it.
>
> * I can't find any explicit statement anywhere that compilers should use
> ConstantValue and omit the initialisation code. However, various pieces of
> the spec seem to imply that it is necessary. For example, JLS 8.3.2.1 says
> that even devious programs cannot observe the default value for final
> static fields whose initializers are compile time constants. Similarly, it
> is a requirement for compiling java source that such things be inlined,
> and if the reference is to a field in a binary class the only sane way to
> figure out that it was a compile time constant is with the ConstantValue
> attribute.
>
> So it seems to me as if J2J will need to be changed to support this :-/
What about this does J2J not support currently?
Ondrej
>
> Ganesh
>
>
Received on Tue Sep 14 12:47:36 2004
This archive was generated by hypermail 2.1.8 : Tue Sep 14 2004 - 14:10:02 BST