]> source.dussan.org Git - aspectj.git/commitdiff
284862: test and fix
authoraclement <aclement>
Mon, 10 Aug 2009 18:13:36 +0000 (18:13 +0000)
committeraclement <aclement>
Mon, 10 Aug 2009 18:13:36 +0000 (18:13 +0000)
tests/bugs166/pr284862/AnnotatedMethodImpl.aj [new file with mode: 0644]
tests/bugs166/pr284862/AnnotatedMethodInterface.java [new file with mode: 0644]
tests/bugs166/pr284862/AspectToMatch.aj [new file with mode: 0644]
tests/bugs166/pr284862/Entity.java [new file with mode: 0644]
tests/bugs166/pr284862/EntityClass.java [new file with mode: 0644]
tests/bugs166/pr284862/InterfaceToAdd.java [new file with mode: 0644]
tests/bugs166/pr284862/PresentAnnotation.java [new file with mode: 0644]
tests/bugs166/pr284862/SearchAnnotation.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc166/Ajc166Tests.java
tests/src/org/aspectj/systemtest/ajc166/ajc166.xml

diff --git a/tests/bugs166/pr284862/AnnotatedMethodImpl.aj b/tests/bugs166/pr284862/AnnotatedMethodImpl.aj
new file mode 100644 (file)
index 0000000..0bbe39b
--- /dev/null
@@ -0,0 +1,9 @@
+
+public aspect AnnotatedMethodImpl {
+
+       @PresentAnnotation
+       public String AnnotatedMethodInterface.getSomething() {
+               return "meth";
+       }
+       
+}
diff --git a/tests/bugs166/pr284862/AnnotatedMethodInterface.java b/tests/bugs166/pr284862/AnnotatedMethodInterface.java
new file mode 100644 (file)
index 0000000..c2d135e
--- /dev/null
@@ -0,0 +1,6 @@
+
+public interface AnnotatedMethodInterface {
+
+       @PresentAnnotation
+       public String getSomething();
+}
diff --git a/tests/bugs166/pr284862/AspectToMatch.aj b/tests/bugs166/pr284862/AspectToMatch.aj
new file mode 100644 (file)
index 0000000..04f88de
--- /dev/null
@@ -0,0 +1,29 @@
+
+public aspect AspectToMatch {
+
+       //declare parents : ((@Entity *) && !hasmethod(@SearchAnnotation public * get*()) && !hasfield(@SearchAnnotations * *)) implements InterfaceToAdd;
+       declare parents : ((@Entity *) && !hasmethod(@SearchAnnotation public * get*()) && 
+                                   !hasfield(@SearchAnnotation * *)) implements InterfaceToAdd;
+       
+       /*
+       declare warning :
+               staticinitialization(
+                       !hasmethod(* getMamma())
+                       ) : "Not found";
+       */
+       /*
+       before() : handler(                     
+                       (@Entity *) && !(hasmethod(@SearchAnnotation public * get*())) && !(hasfield(@SearchAnnotations * *))
+                       ) {
+               
+               
+       }
+       */
+       
+       /*
+       before() : execution(!@(org.aspectj.bug*) public * get*()) {
+               
+       }
+       */
+
+}
diff --git a/tests/bugs166/pr284862/Entity.java b/tests/bugs166/pr284862/Entity.java
new file mode 100644 (file)
index 0000000..a1dbfa0
--- /dev/null
@@ -0,0 +1,11 @@
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Entity {
+
+}
diff --git a/tests/bugs166/pr284862/EntityClass.java b/tests/bugs166/pr284862/EntityClass.java
new file mode 100644 (file)
index 0000000..e87f3f5
--- /dev/null
@@ -0,0 +1,5 @@
+
+@Entity
+public class EntityClass implements AnnotatedMethodInterface {
+
+}
diff --git a/tests/bugs166/pr284862/InterfaceToAdd.java b/tests/bugs166/pr284862/InterfaceToAdd.java
new file mode 100644 (file)
index 0000000..8d9192b
--- /dev/null
@@ -0,0 +1 @@
+interface InterfaceToAdd {}
diff --git a/tests/bugs166/pr284862/PresentAnnotation.java b/tests/bugs166/pr284862/PresentAnnotation.java
new file mode 100644 (file)
index 0000000..5795876
--- /dev/null
@@ -0,0 +1,11 @@
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PresentAnnotation {
+
+}
diff --git a/tests/bugs166/pr284862/SearchAnnotation.java b/tests/bugs166/pr284862/SearchAnnotation.java
new file mode 100644 (file)
index 0000000..1f913a3
--- /dev/null
@@ -0,0 +1,11 @@
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+//@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface SearchAnnotation {
+
+}
index 19b3332059186d7e7c2374fe2f359450cfc34ed2..901ea840b71f6f380252586ea9ee604294f2493e 100644 (file)
@@ -18,6 +18,18 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
 
 public class Ajc166Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 
+       public void testHasMember_284862() {
+               runTest("npe hasmember");
+       }
+
+       public void testHasMember_284862_2() {
+               runTest("npe hasmember - 2");
+       }
+
+       public void testHasMember_284862_3() {
+               runTest("npe hasmember - 3");
+       }
+
        // fix is too disruptive for 1.6.5
        public void testGenericsBridge_pr279983() {
                runTest("generics bridge");
index 32f072b0fe2b2685e7b47de8593ddc1bc689251c..2ff98c6abf1d7ba3e850588654eb6b0e2d0eb6fc 100644 (file)
@@ -2,6 +2,18 @@
 
 <suite>
    
+  <ajc-test dir="bugs166/pr284862" title="npe hasmember">
+     <compile files="InterfaceToAdd.java AnnotatedMethodImpl.aj AspectToMatch.aj AnnotatedMethodInterface.java Entity.java EntityClass.java PresentAnnotation.java SearchAnnotation.java" options="-1.5 -XhasMember"/>
+  </ajc-test>
+  
+  <ajc-test dir="bugs166/pr284862" title="npe hasmember - 2">
+     <compile files="AnnotatedMethodInterface.java InterfaceToAdd.java AnnotatedMethodImpl.aj AspectToMatch.aj Entity.java EntityClass.java PresentAnnotation.java SearchAnnotation.java" options="-1.5 -XhasMember"/>
+  </ajc-test>
+  
+  <ajc-test dir="bugs166/pr284862" title="npe hasmember - 3">
+     <compile files="AnnotatedMethodInterface.java InterfaceToAdd.java AnnotatedMethodImpl.aj AspectToMatch.aj Entity.java EntityClass.java PresentAnnotation.java SearchAnnotation.java" options="-Xset:pipelineCompilation=false -1.5 -XhasMember"/>
+  </ajc-test>
+  
   <ajc-test dir="bugs165/pr279983" title="generics bridge">
      <compile files="X.java" options="-1.5"/>
      <run class="X"/>