From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6071 invoked by alias); 15 Apr 2005 12:13:10 -0000 Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org Received: (qmail 6048 invoked by uid 48); 15 Apr 2005 12:13:09 -0000 Date: Fri, 15 Apr 2005 12:13:00 -0000 From: "brion at pobox dot com" To: java-prs@gcc.gnu.org Message-ID: <20050415121259.21045.brion@pobox.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug java/21045] New: Anonymous inner class constructor's exceptions can't be caught or thrown X-Bugzilla-Reason: CC X-SW-Source: 2005-q2/txt/msg00131.txt.bz2 List-Id: 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