public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* java/5943: incorrect "Can't reassign a value to the final variable" error
@ 2002-03-13 11:56 shroff
  0 siblings, 0 replies; 3+ messages in thread
From: shroff @ 2002-03-13 11:56 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: java/5943: incorrect "Can't reassign a value to the final variable"  error
@ 2002-03-13 12:26 Eric B Blake
  0 siblings, 0 replies; 3+ messages in thread
From: Eric B Blake @ 2002-03-13 12:26 UTC (permalink / raw)
  To: tromey; +Cc: gcc-prs

The following reply was made to PR java/5943; it has been noted by GNATS.

From: Eric B Blake <ebb9@email.byu.edu>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
   nobody@gcc.gnu.org, java-prs@gcc.gnu.org, shroff@transeda.com
Cc:  
Subject: Re: java/5943: incorrect "Can't reassign a value to the final variable" 
 error
Date: Wed, 13 Mar 2002 13:16:59 -0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5943
 
 A quick workaround: Use this code simplification.
 
 //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 = ! "Windows
 NT".equals(m_os_name);
 }
 
 ----
 Eric Blake


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: java/5943: incorrect "Can't reassign a value to the final variable" error
@ 2002-03-13 12:18 tromey
  0 siblings, 0 replies; 3+ messages in thread
From: tromey @ 2002-03-13 12:18 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, java-prs, nobody, shroff, tromey

Synopsis: incorrect "Can't reassign a value to the final variable" error

Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-By: tromey
Responsible-Changed-When: Wed Mar 13 12:18:43 2002
Responsible-Changed-Why:
    I'm handling this.
State-Changed-From-To: open->closed
State-Changed-By: tromey
State-Changed-When: Wed Mar 13 12:18:43 2002
State-Changed-Why:
    Thanks for your report.
    I tried your example with gcj 3.1 and it worked for me.
    The fix will appear in the upcoming 3.1 release.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5943


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-03-13 20:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-13 11:56 java/5943: incorrect "Can't reassign a value to the final variable" error shroff
2002-03-13 12:18 tromey
2002-03-13 12:26 Eric B Blake

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).