public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/21045] New: Anonymous inner class constructor's exceptions can't be caught or thrown
@ 2005-04-15 12:13 brion at pobox dot com
2005-04-15 12:15 ` [Bug java/21045] " brion at pobox dot com
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: brion at pobox dot com @ 2005-04-15 12:13 UTC (permalink / raw)
To: java-prs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1537 bytes --]
When a method creates an instance of an anonymous inner class, it must catch or
declare any exceptions throwable by the inner class's constructor.
GCJ gives an error about this even though the method *does* handle or declare
it: (Will attach test cases...)
$ gcj -c FailThrow.java
FailThrow.java: In class 'FailThrow$1':
FailThrow.java: In constructor '(FailThrow)':
FailThrow.java:6: error: Exception java.lang.Exception must be caught, or it
must be declared in the throws clause of FailThrow$1.
InnerBase obj = new InnerBase() {};
^
1 error
Creating an instance of the base class, with the same constructor, works fine.
GCC built from CVS HEAD: gcj-4.0 (GCC) 4.1.0 20050415 (experimental)
./configure --prefix=/usr/local/gcj --program-suffix=-4.0
--enable-languages=c,c++,java
Running on Ubuntu Linux (Hoary Hedgehog).
--
Summary: Anonymous inner class constructor's exceptions can't be
caught or thrown
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: brion at pobox dot com
CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21045
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug java/21045] Anonymous inner class constructor's exceptions can't be caught or thrown
2005-04-15 12:13 [Bug java/21045] New: Anonymous inner class constructor's exceptions can't be caught or thrown brion at pobox dot com
@ 2005-04-15 12:15 ` brion at pobox dot com
2005-04-15 12:16 ` brion at pobox dot com
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: brion at pobox dot com @ 2005-04-15 12:15 UTC (permalink / raw)
To: java-prs
------- Additional Comments From brion at pobox dot com 2005-04-15 12:15 -------
Created an attachment (id=8644)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8644&action=view)
Test case which wraps in a try-catch; fails to compile with GCJ
Compiles just fine with javac from Sun JDK 1.5.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21045
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug java/21045] Anonymous inner class constructor's exceptions can't be caught or thrown
2005-04-15 12:13 [Bug java/21045] New: Anonymous inner class constructor's exceptions can't be caught or thrown brion at pobox dot com
2005-04-15 12:15 ` [Bug java/21045] " brion at pobox dot com
@ 2005-04-15 12:16 ` brion at pobox dot com
2005-04-15 12:17 ` brion at pobox dot com
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: brion at pobox dot com @ 2005-04-15 12:16 UTC (permalink / raw)
To: java-prs
------- Additional Comments From brion at pobox dot com 2005-04-15 12:16 -------
Created an attachment (id=8645)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8645&action=view)
Test case using the base class; works
Using a base class instead of an anonymous inner class derivitive, the
exception is handled as expected.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21045
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug java/21045] Anonymous inner class constructor's exceptions can't be caught or thrown
2005-04-15 12:13 [Bug java/21045] New: Anonymous inner class constructor's exceptions can't be caught or thrown brion at pobox dot com
2005-04-15 12:15 ` [Bug java/21045] " brion at pobox dot com
2005-04-15 12:16 ` brion at pobox dot com
@ 2005-04-15 12:17 ` brion at pobox dot com
2005-04-15 12:20 ` brion at pobox dot com
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: brion at pobox dot com @ 2005-04-15 12:17 UTC (permalink / raw)
To: java-prs
------- Additional Comments From brion at pobox dot com 2005-04-15 12:17 -------
Created an attachment (id=8646)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8646&action=view)
Failing test case using a throws declaration instead of try-catch
Again, fails to compile with GCJ. Fine with javac from Sun JDK 1.5.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21045
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug java/21045] Anonymous inner class constructor's exceptions can't be caught or thrown
2005-04-15 12:13 [Bug java/21045] New: Anonymous inner class constructor's exceptions can't be caught or thrown brion at pobox dot com
` (2 preceding siblings ...)
2005-04-15 12:17 ` brion at pobox dot com
@ 2005-04-15 12:20 ` brion at pobox dot com
2005-04-15 13:33 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: brion at pobox dot com @ 2005-04-15 12:20 UTC (permalink / raw)
To: java-prs
------- Additional Comments From brion at pobox dot com 2005-04-15 12:20 -------
Created an attachment (id=8647)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8647&action=view)
Working test case with throws declaration
Again, using the base class instead of an anonymous inner class the
constructor's exception is handled correctly.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21045
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug java/21045] Anonymous inner class constructor's exceptions can't be caught or thrown
2005-04-15 12:13 [Bug java/21045] New: Anonymous inner class constructor's exceptions can't be caught or thrown brion at pobox dot com
` (3 preceding siblings ...)
2005-04-15 12:20 ` brion at pobox dot com
@ 2005-04-15 13:33 ` pinskia at gcc dot gnu dot org
2005-06-17 22:59 ` mckinlay at redhat dot com
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-15 13:33 UTC (permalink / raw)
To: java-prs
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |18131
nThis| |
Keywords| |rejects-valid
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21045
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug java/21045] Anonymous inner class constructor's exceptions can't be caught or thrown
2005-04-15 12:13 [Bug java/21045] New: Anonymous inner class constructor's exceptions can't be caught or thrown brion at pobox dot com
` (4 preceding siblings ...)
2005-04-15 13:33 ` pinskia at gcc dot gnu dot org
@ 2005-06-17 22:59 ` mckinlay at redhat dot com
2005-06-18 1:51 ` mckinlay at redhat dot com
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mckinlay at redhat dot com @ 2005-06-17 22:59 UTC (permalink / raw)
To: java-prs
------- Additional Comments From mckinlay at redhat dot com 2005-06-17 22:59 -------
Confirmed
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-06-17 22:59:08
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21045
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug java/21045] Anonymous inner class constructor's exceptions can't be caught or thrown
2005-04-15 12:13 [Bug java/21045] New: Anonymous inner class constructor's exceptions can't be caught or thrown brion at pobox dot com
` (5 preceding siblings ...)
2005-06-17 22:59 ` mckinlay at redhat dot com
@ 2005-06-18 1:51 ` mckinlay at redhat dot com
2005-07-07 14:35 ` cvs-commit at gcc dot gnu dot org
2005-07-07 14:47 ` mckinlay at redhat dot com
8 siblings, 0 replies; 10+ messages in thread
From: mckinlay at redhat dot com @ 2005-06-18 1:51 UTC (permalink / raw)
To: java-prs
------- Additional Comments From mckinlay at redhat dot com 2005-06-18 01:51 -------
I'm testing a patch.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21045
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug java/21045] Anonymous inner class constructor's exceptions can't be caught or thrown
2005-04-15 12:13 [Bug java/21045] New: Anonymous inner class constructor's exceptions can't be caught or thrown brion at pobox dot com
` (6 preceding siblings ...)
2005-06-18 1:51 ` mckinlay at redhat dot com
@ 2005-07-07 14:35 ` cvs-commit at gcc dot gnu dot org
2005-07-07 14:47 ` mckinlay at redhat dot com
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-07 14:35 UTC (permalink / raw)
To: java-prs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-07-07 14:35 -------
Subject: Bug 21045
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: bryce@gcc.gnu.org 2005-07-07 14:34:54
Modified files:
libjava : ChangeLog
libjava/testsuite/libjava.jacks: jacks.xfail
gcc/java : ChangeLog parse.y
Added files:
libjava/testsuite/libjava.compile: PR21045.java
Log message:
2005-07-07 Bryce McKinlay <mckinlay@redhat.com>
PR java/21045
* parse.y (add_exception_to_throws): New function.
(purge_unchecked_exceptions): Removed.
(get_constructor_super): Renamed from verify_constructor_super. Now
returns the super constructor after verification.
(java_complete_expand_method): Don't use purge_unchecked_exceptions
or save/restore the exception list.
(check_thrown_exceptions): Add uncaught exceptions in anonymous
class initializers and constructors to the throws clause of the
method.
2005-07-07 Bryce McKinlay <mckinlay@redhat.com>
* testsuite/libjava.compile/PR21045.java: New test.
* testsuite/libjava.jacks/jacks.xfail: Remove 15.9.5.1-exception-1,
15.9.5.1-exception-3, 8.3.2-abrupt-6, 8.3.2-abrupt-7.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3693&r2=1.3694
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.compile/PR21045.java.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.jacks/jacks.xfail.diff?cvsroot=gcc&r1=1.26&r2=1.27
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1641&r2=1.1642
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/parse.y.diff?cvsroot=gcc&r1=1.546&r2=1.547
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21045
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug java/21045] Anonymous inner class constructor's exceptions can't be caught or thrown
2005-04-15 12:13 [Bug java/21045] New: Anonymous inner class constructor's exceptions can't be caught or thrown brion at pobox dot com
` (7 preceding siblings ...)
2005-07-07 14:35 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-07 14:47 ` mckinlay at redhat dot com
8 siblings, 0 replies; 10+ messages in thread
From: mckinlay at redhat dot com @ 2005-07-07 14:47 UTC (permalink / raw)
To: java-prs
------- Additional Comments From mckinlay at redhat dot com 2005-07-07 14:46 -------
Fixed on HEAD.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21045
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-07-07 14:47 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-15 12:13 [Bug java/21045] New: Anonymous inner class constructor's exceptions can't be caught or thrown brion at pobox dot com
2005-04-15 12:15 ` [Bug java/21045] " brion at pobox dot com
2005-04-15 12:16 ` brion at pobox dot com
2005-04-15 12:17 ` brion at pobox dot com
2005-04-15 12:20 ` brion at pobox dot com
2005-04-15 13:33 ` pinskia at gcc dot gnu dot org
2005-06-17 22:59 ` mckinlay at redhat dot com
2005-06-18 1:51 ` mckinlay at redhat dot com
2005-07-07 14:35 ` cvs-commit at gcc dot gnu dot org
2005-07-07 14:47 ` 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).