]> source.dussan.org Git - aspectj.git/commitdiff
44365: is() support in type patterns
authoraclement <aclement>
Fri, 19 Mar 2010 15:42:02 +0000 (15:42 +0000)
committeraclement <aclement>
Fri, 19 Mar 2010 15:42:02 +0000 (15:42 +0000)
13 files changed:
tests/bugs169/pr44365/Errors1.java [new file with mode: 0644]
tests/bugs169/pr44365/Errors5.java [new file with mode: 0644]
tests/bugs169/pr44365/SimpleAnnotation.java [new file with mode: 0644]
tests/bugs169/pr44365/SimpleAnonymous.java [new file with mode: 0644]
tests/bugs169/pr44365/SimpleAspect.java [new file with mode: 0644]
tests/bugs169/pr44365/SimpleClass.java [new file with mode: 0644]
tests/bugs169/pr44365/SimpleEnum.java [new file with mode: 0644]
tests/bugs169/pr44365/SimpleInner.java [new file with mode: 0644]
tests/bugs169/pr44365/SimpleInner2.java [new file with mode: 0644]
tests/bugs169/pr44365/SimpleInner3.java [new file with mode: 0644]
tests/bugs169/pr44365/SimpleInterface.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc169/Ajc169Tests.java
tests/src/org/aspectj/systemtest/ajc169/ajc169.xml

diff --git a/tests/bugs169/pr44365/Errors1.java b/tests/bugs169/pr44365/Errors1.java
new file mode 100644 (file)
index 0000000..33e3bda
--- /dev/null
@@ -0,0 +1,3 @@
+public aspect Errors1 {
+  before(): within(is( && !is(AnonymousType)) && staticinitialization(*) {}
+}
diff --git a/tests/bugs169/pr44365/Errors5.java b/tests/bugs169/pr44365/Errors5.java
new file mode 100644 (file)
index 0000000..e14c2de
--- /dev/null
@@ -0,0 +1,11 @@
+public aspect Errors5 {
+  before(): execution(* (is(InnerType) && *).*(..)) {}
+  before(): execution(* (is)) && *).*(..)) {}
+}
+
+class C {
+  class Foo {
+    public void m() {}
+  }
+    public void m() {}
+}
diff --git a/tests/bugs169/pr44365/SimpleAnnotation.java b/tests/bugs169/pr44365/SimpleAnnotation.java
new file mode 100644 (file)
index 0000000..69a7785
--- /dev/null
@@ -0,0 +1,18 @@
+public class SimpleAnnotation {
+}
+
+enum Foo {
+}
+
+@interface WibbleAnno {
+}
+
+class Bar {
+}
+
+interface I {
+}
+
+aspect X {
+  before(): within(is(AnnotationType)) && staticinitialization(*) {}
+}
diff --git a/tests/bugs169/pr44365/SimpleAnonymous.java b/tests/bugs169/pr44365/SimpleAnonymous.java
new file mode 100644 (file)
index 0000000..33b3cda
--- /dev/null
@@ -0,0 +1,21 @@
+public class SimpleAnonymous {
+}
+
+enum Foo {
+}
+
+@interface WibbleAnno {
+}
+
+class Bar {
+  Runnable r = new Runnable() {
+    public void run() {}
+  };
+}
+
+interface I {
+}
+
+aspect X {
+  before(): within(is(AnonymousType)) && staticinitialization(*) {}
+}
diff --git a/tests/bugs169/pr44365/SimpleAspect.java b/tests/bugs169/pr44365/SimpleAspect.java
new file mode 100644 (file)
index 0000000..69bb848
--- /dev/null
@@ -0,0 +1,21 @@
+public class SimpleAspect {
+}
+
+enum Foo {
+}
+
+@interface WibbleAnno {
+}
+
+class Bar {
+  Runnable r = new Runnable() {
+    public void run() {}
+  };
+}
+
+interface I {
+}
+
+aspect X {
+  before(): within(is(AspectType)) && staticinitialization(*) {}
+}
diff --git a/tests/bugs169/pr44365/SimpleClass.java b/tests/bugs169/pr44365/SimpleClass.java
new file mode 100644 (file)
index 0000000..ed97b70
--- /dev/null
@@ -0,0 +1,12 @@
+public class SimpleClass {
+}
+
+interface Foo {
+}
+
+class Bar {
+}
+
+aspect X {
+  before(): within(is(ClassType)) && staticinitialization(*) {}
+}
diff --git a/tests/bugs169/pr44365/SimpleEnum.java b/tests/bugs169/pr44365/SimpleEnum.java
new file mode 100644 (file)
index 0000000..6f1ecbe
--- /dev/null
@@ -0,0 +1,15 @@
+public class SimpleEnum {
+}
+
+enum Foo {
+}
+
+class Bar {
+}
+
+interface I {
+}
+
+aspect X {
+  before(): within(is(EnumType)) && staticinitialization(*) {}
+}
diff --git a/tests/bugs169/pr44365/SimpleInner.java b/tests/bugs169/pr44365/SimpleInner.java
new file mode 100644 (file)
index 0000000..60a30e7
--- /dev/null
@@ -0,0 +1,22 @@
+public class SimpleInner {
+}
+
+enum Foo {
+}
+
+@interface WibbleAnno {
+}
+
+class Bar {
+  public class Inner {}
+  Runnable r = new Runnable() {
+    public void run() {}
+  };
+}
+
+interface I {
+}
+
+aspect X {
+  before(): within(is(InnerType)) && staticinitialization(*) {}
+}
diff --git a/tests/bugs169/pr44365/SimpleInner2.java b/tests/bugs169/pr44365/SimpleInner2.java
new file mode 100644 (file)
index 0000000..7f6819b
--- /dev/null
@@ -0,0 +1,22 @@
+public class SimpleInner2 {
+}
+
+enum Foo {
+}
+
+@interface WibbleAnno {
+}
+
+class Bar {
+  public class Inner {}
+  Runnable r = new Runnable() {
+    public void run() {}
+  };
+}
+
+interface I {
+}
+
+aspect X {
+  before(): within(is(InnerType) && !is(AnonymousType)) && staticinitialization(*) {}
+}
diff --git a/tests/bugs169/pr44365/SimpleInner3.java b/tests/bugs169/pr44365/SimpleInner3.java
new file mode 100644 (file)
index 0000000..5fa28f7
--- /dev/null
@@ -0,0 +1,24 @@
+public class SimpleInner3 {
+}
+
+enum Foo {
+}
+
+@interface WibbleAnno {
+}
+
+class Bar {
+  public class Inner {
+    public void foo() {}
+  }
+  Runnable r = new Runnable() {
+    public void run() {}
+  };
+}
+
+interface I {
+}
+
+aspect X {
+  before(): execution(* (is(InnerType) && !is(AnonymousType) && *).*(..)) {}
+}
diff --git a/tests/bugs169/pr44365/SimpleInterface.java b/tests/bugs169/pr44365/SimpleInterface.java
new file mode 100644 (file)
index 0000000..95dc1e2
--- /dev/null
@@ -0,0 +1,12 @@
+public class SimpleInterface {
+}
+
+interface Foo {
+}
+
+class Bar {
+}
+
+aspect X {
+  before(): within(is(InterfaceType)) && staticinitialization(*) {}
+}
index 2d04b660ae40c702d62a0371a7fe59ed8c00dec1..3773e6cf4c2742d16cfb6d29ce24321f8ed6176f 100644 (file)
@@ -18,33 +18,69 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
 
 public class Ajc169Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 
