]> source.dussan.org Git - aspectj.git/commitdiff
added tests and fixes
authorjhugunin <jhugunin>
Tue, 11 Mar 2003 21:04:59 +0000 (21:04 +0000)
committerjhugunin <jhugunin>
Tue, 11 Mar 2003 21:04:59 +0000 (21:04 +0000)
fixed two bugs in ajcTestsFailing

org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeFieldDeclaration.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
tests/ajcTests.xml
tests/ajcTestsBroken.xml
tests/ajcTestsFailing.xml
tests/bugs/AspectInitError.java [new file with mode: 0644]
tests/bugs/ThisJoinPointAndVerifier.java [new file with mode: 0644]
tests/jimTests.xml

index 583edca78045dbe6e0291e7377aee8737463327d..ef833b13eb9cfc43eb5d91eb373f8c197faa0304 100644 (file)
@@ -67,6 +67,14 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration {
                EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(upperScope);
                ResolvedMember sig = munger.getSignature();
                TypeX aspectType = EclipseFactory.fromBinding(upperScope.referenceContext.binding);
+               
+               if (sig.getReturnType() == ResolvedTypeX.VOID || 
+                               (sig.getReturnType().isArray() && (sig.getReturnType().getComponentType() == ResolvedTypeX.VOID)))
+               {
+                       upperScope.problemReporter().signalError(sourceStart, sourceEnd,
+                               "field type can not be void");
+               }
+               
 //
 //             System.err.println("sig: " + sig);
 //             System.err.println("field: " + world.makeFieldBinding(
@@ -129,6 +137,8 @@ public class InterTypeFieldDeclaration extends InterTypeDeclaration {
                EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(classScope);
                resolveOnType(classScope);
                
+               if (classScope.referenceContext.binding == null) return null;
+               
                binding = classScope.referenceContext.binding.resolveTypesFor(binding);
                if (ignoreFurtherInvestigation) return null;
                
index d1744dafbefe4e0444b5f4484d2e68a821c1c642..68c875bfcdfc072edb4592a7537eecbf08b15bd9 100644 (file)
@@ -108,13 +108,14 @@ public class EclipseFactory {
                if (binding instanceof HelperInterfaceBinding) {
                        return ((HelperInterfaceBinding) binding).getTypeX();
                }
-               if (binding.qualifiedSourceName() == null) {
+               if (binding == null || binding.qualifiedSourceName() == null) {
                        return ResolvedTypeX.MISSING;
                }
                return TypeX.forName(getName(binding));
        }
 
        public static TypeX[] fromBindings(TypeBinding[] bindings) {
+               if (bindings == null) return TypeX.NONE;
                int len = bindings.length;
                TypeX[] ret = new TypeX[len];
                for (int i=0; i<len; i++) {
index 54261ece4c4b1fcfbeb6bfb3d1becfbaecb71fa5..321afe3d936e231f3e2c51ef2f28270443fd2e4c 100644 (file)
         <compile files="TransactionTest.java,sub/ExecutionMonitor.java,sub/ObserverProtocol.aj"/>
         <run class="TransactionTest"/>
     </ajc-test>
+    
+    <ajc-test dir="bugs" pr="34210" 
+               title="thisJoinPoint.getArgs() causes IncompatibleClassChangeError">
+        <compile files="ThisJoinPointAndVerifier.java"/>
+        <run class="ThisJoinPointAndVerifier"/>
+    </ajc-test>
+    
+    <ajc-test dir="errors"  keywords="error"
+               title="inter-type declaration of void field">
+        <compile files="VoidFieldDeclarationCE.java">
+                       <message kind="error" line="7"/>
+        </compile>
+    </ajc-test>
+    
+    <ajc-test dir="binding"
+      title="no such constructor for proceed argument (error)">
+        <compile files="UnfoundConstructor.java">
+               <message kind="error" line="25"/>
+        </compile>
+    </ajc-test>
 </suite>
index 6fc14b27fd7b587689741f80368044a6774d48df..d919e26e4b12dcb4d6007d609de444b675e411b6 100644 (file)
@@ -67,5 +67,9 @@
         </compile>
     </ajc-test>
 
-
+    <ajc-test dir="bugs" pr="33948" 
+               title="default constructor inter-type declaration">
+        <compile files="ConstructorDeclaration.java"/>
+        <run class="ConstructorDeclaration"/>
+    </ajc-test>
 </suite>
index 2073f0e7cfb19437a49b2ead3b23006e3763e9b6..051196a60faf58493fbd16efa09a7b5faa4a4c78 100644 (file)
         </compile>
     </ajc-test>
 
-    <ajc-test dir="binding"
-      title="no such constructor for proceed argument (error)">
-        <compile files="UnfoundConstructor.java">
-               <message kind="error" line="25"/>
-        </compile>
-    </ajc-test>
-
-    <ajc-test dir="bugs" pr="33948" 
-               title="default constructor inter-type declaration">
-        <compile files="ConstructorDeclaration.java"/>
-        <run class="ConstructorDeclaration"/>
-    </ajc-test>
-
     <ajc-test dir="errors"  keywords="error"
                title="class extending abstract aspect">
         <compile files="ClassExtendingAbstractAspectCE.java">
         </compile>
     </ajc-test>
 
-    <ajc-test dir="errors"  keywords="error"
-               title="inter-type declaration of void field">
-        <compile files="VoidFieldDeclarationCE.java">
-                       <message kind="error" line="7"/>
-        </compile>
-    </ajc-test>
-
     <ajc-test dir="incremental/stringliteral"  
                title="incrementally change string size and wire in injar classes">
         <compile staging="true" options="-incremental" 
                                         before main packageOne.Main"/>
     </ajc-test>
 
+    <ajc-test dir="bugs" pr="34206" 
+               title="before():execution(new(..)) does not throw NoAspectBoundException">
+        <compile files="AspectInitError.java"/>
+        <run class="AspectInitError"/>
+    </ajc-test>
+
 </suite>
diff --git a/tests/bugs/AspectInitError.java b/tests/bugs/AspectInitError.java
new file mode 100644 (file)
index 0000000..3a46b9c
--- /dev/null
@@ -0,0 +1,23 @@
+
+
+/** Bugzilla Bug 34206  
+   before():execution(new(..)) does not throw NoAspectBoundException   */
+public class AspectInitError {
+       public static void main(String[] args) {
+               //Watchcall.aspectOf();
+              AspectInitError c = new AspectInitError();
+          }
+
+}
+
+aspect Watchcall {
+      pointcut myConstructor(): execution(new(..));
+
+  before(): myConstructor() {
+          System.err.println("Entering Constructor");
+  }
+
+  after(): myConstructor() {
+      System.err.println("Leaving Constructor");
+  }
+}
diff --git a/tests/bugs/ThisJoinPointAndVerifier.java b/tests/bugs/ThisJoinPointAndVerifier.java
new file mode 100644 (file)
index 0000000..a3b609c
--- /dev/null
@@ -0,0 +1,28 @@
+
+
+/** Bugzilla Bug 34210  
+   thisJoinPoint.getArgs() causes IncompatibleClassChangeError  */
+public class ThisJoinPointAndVerifier {
+       public void method() {
+               System.out.println("Executed method");
+       }
+       public static void main(String args[]) {
+               ThisJoinPointAndVerifier td = new ThisJoinPointAndVerifier();
+               td.method();
+       }
+}
+
+aspect Log1 {  
+       pointcut logged_method() : 
+               call(* ThisJoinPointAndVerifier.*(..));    
+       after() : logged_method() {
+               Object[] args = thisJoinPoint.getArgs();        
+               System.out.println ("Log1a: leaving " + thisJoinPoint.getSignature());
+       }    
+       // comment this advice for scenario 2
+       after() : logged_method() {
+               //VM crash on scenario 1
+               //Object[] args = thisJoinPoint.getArgs(); 
+               System.out.println ("Log1b: leaving " + thisJoinPoint.getSignature());    
+       }
+}
\ No newline at end of file
index e7e9b8b977819bb303aa5b176cf0e8f7a5c9bb56..17db88e593c9e8d2eeeba06bc81424c1054faa1c 100644 (file)
@@ -1,5 +1,26 @@
 <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd">
 <suite>
+    <ajc-test dir="new/declare" pr="31724"
+            title="omnibus declare warning context"
+          comment="XXX untested: no source context shown">
+        <compile files="DeclareWarning.java">
+            <message kind="warning" line="5"/>
+            <message kind="warning" line="12"/>
+            <message kind="warning" line="13"/>
+            <message kind="warning" line="14"/>
+            <message kind="warning" line="15"/>
+            <message kind="warning" line="16"/>
+            <message kind="warning" line="17"/>
+            <message kind="warning" line="18"/>
+            <message kind="warning" line="21"/>
+            <message kind="warning" line="22"/>
+            <message kind="warning" line="23"/>
+            <message kind="warning" line="33"/>
+            <message kind="warning" line="36"/>
+            <message kind="warning" line="39"/>
+            <message kind="warning" line="74"/>
+        </compile>
+    </ajc-test>
 
     <!--