]> source.dussan.org Git - aspectj.git/commitdiff
expanded tests and fix for
authorjhugunin <jhugunin>
Thu, 24 Apr 2003 21:05:44 +0000 (21:05 +0000)
committerjhugunin <jhugunin>
Thu, 24 Apr 2003 21:05:44 +0000 (21:05 +0000)
Bugzilla Bug 36778
   ClassFormatError due to empty interface supertype

tests/ajcTests.xml
tests/ajcTestsFailing.xml
tests/jimTests.xml
tests/new/EmptyInterface.java
tests/new/EmptyInterfaceCE.java [new file with mode: 0644]
weaver/src/org/aspectj/weaver/Advice.java

index 7bc3af75020bf88e3df01d8533e40f7ea490d2ab..4f869e5e4a4d0c52cca03e02878864b29838ade1 100644 (file)
         <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>
index ec15b0ad8ab9d7b1760f43429fd4738eda10abc8..41665da253e7e8fec3881bf52990a174d7c73c57 100644 (file)
@@ -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>
index e350c7f7c5a3b715e97df80907340235d1d3129d..61e8777a6fa888fc665b66eb2061fed4a9c41c41 100644 (file)
@@ -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>
+
     
 
     <!--
index db53d592ac10b6670a594a55b1ba9ae7f32d531a..aca01b6a88eb2b6bbe594a38b95e5ed6e9798fb0 100644 (file)
@@ -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 (file)
index 0000000..4fdbbed
--- /dev/null
@@ -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() {}
+}
index 4b90c9d35c631ba6dcd601b5387a7d20497b2f67..b25df052c0288d891f6bc0840da82165fe873922 100644 (file)
@@ -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());