-       /*public void testAmbiguousMethod() {
-               runTest("ambiguous method");
-       }*/
+       public void testTypePatternCategories_44365_Class() {
+               runTest("type category type patterns - class");
+       }
 
-       public void testChecker() {
-               runTest("inserts in messages");
+       public void testTypePatternCategories_44365_Interface() {
+               runTest("type category type patterns - interface");
+       }
+
+       public void testTypePatternCategories_44365_Enum() {
+               runTest("type category type patterns - enum");
        }
-/*
-       public void testVerifyError() {
-               runTest("verifyerror on atAj");
+
+       public void testTypePatternCategories_44365_Annotation() {
+               runTest("type category type patterns - annotation");
+       }
+
+       public void testTypePatternCategories_44365_Anonymous() {
+               runTest("type category type patterns - anonymous");
+       }
+
+       public void testTypePatternCategories_44365_Inner() {
+               runTest("type category type patterns - inner");
        }
 
-       public void testDeclareTypeWarning1() {
-               runTest("declare type warning - 1");
+       public void testTypePatternCategories_44365_Inner_2() {
+               runTest("type category type patterns - inner - 2");
        }
 
-       public void testDeclareTypeWarning2() {
-               runTest("declare type warning - 2");
+       public void testTypePatternCategories_44365_Inner_3() {
+               runTest("type category type patterns - inner - 3");
        }
 
-       public void testDeclareTypeWarning3() {
-               runTest("declare type warning - 3");
+       public void testTypePatternCategories_44365_Aspect() {
+               runTest("type category type patterns - aspect");
+       }
+
+       public void testTypePatternCategories_44365_e1() {
+               runTest("type category type patterns - e1");
+       }
+
+       public void testTypePatternCategories_44365_e2() {
+               runTest("type category type patterns - e2");
+       }
+
+       /*
+        * public void testAmbiguousMethod() { runTest("ambiguous method"); }
+        */
+
+       public void testChecker() {
+               runTest("inserts in messages");
        }
 
-       public void testDeclareTypeError1() {
-               runTest("declare type error - 1");
-       }*/
+       /*
+        * public void testVerifyError() { runTest("verifyerror on atAj"); }
+        * 
+        * public void testDeclareTypeWarning1() { runTest("declare type warning - 1"); }
+        * 
+        * public void testDeclareTypeWarning2() { runTest("declare type warning - 2"); }
+        * 
+        * public void testDeclareTypeWarning3() { runTest("declare type warning - 3"); }
+        * 
+        * public void testDeclareTypeError1() { runTest("declare type error - 1"); }
+        */
 
        public void testPr298388() {
                runTest("declare mixin and generics");
index c3e79969e7eed9b43c7aad419b779c6c142e48c0..ea56e87bce4fd5e660cc10df90b2c0a1850231eb 100644 (file)
@@ -1,7 +1,75 @@
 <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
 
 <suite>
+
+   <ajc-test dir="bugs169/pr44365" title="type category type patterns - class">
+     <compile files="SimpleClass.java" options="-1.5 -showWeaveInfo">
+       <message kind="weave" text="Join point 'staticinitialization(void SimpleClass.&lt;clinit&gt;())' in Type 'SimpleClass'"/>
+       <message kind="weave" text="Join point 'staticinitialization(void Bar.&lt;clinit&gt;())' in Type 'Bar'"/>
+     </compile>
+  </ajc-test>
+  
+   <ajc-test dir="bugs169/pr44365" title="type category type patterns - interface">
+     <compile files="SimpleInterface.java" options="-1.5 -showWeaveInfo">
+       <message kind="weave" text="Join point 'staticinitialization(void Foo.&lt;clinit&gt;())' in Type 'Foo'"/>
+     </compile>
+  </ajc-test>
+  
+   <ajc-test dir="bugs169/pr44365" title="type category type patterns - enum">
+     <compile files="SimpleEnum.java" options="-1.5 -showWeaveInfo">
+       <message kind="weave" text="Join point 'staticinitialization(void Foo.&lt;clinit&gt;())' in Type 'Foo'"/>
+     </compile>
+  </ajc-test>
    
+   <ajc-test dir="bugs169/pr44365" title="type category type patterns - annotation">
+     <compile files="SimpleAnnotation.java" options="-1.5 -showWeaveInfo">
+       <message kind="weave" text="Join point 'staticinitialization(void WibbleAnno.&lt;clinit&gt;())' in Type 'WibbleAnno'"/>
+     </compile>
+  </ajc-test>
+  
+  <ajc-test dir="bugs169/pr44365" title="type category type patterns - anonymous">
+     <compile files="SimpleAnonymous.java" options="-1.5 -showWeaveInfo">
+       <message kind="weave" text="Join point 'staticinitialization(void Bar$1.&lt;clinit&gt;())' in Type 'Bar$1'"/>
+     </compile>
+  </ajc-test>
+  
+   <ajc-test dir="bugs169/pr44365" title="type category type patterns - inner">
+     <compile files="SimpleInner.java" options="-1.5 -showWeaveInfo">
+       <message kind="weave" text="Join point 'staticinitialization(void Bar$Inner.&lt;clinit&gt;())' in Type 'Bar$Inner'"/>
+       <message kind="weave" text="Join point 'staticinitialization(void Bar$1.&lt;clinit&gt;())' in Type 'Bar$1'"/>
+     </compile>
+  </ajc-test>
+  
+   <ajc-test dir="bugs169/pr44365" title="type category type patterns - inner - 2">
+     <compile files="SimpleInner2.java" options="-1.5 -showWeaveInfo">
+       <message kind="weave" text="Join point 'staticinitialization(void Bar$Inner.&lt;clinit&gt;())' in Type 'Bar$Inner'"/>
+     </compile>
+  </ajc-test>
+  
+   <ajc-test dir="bugs169/pr44365" title="type category type patterns - inner - 3">
+     <compile files="SimpleInner3.java" options="-1.5 -showWeaveInfo">
+       <message kind="weave" text="Join point 'method-execution(void Bar$Inner.foo())' in Type 'Bar$Inner' (SimpleInner3.java:12) advised"/>
+     </compile>
+  </ajc-test>
+   
+   <ajc-test dir="bugs169/pr44365" title="type category type patterns - aspect">
+     <compile files="SimpleAspect.java" options="-1.5 -showWeaveInfo">
+       <message kind="weave" text="Join point 'staticinitialization(void X.&lt;clinit&gt;())' in Type 'X'"/>
+     </compile>
+  </ajc-test>
+  
+   <ajc-test dir="bugs169/pr44365" title="type category type patterns - e1">
+     <compile files="Errors1.java" options="-1.5 -showWeaveInfo">
+       <message kind="error" text="Syntax error on token &quot;&amp;&amp;&quot;, &quot;ClassType"/>
+     </compile>
+  </ajc-test>
+  
+   <ajc-test dir="bugs169/pr44365" title="type category type patterns - e2">
+     <compile files="Errors5.java" options="-1.5 -showWeaveInfo">
+       <message kind="error" text="Syntax error on token &quot;)&quot;, &quot;(&quot; expected"/>
+     </compile>
+  </ajc-test>
+
    <ajc-test dir="bugs169/pr48080" title="inserts in messages">
      <compile files="Warnings.java" options="-1.5">
        <message kind="warning" text="UNKNOWN_KEY{}foobar"/>