From ba41fae6547688e8714d01be27bc81dbbe850f55 Mon Sep 17 00:00:00 2001 From: jhugunin Date: Wed, 2 Jul 2003 23:12:18 +0000 Subject: tests and fixes for two awful error message bugs: [Bug 39458] New: Compiler crash in ajc 1.1 [Bug 39460] New: Missing import crashes compiler --- tests/bugs/MissingImport.java | 22 ++++++++++++++++++++++ tests/bugs/NewVoid.java | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 tests/bugs/MissingImport.java create mode 100644 tests/bugs/NewVoid.java (limited to 'tests/bugs') diff --git a/tests/bugs/MissingImport.java b/tests/bugs/MissingImport.java new file mode 100644 index 000000000..c70129e50 --- /dev/null +++ b/tests/bugs/MissingImport.java @@ -0,0 +1,22 @@ +import org.aspectj.lang.*; +import org.aspectj.lang.reflect.*; +import java.lang.reflect.Method; +//import java.lang.reflect.InvocationTargetException; <- crash with this line commented out + +public aspect MissingImport { + Object around() : + call(* *(..)) && !within(ImposterProcessing+) { + MethodSignature sig = (MethodSignature)thisJoinPoint.getSignature(); + try { + Method meth = ImposterProcessing.class.getMethod("dynamicThrow", new Class[] { Throwable.class }); + meth.invoke(this, new Object[] { null }); + } catch (InvocationTargetException e) { // expect CE + throw new RuntimeException("framework error in throwing test exception ", e); + } catch (IllegalAccessException e) { + throw new RuntimeException("framework error in throwing test exception ", e); + } + return null; + } +} + +class ImposterProcessing { } \ No newline at end of file diff --git a/tests/bugs/NewVoid.java b/tests/bugs/NewVoid.java new file mode 100644 index 000000000..0162b5313 --- /dev/null +++ b/tests/bugs/NewVoid.java @@ -0,0 +1,33 @@ +import org.aspectj.lang.*; +import org.aspectj.lang.reflect.*; +import java.lang.reflect.Method; + +public aspect NewVoid { + Object around() : + call(new(..)) { + return proceed(); + } + + + Object around() : + call(* *(..)) { + MethodSignature sig = (MethodSignature)thisJoinPoint.getSignature(); + Class returnType = sig.getReturnType(); + if (returnType == java.lang.Void.TYPE) { + return new java.lang.Void(); // expect CE here + } else { + String s = "hi"; + Xyz xyz = null; // expect CE here + int x = s.count; // expect CE here + return proceed(); + } + } +} +privileged aspect PrivCheck { + Object around() : call(* *(..)) { + Xyz xyz = null; // expect CE here + Object o = new Void(); // expect warning here + int x = "goo".count; // expect warning here + return null; + } +} \ No newline at end of file -- cgit v1.2.3