2003-03-13 20:16:53 +01:00
|
|
|
|
|
|
|
import org.aspectj.testing.Tester;
|
|
|
|
|
|
|
|
/** Bugzilla Bug 34925
|
|
|
|
compiler crash on yesterday's rc1 build
|
|
|
|
*/
|
|
|
|
import java.io.*;
|
|
|
|
|
|
|
|
public aspect ConvertToUnchecked {
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
try {
|
|
|
|
Foo foo = new Foo("hello");
|
|
|
|
Tester.check(false, "shouldn't get here");
|
|
|
|
} catch (PersistenceException pe) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// convert IOExceptions in Foo to PersistenceException
|
|
|
|
pointcut module() : within(Foo);
|
|
|
|
|
|
|
|
after() throwing (IOException e) : module() {
|
|
|
|
throw new PersistenceException(e);
|
|
|
|
}
|
|
|
|
declare soft: (IOException): module();
|
|
|
|
}
|
|
|
|
|
|
|
|
class PersistenceException extends RuntimeException
|
|
|
|
{
|
2003-03-28 01:54:19 +01:00
|
|
|
Throwable cause;
|
2003-03-13 20:16:53 +01:00
|
|
|
public PersistenceException(Throwable cause) {
|
2003-03-28 01:54:19 +01:00
|
|
|
this.cause = cause;
|
2003-03-13 20:16:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class Root {
|
|
|
|
Root(String s) throws IOException {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class Foo extends Root {
|
|
|
|
Foo(String s) {
|
|
|
|
super(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
static {
|
|
|
|
if (false) {
|
|
|
|
getFile();
|
|
|
|
throw new IOException("bar");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
if (false) throw new IOException("bar");
|
|
|
|
}
|
|
|
|
|
|
|
|
File f = getFile();
|
|
|
|
|
|
|
|
static File getFile() throws IOException {
|
|
|
|
throw new IOException("bad");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void m() {
|
|
|
|
throw new IOException("hi");
|
|
|
|
}
|
|
|
|
}
|