This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: PR java/19277: Array.length++ is incorrectly allowed
- From: Ranjit Mathew <rmathew at gmail dot com>
- To: Andrew Haley <aph at redhat dot com>
- Cc: GCJ Patches <java-patches at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 10 Jan 2005 16:45:52 +0530
- Subject: Re: PR java/19277: Array.length++ is incorrectly allowed
- References: <41E2601E.6030601@gmail.com> <16866.25098.102912.779058@cuddles.cambridge.redhat.com>
- Reply-to: Ranjit Mathew <rmathew at gmail dot com>
On Mon, 10 Jan 2005 11:07:54 +0000, Andrew Haley <aph@redhat.com> wrote:
> Ranjit Mathew writes:
>
> > from Ranjit Mathew <rmathew@hotmail.com>
> >
> > PR java/19277
> > * check-init.c (check_init): Take care of references that do not
> > have an explicit final variable declaration (e.g. array length
> > access) for pre/post in/de-crement operators.
>
> OK.
Thanks for the quick review and approval!
> > tmp = get_variable_decl (TREE_OPERAND (exp, 0));
> > if (tmp != NULL_TREE && DECL_FINAL (tmp))
> > - final_assign_error (DECL_NAME (tmp));
> > + final_assign_error (DECL_NAME (tmp));
> > + else if (TREE_CODE (tmp = TREE_OPERAND (exp, 0)) == COMPONENT_REF)
> > + {
>
> Please add a small comment to say what this is for.
> Like '* Don't allow pre/post in/de-crement operators on final fields. */
The thing is, the current GCJ *does* catch stuff like this:
class Foo
{
final int bar = 10;
void snafu( )
{
bar++;
}
}
So should I say something like "Don't allow [...] on array length
fields"? Or "implicitly declared" ("artificial"?) fields?
Thanks,
Ranjit.
--
Ranjit Mathew Email: rmathew AT gmail DOT com
Bangalore, INDIA. Web: http://ranjitmathew.hostingzero.com/