Bug 17157 - GCJ does not give an error for checked exceptions that are never thrown
GCJ does not give an error for checked exceptions that are never thrown
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: java
4.0.0
: P2 normal
: 4.3.0
Assigned To: Not yet assigned to anyone
: accepts-invalid
Depends on: 28067
Blocks:
  Show dependency treegraph
 
Reported: 2004-08-23 22:11 UTC by Casey Marshall
Modified: 2007-01-09 20:46 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2005-05-26 12:27:05


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Casey Marshall 2004-08-23 22:11:41 UTC
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.
Comment 1 Andrew Pinski 2004-08-23 22:15:22 UTC
Confirmed.
Comment 2 Tom Tromey 2007-01-09 20:46:26 UTC
All gcj front end bugs have been fixed by the gcj-eclipse branch merge.
I'm mass-closing the affected PRs.
If you believe one of these was closed in error, please reopen it
with a note explaining why.
Thanks.