another javac problem

Archie Cobbs archie at whistle.com
Thu Jan 22 10:56:02 PST 1998


Here's another javac problem I get with the FreeBSD port of kaffe-0.9.2:

FooException.java
-----------------

  public class FooException extends Exception {
  }


Foo.java
--------

  public class Foo {
    private static Object throwException() throws FooException {
      throw new FooException();
    }
    public Object getObject() {
      return new Object() {
	public Object method() {
	  try {
	    return throwException();
	  } catch (FooException e) {
	    return null;
	  }
	}
      };
    }
  }

Problem
-------

  $ javac Foo.java
  Foo.java:3: Exception FooException must be caught, or it must be declared in the throws clause of this method.
    private static Object throwException() throws FooException {
			  ^
  Foo.java:11: Exception FooException is never thrown in the body of the corresponding try statement.
	  } catch (FooException e) {
	    ^
  2 errors

This compiles fine with JDK-1.1.5, so either the javac compiler had a bug
which has since been fixed or there's some kaffe specific problem.

Thanks,
-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com



More information about the kaffe mailing list