This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug java/17157] New: GCJ does not give an error for checked exceptions that are never thrown
- From: "csm at gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 23 Aug 2004 22:11:45 -0000
- Subject: [Bug java/17157] New: GCJ does not give an error for checked exceptions that are never thrown
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
GCJ does not reject a 'try { } catch (foo) { }' construction where a checked
exception 'foo' can never be thrown within the 'try' block.
As an example of this, javac and jikes both give an error for the following
program, while GCJ does not:
class nothrow
{
public static void main(String[] argv)
{
try
{
System.out.println("Hello");
}
catch (java.io.IOException e) // never thrown.
{
e.printStackTrace();
}
}
}
The bytecode emitted by 'gcj -C' on this program is apparently still valid, however.
Exists in versions 3.3.2 and 3.5.0 CVS HEAD.
--
Summary: GCJ does not give an error for checked exceptions that
are never thrown
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: csm at gnu dot org
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=17157