public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "brion at pobox dot com" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/21045] New: Anonymous inner class constructor's exceptions can't be caught or thrown
Date: Fri, 15 Apr 2005 12:13:00 -0000	[thread overview]
Message-ID: <20050415121259.21045.brion@pobox.com> (raw)

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


             reply	other threads:[~2005-04-15 12:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-15 12:13 brion at pobox dot com [this message]
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

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=20050415121259.21045.brion@pobox.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@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).