public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/15501] New: GCJ incorrectly implements Section 15.9.5.1, "Anonymous Constructors"
@ 2004-05-17 19:41 vadimn at redhat dot com
  2004-05-17 19:48 ` [Bug libgcj/15501] " pinskia at gcc dot gnu dot org
  2004-06-27  0:58 ` [Bug java/15501] " mckinlay at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: vadimn at redhat dot com @ 2004-05-17 19:41 UTC (permalink / raw)
  To: java-prs

GCJ seems to incorrectly implement the following section of the Java
Language Specification:

15.9.5.1 Anonymous Constructors
http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#253002

  "In all cases, the throws clause of an anonymous constructor must
  list all the checked exceptions thrown by the explicit superclass
  constructor invocation statement contained within the anonymous
  constructor, and all checked exceptions thrown by any instance
  initializers or instance variable initializers of the anonymous
  class."

Note that the offending file Test.java compiles fine with Sun's javac.

Here's what I get with GCJ:

$ cat Test.java 
import java.io.IOException;

public class Test {

    public Test() throws IOException {
        throw new IOException("could be any checked exception");
    }

    public void doStuff() {}

    public void blowUp() throws Exception {
        new Test() {}.doStuff();
    }
}
$ gcj -v -save-temps -C Test.java 
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man \
--infodir=/usr/share/info --enable-shared --enable-threads=posix \
--disable-checking --disable-libunwind-exceptions --with-system-zlib \
--enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
 /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/jc1 Test.java -quiet \
 -dumpbase Test.java -auxbase-strip NONE -g1 -version -fsyntax-only \
 -femit-class-files -o Test

GNU Java version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) (i386-redhat-linux)
        compiled by GNU C version 3.3.3 20040412 (Red Hat Linux 3.3.3-7).
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=129024
Class path starts here:
    ./
    /usr/share/java/libgcj-3.3.3.jar/ (system) (zip)
Test.java: In class `Test$1':
Test.java: In constructor `(Test)':
Test.java:14: error: Exception `java.io.IOException' must be caught, \
or it must be declared in the `throws' clause of `Test$1'.

   }
   ^
1 error
$ ls -l
total 12
-rw-rw-r--    1 vadim    vadim           0 May 17 15:31 Test
-rw-rw-r--    1 vadim    vadim         244 May 17 15:31 Test$1.class
-rw-rw-r--    1 vadim    vadim         503 May 17 15:31 Test.class
-rw-rw-r--    1 vadim    vadim         276 May 17 13:09 Test.java
$ gcj34 -v -save-temps -C Test.java 
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.0/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man \
--infodir=/usr/share/info --enable-shared --enable-threads=posix \
--disable-checking --with-system-zlib --enable-__cxa_atexit \
--disable-libunwind-exceptions --enable-languages=c,c++,objc,java,f77 \
--host=i386-redhat-linux

Thread model: posix
gcc version 3.4.0 (Red Hat Linux 3.4.0-1)
 /usr/libexec/gcc/i386-redhat-linux/3.4.0/jc1 Test.java -quiet \
 -dumpbase Test.java -auxbase-strip NONE -g1 -version -fsyntax-only \
 -femit-class-files -o Test

GNU Java version 3.4.0 (Red Hat Linux 3.4.0-1) (i386-redhat-linux)
        compiled by GNU C version 3.4.0 (Red Hat Linux 3.4.0-1).
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=129024
Class path starts here:
    ./
    /usr/share/java/libgcj-3.4.0.jar/ (system) (zip)
Test.java: In class `Test$1':
Test.java: In constructor `(Test)':

Test.java:14: error: Exception `java.io.IOException' must be caught, \
or it must be declared in the `throws' clause of `Test$1'.
   }
   ^
1 error
$ ls -l
total 12
-rw-rw-r--    1 vadim    vadim           0 May 17 15:31 Test
-rw-rw-r--    1 vadim    vadim         244 May 17 15:31 Test$1.class
-rw-rw-r--    1 vadim    vadim         503 May 17 15:31 Test.class
-rw-rw-r--    1 vadim    vadim         276 May 17 13:09 Test.java

-- 
           Summary: GCJ incorrectly implements Section 15.9.5.1, "Anonymous
                    Constructors"
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vadimn at redhat dot com
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


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


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

* [Bug libgcj/15501] GCJ incorrectly implements Section 15.9.5.1, "Anonymous Constructors"
  2004-05-17 19:41 [Bug libgcj/15501] New: GCJ incorrectly implements Section 15.9.5.1, "Anonymous Constructors" vadimn at redhat dot com
@ 2004-05-17 19:48 ` pinskia at gcc dot gnu dot org
  2004-06-27  0:58 ` [Bug java/15501] " mckinlay at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-17 19:48 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-17 19:48 -------
Confirmed

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
      Known to fail|                            |3.5.0 3.4.0 3.3.3
   Last reconfirmed|0000-00-00 00:00:00         |2004-05-17 19:48:34
               date|                            |


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


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

* [Bug java/15501] GCJ incorrectly implements Section 15.9.5.1, "Anonymous Constructors"
  2004-05-17 19:41 [Bug libgcj/15501] New: GCJ incorrectly implements Section 15.9.5.1, "Anonymous Constructors" vadimn at redhat dot com
  2004-05-17 19:48 ` [Bug libgcj/15501] " pinskia at gcc dot gnu dot org
@ 2004-06-27  0:58 ` mckinlay at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: mckinlay at redhat dot com @ 2004-06-27  0:58 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From mckinlay at redhat dot com  2004-06-27 00:43 -------
Moving to java category, this is a compiler bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libgcj                      |java


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


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

end of thread, other threads:[~2004-06-27  0:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-17 19:41 [Bug libgcj/15501] New: GCJ incorrectly implements Section 15.9.5.1, "Anonymous Constructors" vadimn at redhat dot com
2004-05-17 19:48 ` [Bug libgcj/15501] " pinskia at gcc dot gnu dot org
2004-06-27  0:58 ` [Bug java/15501] " mckinlay at redhat dot com

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