public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/16839] New: Final vars in switch generate compile error in anonymous class.
@ 2004-07-30 22:24 beandz at hotmail dot com
  2004-07-31 16:10 ` [Bug java/16839] " tromey at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: beandz at hotmail dot com @ 2004-07-30 22:24 UTC (permalink / raw)
  To: gcc-bugs

This valid java code generates a compile error.

public class finaltest {
    public void main(String args[]) {
        System.out.println("got to main");
        switch(23) {
        case 1:
            final String s = "x";
            break;
        case 2:
            new Runnable() {
                public void run() {
                    System.out.println("run");
                }
            };
            break;
        }
    }
}
 

C:\> \app\gcj\gcc-3.5\bin\gcj finaltest.java
finaltest.java: In class `finaltest':
finaltest.java: In method `finaltest.main(java.lang.String[])':
finaltest.java:13: error: Variable `s' may not have been initialized.
                          };
     ^
  1 error

C:\> gcj --version
gcj (GCC) 3.5.0 20040629 (experimental)
Copyright (C) 2004 Free Software Foundation, Inc.

-- 
           Summary: Final vars in switch generate compile error in anonymous
                    class.
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: beandz at hotmail dot com
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org
  GCC host triplet: Win2K


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16839


^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <bug-16839-9046@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2007-01-09 20:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-30 22:24 [Bug java/16839] New: Final vars in switch generate compile error in anonymous class beandz at hotmail dot com
2004-07-31 16:10 ` [Bug java/16839] " tromey at gcc dot gnu dot org
2004-12-27 14:45 ` pinskia at gcc dot gnu dot org
2005-01-01 20:11 ` beandz at hotmail dot com
2005-01-01 20:17 ` pinskia at gcc dot gnu dot org
     [not found] <bug-16839-9046@http.gcc.gnu.org/bugzilla/>
2007-01-09 20:51 ` tromey at gcc dot gnu dot org

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