This is the mail archive of the
java-prs@sourceware.cygnus.com
mailing list for the Java project.
gcj/94: compiler allows assignment to interface constants
- To: java-gnats at sourceware dot cygnus dot com
- Subject: gcj/94: compiler allows assignment to interface constants
- From: bryce at albatross dot co dot nz
- Date: 9 Nov 1999 22:49:23 -0000
- Reply-To: bryce at albatross dot co dot nz
- Resent-Cc: java-prs at sourceware dot cygnus dot com, green at cygnus dot com
- Resent-Reply-To: java-gnats@sourceware.cygnus.com, bryce@albatross.co.nz
>Number: 94
>Category: gcj
>Synopsis: compiler allows assignment to interface constants
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Nov 09 14:50:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator: Bryce McKinlay <bryce@albatross.co.nz>
>Release: current
>Organization:
>Environment:
any
>Description:
Constants declared in interfaces are implicitly "static
final". However, the gcj source parser apparantly allows
assignment to these interface constants.
See below for example code. When generating bytecode with
"gcj -C", the compiler correctly reports:
Test.java:5: Can't assign a value to the final variable `A'.
but with "gcj -c", no error is reported!
>How-To-Repeat:
interface Foo
{
int A = 1;
}
class Test implements Foo
{
Test ()
{
A = 2;
}
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: