This is the mail archive of the java-prs@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug java/17157] New: GCJ does not give an error for checked exceptions that are never thrown


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]