This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: fix PR 28892
David Daney writes:
> Tom Tromey wrote:
> >>>>>>"Andrew" == Andrew Haley <aph@redhat.com> writes:
> >
> >
> > Andrew> I'd have made it WONTFIX. Sadly, however, there seems to be no rule
> > Andrew> in the specification that forbids final fields being rewritten in
> > Andrew> methods other than clinit.
> >
> > In this case I don't think the fields are being rewritten -- they are
> > simply being initialized by a different function.
> >
> > Andrew> This makes some optimizations harder. I think we need a flag to tell
> > Andrew> gcj that what we are compiling may not be Java code. Then we can do
> > Andrew> better optimizations when we know that it is.
> >
> > Unfortunately I think final fields may be changed via reflection.
> >
>
> Is this behavior specified anywhere?
>
> I have not carefully read JLS 3, but IIRC in the good old days, it was
> kind of unspecified behavior.
Well, if you can find that in JLS 2 you're better at reading specs
than me! There are some restrictions on putfield, but I can't see
that one.
Andrew.