classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Declaring RuntimeExceptions?


From: Sascha Brawer
Subject: Re: Declaring RuntimeExceptions?
Date: Fri, 12 Sep 2003 02:37:22 +0200

So, should a java compiler accept the following?

// java.awt.HeadlessException
//   extends java.lang.UnsupportedOperationException
//     extends java.lang.RuntimeException

class Foo
{
  void meth() throws java.awt.HeadlessException { }
}

class Bar
  extends Foo
{
  void meth() { }
}

javac 1.4.1 compiles this code, but gcj 3.2 complains about the throws
clause (of *Foo*.meth, which is a bit misleading).

Note that Foo may be a JDK class, and Bar some user class. If the above
code does not conform to the language specification, i.e. gcj is right,
our Foos must declare exactly the same exceptions as the JDK, or existing
user code may not compile with Classpath.

-- Sascha

Sascha Brawer, address@hidden, http://www.dandelis.ch/people/brawer/ 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]