public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: shroff@transeda.com
To: gcc-gnats@gcc.gnu.org
Subject: java/5943: incorrect "Can't reassign a value to the final variable" error
Date: Wed, 13 Mar 2002 11:56:00 -0000	[thread overview]
Message-ID: <20020313195416.3655.qmail@sources.redhat.com> (raw)


>Number:         5943
>Category:       java
>Synopsis:       incorrect "Can't reassign a value to the final variable" error
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 13 11:56:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Saurin Shroff
>Release:        GNU Java version 3.0.1 (sparc-sun-solaris2.8)
>Organization:
>Environment:
Sun/Solaris
>Description:
I get incorrect "Can't reassign a value to the final variable"
error for following core. Sun Java 1.1, 1.2 and 1.3 allows it.

//file: bug1.java
public abstract class bug1 {
    public static final String m_os_name = System.getProperty("os.name");
    public static final boolean m_unix_os;

    static {
	String ntos = "Windows NT";
	if (m_os_name.equals(ntos)) {
	    m_unix_os = false;
	} else {
	    m_unix_os = true;
	}
    }
}


Here is the log:
shroff@bert> gcj -v -C bug1.java
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.0.1/specs
Configured with: ../configure --with-as=/usr/local/bin/as --with-ld=/usr/local/bin/ld --enable-libgcj
Thread model: posix
gcc version 3.0.1
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.0.1/jc1 bug1.java -quiet -dumpbase bug1.java -g1 -version -fencoding=UTF-8 -fsyntax-only -femit-class-files -o /dev/null
GNU Java version 3.0.1 (sparc-sun-solaris2.8)
        compiled by GNU C version 3.0.1.
bug1.java: In class `bug1':
bug1.java: In method `<clinit>()':
bug1.java:10: Can't reassign a value to the final variable `m_unix_os'.
            m_unix_os = true;
               ^
1 error


>How-To-Repeat:
See the example in the report.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-03-13 19:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-13 11:56 shroff [this message]
2002-03-13 12:18 tromey
2002-03-13 12:26 Eric B Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020313195416.3655.qmail@sources.redhat.com \
    --to=shroff@transeda.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).