]> source.dussan.org Git - aspectj.git/commitdiff
293457: test and fix
authoraclement <aclement>
Thu, 19 Nov 2009 17:01:09 +0000 (17:01 +0000)
committeraclement <aclement>
Thu, 19 Nov 2009 17:01:09 +0000 (17:01 +0000)
tests/bugs167/pr293457/com/citi/gdos/smart/applib/service/cache/CachingIntroduction.aj [new file with mode: 0644]
tests/bugs167/pr293457/org/springmodules/cache/annotations/Cacheable.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc167/Ajc167Tests.java
tests/src/org/aspectj/systemtest/ajc167/IntertypeTests.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc167/ajc167.xml
tests/src/org/aspectj/systemtest/ajc167/intertype.xml [new file with mode: 0644]

diff --git a/tests/bugs167/pr293457/com/citi/gdos/smart/applib/service/cache/CachingIntroduction.aj b/tests/bugs167/pr293457/com/citi/gdos/smart/applib/service/cache/CachingIntroduction.aj
new file mode 100644 (file)
index 0000000..33c99de
--- /dev/null
@@ -0,0 +1,11 @@
+ package com.citi.gdos.smart.applib.service.cache;
+       
+        import org.springmodules.cache.annotations.Cacheable;
+       
+        public aspect CachingIntroduction {
+       
+               declare @method: public * *..I*Dao+.set*(..): @Setter; 
+               declare @method: !@Setter public * *..I*Dao+.*(..):
+                       @Cacheable(modelId="fooModel");
+       
+        }
\ No newline at end of file
diff --git a/tests/bugs167/pr293457/org/springmodules/cache/annotations/Cacheable.java b/tests/bugs167/pr293457/org/springmodules/cache/annotations/Cacheable.java
new file mode 100644 (file)
index 0000000..e43cc74
--- /dev/null
@@ -0,0 +1,5 @@
+package org.springmodules.cache.annotations;
+
+public @interface Cacheable {
+
+}
index 5703a9824194a1fb581302c145f8856fe1d3d438..2b79abd49ff1570133a2b62c0bd2b66dcd01b8b2 100644 (file)
@@ -18,6 +18,10 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
 
 public class Ajc167Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 
+       public void testHierarchyBuilderNPE_pr293457() {
+               runTest("hierarchy builder npe");
+       }
+       
        public void testTimers_1() {
                runTest("timers - 1");
        }
diff --git a/tests/src/org/aspectj/systemtest/ajc167/IntertypeTests.java b/tests/src/org/aspectj/systemtest/ajc167/IntertypeTests.java
new file mode 100644 (file)
index 0000000..5aa2d41
--- /dev/null
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Contributors 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc167;
+
+import java.io.File;
+
+import junit.framework.Test;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+/**
+ * Tests for the new all singing all dancing intertype syntax.
+ * 
+ * @author Andy Clement
+ */
+public class IntertypeTests extends org.aspectj.testing.XMLBasedAjcTestCase {
+
+       // absolutely trivial, just parse something and dont crash
+       public void testSimple() {
+               runTest("simple");
+       }
+       
+       // simple field inside the intertype scope
+       public void testSimpleWithField() {
+               runTest("simple with field");
+       }
+
+       // simple field inside the intertype scope and method after the intertype scope
+       public void testSimpleWithField2() {
+               runTest("simple with field2");
+       }
+       
+       // now a method that new's up an instance of the type targetted by the intertype scope
+       public void testNewInstance() {
+               runTest("new instance");
+       }
+
+       // now aspect method attempts to new up target of the itd scope and access something introduced by it
+       public void testNewInstanceAndAccess() {
+               runTest("new instance and access");
+       }
+       
+       // two fields
+       public void testNewInstanceAndAccess2() {
+               runTest("new instance and access to two fields");
+       }
+       
+       // more tests:
+       // intertype X { int a,b,c=4; }
+       // intertype X { int a=4,b=3; } // can we say that?
+
+       // extends/implements on the intertype become declare parents
+       // annotations on the intertype become declare @type
+       
+       // what about recovery when we have a problem leaving the scope of the intertype block? How do we make sure 
+       // we don't accidentally use the activeScope for ordinary methods? Can we even check that...
+       
+       
+       // --
+
+       public static Test suite() {
+               return XMLBasedAjcTestCase.loadSuite(IntertypeTests.class);
+       }
+
+       protected File getSpecFile() {
+               return new File("../tests/src/org/aspectj/systemtest/ajc167/intertype.xml");
+       }
+
+}
\ No newline at end of file
index 8306be1e1b0a8000fd2aa82a1a1b10585ed73d5a..be134a2f0025848cf0e5ab5dfc4f2f9a7531bd46 100644 (file)
@@ -2,6 +2,14 @@
 
 <suite>
 
+  <ajc-test dir="bugs167/pr293457" title="hierarchy builder npe">
+     <compile files="com/citi/gdos/smart/applib/service/cache/CachingIntroduction.aj org/springmodules/cache/annotations/Cacheable.java" options="-1.5 -emacssym">
+     <message kind="warning" text="no match for this type name: Setter"/>
+     <message kind="error" text="Setter cannot be resolved to a type"/>
+     <message kind="error" text="The attribute modelId is undefined for the"/>
+     </compile>
+  </ajc-test>
+  
   <ajc-test dir="features167/timers/one" title="timers - 1">
     <compile files="Code.java Code2.java" outjar="code.jar" options="-1.5 -Xlint:ignore"/>
     <compile files="Asp.java" options="-1.5 -Xlint:ignore" outjar="asp.jar"/>
diff --git a/tests/src/org/aspectj/systemtest/ajc167/intertype.xml b/tests/src/org/aspectj/systemtest/ajc167/intertype.xml
new file mode 100644 (file)
index 0000000..a432ee1
--- /dev/null
@@ -0,0 +1,41 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<suite>
+   
+   <ajc-test dir="features167/intertype" title="simple">
+     <compile files="Simple.java" options="-1.5"/>
+   </ajc-test>
+   
+   <ajc-test dir="features167/intertype" title="simple with field">
+     <compile files="Two.java" options="-1.5"/>
+   </ajc-test>
+   
+   <ajc-test dir="features167/intertype" title="simple with field2">
+     <compile files="Three.java" options="-1.5"/>
+   </ajc-test>
+   
+   <ajc-test dir="features167/intertype" title="new instance">
+     <compile files="Four.java" options="-1.5"/>
+   </ajc-test>
+   
+   <ajc-test dir="features167/intertype" title="new instance and access">
+     <compile files="Five.java" options="-1.5"/>
+     <run class="Five">
+       <stdout>
+         <line text="5"/>
+       </stdout>
+     </run>
+   </ajc-test>
+   
+   <ajc-test dir="features167/intertype" title="new instance and access to two fields">
+     <compile files="Six.java" options="-1.5"/>
+     <run class="Six">
+       <stdout>
+         <line text="5"/>
+       </stdout>
+     </run>
+   </ajc-test>
+   
+   
+
+</suite>
\ No newline at end of file