[Jastadd] [bug report] bug in establishing throws clauses of anonymous class constructors, and a possible fix
Hello JastAdd developers,
I found a minor bug of JastAddJ in establishing throws clauses of anonymous
class constructors, and a possible fix.
It is minor in that it is extremely rare that this bug causes a problem. (in
only one .java file, java/security/KeyStore.java, in OpenJDK6 class
library)
But, due to this bug (and two others), I couldn't compile OpenJDK6 class
library using JastAddJ, as I reported 3 months ago.
The bug manifests itself in the following simple example:
-=-=-=
class C { }
class D { }
class MyException extends Exception { }
public class Test {
public static void main( String [] args ) {
new C() {
D d = new D() { void m() throws MyException { throw new
MyException(); } };
};
}
}
Running JastAddJ compiler on this example produces the following error:
-=-=-=
[hina_at_hyunikLinux temp]$ java -cp JastAddJ/Java1.5Backend/ JavaCompiler
Test.java
Errors:
Test.java:7:
Semantic Error: new C() {
D d = new D() {
void m() throws MyException {
throw new MyException();
}
};
} may throw uncaught exception MyException; it must be caught or
declared as being thrown
[hina_at_hyunikLinux temp]$
-=-=-=
Current version of JastAddJ generates a anonymous constructor for "new C() {
. }"
Received on Sat Feb 25 2012 - 10:20:39 CET
This archive was generated by hypermail 2.3.0
: Wed Apr 16 2014 - 17:19:06 CEST