]> source.dussan.org Git - aspectj.git/commitdiff
fix for class not allowed to extend aspect and moving corresponding test out of failing
authorjhugunin <jhugunin>
Wed, 12 Mar 2003 23:37:01 +0000 (23:37 +0000)
committerjhugunin <jhugunin>
Wed, 12 Mar 2003 23:37:01 +0000 (23:37 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
tests/ajcTests.xml
tests/ajcTestsFailing.xml
tests/jimTests.xml

index 522b8019789ce894aa8a9a73e3076e7380533193..797ae15c3968909ef72613f13378e5dfcb70c41d 100644 (file)
@@ -122,6 +122,15 @@ public class AjLookupEnvironment extends LookupEnvironment {
                }
                
                SourceTypeBinding sourceType = s.referenceContext.binding;
+               // test classes don't extend aspects
+               if (sourceType.superclass != null) {
+                       ResolvedTypeX parent = factory.fromEclipse(sourceType.superclass);
+                       if (parent.isAspect() && !(dec instanceof AspectDeclaration)) {
+                               factory.showMessage(IMessage.ERROR, "class \'" + new String(sourceType.sourceName) + 
+                                               "\' can not extend aspect \'" + parent.getName() + "\'",
+                                               factory.fromEclipse(sourceType).getSourceLocation(), null);
+                       }
+               }
 
                ReferenceBinding[] memberTypes = sourceType.memberTypes;
                for (int i = 0, length = memberTypes.length; i < length; i++) {
index 1e192ba8a1d2eab0a252d05b41ac6efc35142bdb..5f477a19bd6476826c593093dde5085ee07f3552 100644 (file)
                <message kind="error" line="6"/>
         </compile>
        </ajc-test>
+       
+    <ajc-test dir="errors"  keywords="error"
+               title="class extending abstract aspect">
+        <compile files="ClassExtendingAbstractAspectCE.java">
+                       <message kind="error" line="20"/>
+        </compile>
+    </ajc-test>
 </suite>
index 578f0aa7529b915fa7d5a035359ffecab3d7a5ed..30dfe916044fe74c3ba62afbc4f6a7d1e9eaed3c 100644 (file)
         </compile>
     </ajc-test>
 
-    <ajc-test dir="errors"  keywords="error"
-               title="class extending abstract aspect">
-        <compile files="ClassExtendingAbstractAspectCE.java">
-                       <message kind="error" line="20"/>
-        </compile>
-    </ajc-test>
-
     <ajc-test dir="incremental/stringliteral"  
                title="incrementally change string size and wire in injar classes">
         <compile staging="true" options="-incremental" 
@@ -43,6 +36,7 @@
                                         before main packageOne.Main"/>
     </ajc-test>
 
+       <!--  The correct behavior of this case needs to be thought through -->
     <ajc-test dir="bugs" pr="34206" 
                title="before():execution(new(..)) does not throw NoAspectBoundException">
         <compile files="AspectInitError.java"/>
index f4adb0f97b4169c97f1ff3bb7378fea2527ed510..7c1c4af1fe8338872a68a12589abe377cd02e4ec 100644 (file)
@@ -1,9 +1,6 @@
 <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd">
 <suite>
 
-
-
-
     <!--
     
     <ajc-test dir="new" pr="885"