diff options
author | jhugunin <jhugunin> | 2003-04-24 21:05:44 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-04-24 21:05:44 +0000 |
commit | 598c72655e13bc4f65d2e357ab645b05b69821ca (patch) | |
tree | fb411c9493c52877a5d2480a0e668f3aec8242b8 | |
parent | 2b231e9fb3e1c1edbca2c28865e7e0901c98c0de (diff) | |
download | aspectj-598c72655e13bc4f65d2e357ab645b05b69821ca.tar.gz aspectj-598c72655e13bc4f65d2e357ab645b05b69821ca.zip |
expanded tests and fix for
Bugzilla Bug 36778
ClassFormatError due to empty interface supertype
-rw-r--r-- | tests/ajcTests.xml | 15 | ||||
-rw-r--r-- | tests/ajcTestsFailing.xml | 6 | ||||
-rw-r--r-- | tests/jimTests.xml | 6 | ||||
-rw-r--r-- | tests/new/EmptyInterface.java | 9 | ||||
-rw-r--r-- | tests/new/EmptyInterfaceCE.java | 32 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/Advice.java | 17 |
6 files changed, 67 insertions, 18 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 7bc3af750..4f869e5e4 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -5857,4 +5857,19 @@ <run class="TryFinallyInAround"/> </ajc-test> + <ajc-test dir="new" pr="36778" + title="advise join points in subclass of empty interface"> + <compile files="EmptyInterface.java"/> + <run class="EmptyInterface"/> + </ajc-test> + + <ajc-test dir="new" pr="36778" + title="can't put around advice on interface static initializer" + comment="this tests for a nice message given a compiler limitation"> + <compile files="EmptyInterfaceCE.java"> + <message kind="error" line="20"/> + <message kind="error" line="23"/> + </compile> + </ajc-test> + </suite> diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml index ec15b0ad8..41665da25 100644 --- a/tests/ajcTestsFailing.xml +++ b/tests/ajcTestsFailing.xml @@ -4,11 +4,7 @@ <!-- contains valid tests that the compiler has never passed --> <suite> - <ajc-test dir="new" pr="36778" - title="advise join points in subclass of empty interface"> - <compile files="EmptyInterface.java"/> - <run class="EmptyInterface"/> - </ajc-test> + </suite> diff --git a/tests/jimTests.xml b/tests/jimTests.xml index e350c7f7c..61e8777a6 100644 --- a/tests/jimTests.xml +++ b/tests/jimTests.xml @@ -1,10 +1,6 @@ <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"> <suite> - <ajc-test dir="bugs" pr="36056" - title="Ajc 1.1 rc1 java.lang.VerifyError with messy arounds and naming"> - <compile files="AroundNames.java"/> - <run class="AroundNames"/> - </ajc-test> + <!-- diff --git a/tests/new/EmptyInterface.java b/tests/new/EmptyInterface.java index db53d592a..aca01b6a8 100644 --- a/tests/new/EmptyInterface.java +++ b/tests/new/EmptyInterface.java @@ -17,11 +17,12 @@ public class EmptyInterface { aspect Log { static int hits; static StringBuffer log = new StringBuffer(); - interface LoggedType {} + interface LoggedType { + } declare parents: C implements LoggedType; - void around() : within(LoggedType+) - && !initialization(new(..)) - && !preinitialization(new(..)) // 1.1 only + after() : within(LoggedType+) + //&& !initialization(new(..)) + //&& !preinitialization(new(..)) // 1.1 only { hits++; log.append(thisJoinPoint + ";"); diff --git a/tests/new/EmptyInterfaceCE.java b/tests/new/EmptyInterfaceCE.java new file mode 100644 index 000000000..4fdbbed33 --- /dev/null +++ b/tests/new/EmptyInterfaceCE.java @@ -0,0 +1,32 @@ + + +import org.aspectj.testing.Tester; + +/** @testcase PR#36778 advise join points in subclass of empty interface */ +public class EmptyInterfaceCE { + + public static void main(String[] args) { + new C().go(); + // at least constructor and method execution + if (2 > Log.hits) { + Tester.check(false, Log.log.toString()); + } + } +} + +aspect Log { + static int hits; + static StringBuffer log = new StringBuffer(); + interface LoggedType { + } + declare parents: C implements LoggedType; + void around() : staticinitialization(LoggedType) // CE: limitation + { + hits++; + log.append(thisJoinPoint + ";"); + } +} + +class C { + void go() {} +} diff --git a/weaver/src/org/aspectj/weaver/Advice.java b/weaver/src/org/aspectj/weaver/Advice.java index 4b90c9d35..b25df052c 100644 --- a/weaver/src/org/aspectj/weaver/Advice.java +++ b/weaver/src/org/aspectj/weaver/Advice.java @@ -109,10 +109,19 @@ public abstract class Advice extends ShadowMunger { "around on pre-initialization not supported (compiler limitation)", getSourceLocation(), shadow.getSourceLocation()); return false; - } else if (shadow.getKind() == Shadow.Initialization) { - world.showMessage(IMessage.ERROR, - "around on initialization not supported (compiler limitation)", - getSourceLocation(), shadow.getSourceLocation()); + } else if (shadow.getKind() == Shadow.Initialization) { + world.showMessage(IMessage.ERROR, + "around on initialization not supported (compiler limitation)", + getSourceLocation(), shadow.getSourceLocation()); + return false; + } else if (shadow.getKind() == Shadow.StaticInitialization && + shadow.getEnclosingType().isInterface(world)) + { + world.showMessage(IMessage.ERROR, + "around on staticinitialization of interface \'" + + shadow.getEnclosingType().getName() + + "\' not supported (compiler limitation)", + getSourceLocation(), shadow.getSourceLocation()); return false; } else { //System.err.println(getSignature().getReturnType() + " from " + shadow.getReturnType()); |