]> source.dussan.org Git - aspectj.git/commitdiff
262218: test and fix
authoraclement <aclement>
Fri, 23 Jan 2009 20:38:58 +0000 (20:38 +0000)
committeraclement <aclement>
Fri, 23 Jan 2009 20:38:58 +0000 (20:38 +0000)
tests/multiIncremental/pr262218/base/src/generics/ActionExecutor.java [new file with mode: 0644]
tests/multiIncremental/pr262218/base/src/generics/DeleteAction.java [new file with mode: 0644]
tests/multiIncremental/pr262218/base/src/generics/DeleteActionAspect.aj [new file with mode: 0644]
tests/multiIncremental/pr262218/base/src/test/Demo.aj [new file with mode: 0644]
tests/multiIncremental/pr262218/base/src/test/MyAspect.aj [new file with mode: 0644]
tests/multiIncremental/pr262218/base/src/test/OtherClass.aj [new file with mode: 0644]
tests/multiIncremental/pr262218/base/src/test2/MyAspect2.aj [new file with mode: 0644]
tests/multiIncremental/pr262218/base/src/test2/OtherClass2.aj [new file with mode: 0644]
tests/multiIncremental/pr262218/inc1/src/test/MyAspect.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

diff --git a/tests/multiIncremental/pr262218/base/src/generics/ActionExecutor.java b/tests/multiIncremental/pr262218/base/src/generics/ActionExecutor.java
new file mode 100644 (file)
index 0000000..e323cc0
--- /dev/null
@@ -0,0 +1,18 @@
+package generics;
+
+public class ActionExecutor {
+       public static void main(String[] args) {
+               DeleteAction<String> d = new DeleteAction<String>() {
+                       public String getSelected() {
+                               throw new RuntimeException();
+                       }
+                       
+               };
+               d.delete2++; 
+               d.delete3.add(null);
+       }
+       
+       void nothing2(DeleteAction<String> g) {
+               g.delete2++;
+       }
+} 
\ No newline at end of file
diff --git a/tests/multiIncremental/pr262218/base/src/generics/DeleteAction.java b/tests/multiIncremental/pr262218/base/src/generics/DeleteAction.java
new file mode 100644 (file)
index 0000000..05c136a
--- /dev/null
@@ -0,0 +1,12 @@
+package generics;
+import java.util.List;
+
+
+public interface DeleteAction<T extends Object>{
+
+    public void delete();
+    
+    public T getSelected(); 
+
+} 
\ No newline at end of file
diff --git a/tests/multiIncremental/pr262218/base/src/generics/DeleteActionAspect.aj b/tests/multiIncremental/pr262218/base/src/generics/DeleteActionAspect.aj
new file mode 100644 (file)
index 0000000..499981e
--- /dev/null
@@ -0,0 +1,30 @@
+package generics;
+
+import java.util.List;
+
+
+public aspect DeleteActionAspect {
+
+    public void DeleteAction<T extends Object>.delete() {
+            Object selected = getSelected();
+            selected.toString();
+            delete3.add("");
+    } 
+        
+       public int DeleteAction<T extends Object>.delete2;
+       
+       public List<String> DeleteAction.delete3;
+       
+       
+       public static void main(String[] args) {
+               DeleteAction<String> d = new DeleteAction<String>() {
+                       public String getSelected() {
+                               throw new RuntimeException();
+                       }
+                       
+               };
+               d.delete2++; 
+               d.delete3.add(null);
+       }
+
+} 
\ No newline at end of file
diff --git a/tests/multiIncremental/pr262218/base/src/test/Demo.aj b/tests/multiIncremental/pr262218/base/src/test/Demo.aj
new file mode 100644 (file)
index 0000000..174680b
--- /dev/null
@@ -0,0 +1,14 @@
+package test;
+
+import java.util.List;
+public class Demo {
+    
+    void g() {
+        new Demo(7).foo(null);
+        x++;   
+        this.x++;
+        MyAspect.aspectOf();
+        MyAspect.hasAspect();
+    }
+}  
\ No newline at end of file
diff --git a/tests/multiIncremental/pr262218/base/src/test/MyAspect.aj b/tests/multiIncremental/pr262218/base/src/test/MyAspect.aj
new file mode 100644 (file)
index 0000000..7d3efc9
--- /dev/null
@@ -0,0 +1,50 @@
+package test;
+import java.util.List;
+
+public aspect MyAspect {
+       List<String> Demo.list = null;
+       declare @type : Demo : @Deprecated;  
+       int Demo.x = 5;
+       
+       void Demo.foo(List<String> x) {
+               MyAspect.hasAspect();
+       }
+        
+       public Demo.new(int x) { 
+               this(); 
+       }  
+       
+    declare warning : execution(* *.nothing(..)) : "blah";
+    
+    declare error : execution(* *.nothing(..)) : "blah";
+    
+       declare soft : Exception : execution(* *.nothing(..));
+       
+       
+    protected pointcut s():
+        call(String Demo.toString(..));
+
+    before (): s() {
+    }
+    after (): s() {
+    }
+    void around (): s() {
+        proceed();
+        return;
+    }
+    after () returning(): s() {
+    }
+    after () throwing(): s() {
+       thisEnclosingJoinPointStaticPart.getClass();
+       thisJoinPoint.getClass();
+       thisJoinPointStaticPart.getClass();  
+    }
+    
+    @interface MyAnnotation { }
+
+    // try out declare annotation
+    declare @field: int Demo.x: @MyAnnotation;
+    declare @method: void Demo.foo(..): @MyAnnotation;
+    declare @constructor: public Demo.new(int): @MyAnnotation; 
+
+}
diff --git a/tests/multiIncremental/pr262218/base/src/test/OtherClass.aj b/tests/multiIncremental/pr262218/base/src/test/OtherClass.aj
new file mode 100644 (file)
index 0000000..a24940d
--- /dev/null
@@ -0,0 +1,10 @@
+package test;
+
+
+public class OtherClass {
+    void x() {
+        Demo d = new Demo(4);
+        d.foo(null);
+        d.x ++; 
+    } 
+}
\ No newline at end of file
diff --git a/tests/multiIncremental/pr262218/base/src/test2/MyAspect2.aj b/tests/multiIncremental/pr262218/base/src/test2/MyAspect2.aj
new file mode 100644 (file)
index 0000000..5f79df2
--- /dev/null
@@ -0,0 +1,29 @@
+package test2;
+
+import test.Demo;
+import test2.MyAspect2;
+
+public aspect MyAspect2 {
+    
+    static interface Bar {
+        
+    }
+    declare parents : Demo implements Bar, Cloneable;
+    
+    public int Bar.bar() { 
+        return 7;
+    }
+
+    
+    static class Foo {
+        public Foo() {
+             
+        } 
+    }
+    declare parents : Demo extends Foo;
+    
+    public int Foo.baz() {
+       return 7;
+    } 
+
+}
diff --git a/tests/multiIncremental/pr262218/base/src/test2/OtherClass2.aj b/tests/multiIncremental/pr262218/base/src/test2/OtherClass2.aj
new file mode 100644 (file)
index 0000000..5922fa9
--- /dev/null
@@ -0,0 +1,15 @@
+package test2;
+
+import test.Demo;
+
+public class OtherClass2 {
+    void x() {
+        Demo d = new Demo(4); 
+        d.bar(); 
+        d.baz();
+        // causes error for now see note at end of AJCompilationUnitProblemFinder.isARealProblem
+//        ((MyAspect2.Bar) d).bar();
+        ((MyAspect2.Foo) d).baz();
+        ((Cloneable) d).toString();
+    } 
+}        
\ No newline at end of file
diff --git a/tests/multiIncremental/pr262218/inc1/src/test/MyAspect.aj b/tests/multiIncremental/pr262218/inc1/src/test/MyAspect.aj
new file mode 100644 (file)
index 0000000..e655e59
--- /dev/null
@@ -0,0 +1,51 @@
+package test;
+import java.util.List;
+
+
+public aspect MyAspect {
+       List<String> Demo.list = null;
+       declare @type : Demo : @Deprecated;  
+       int Demo.x = 5;
+       
+       void Demo.foo(List<String> x) {
+               MyAspect.hasAspect();
+       }
+        
+       public Demo.new(int x) { 
+               this(); 
+       }  
+       
+    declare warning : execution(* *.nothing(..)) : "blah";
+    
+    declare error : execution(* *.nothing(..)) : "blah";
+    
+       declare soft : Exception : execution(* *.nothing(..));
+       
+       
+    protected pointcut s():
+        call(String Demo.toString(..));
+
+    before (): s() {
+    }
+    after (): s() {
+    }
+    void around (): s() {
+        proceed();
+        return;
+    }
+    after () returning(): s() {
+    }
+    after () throwing(): s() {
+       thisEnclosingJoinPointStaticPart.getClass();
+       thisJoinPoint.getClass();
+       thisJoinPointStaticPart.getClass();  
+    }
+    
+    @interface MyAnnotation { }
+
+    // try out declare annotation
+    declare @field: int Demo.x: @MyAnnotation;
+    declare @method: void Demo.foo(..): @MyAnnotation;
+    declare @constructor: public Demo.new(int): @MyAnnotation; 
+
+}
index 8e8eb585fde3965b5e0bffdf107b087830ad8f18..90a81d457b5bb9453f09358e0e34b10d8bb65052 100644 (file)
@@ -70,18 +70,19 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                }
                assertEquals("Should have found the two types in: " + ps, 2, count);
        }
-       
+
        public void testConstructorAdvice_pr261380() throws Exception {
                String p = "261380";
                initialiseProject(p);
                build(p);
                IRelationshipMap irm = getModelFor(p).getRelationshipMap();
-               IRelationship ir = (IRelationship)irm.get("=261380<test{C.java}X&before").get(0);
+               IRelationship ir = (IRelationship) irm.get("=261380<test{C.java}X&before").get(0);
                List targets = ir.getTargets();
-               assertEquals(1,targets.size());
+               assertEquals(1, targets.size());
                System.out.println(targets.get(0));
                String handle = (String) targets.get(0);
-               assertEquals("Expected the handle for the code node inside the constructor decl","=261380<test{C.java[C~C?constructor-call(void test.C.<init>())",handle);
+               assertEquals("Expected the handle for the code node inside the constructor decl",
+                               "=261380<test{C.java[C~C?constructor-call(void test.C.<init>())", handle);
        }
 
        /*
@@ -244,6 +245,19 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                assertEquals("=BrokenHandles<p{GetInfo.java}GetInfo`declare parents!3", ipe.getHandleIdentifier());
        }
 
+       public void testNPEIncremental_pr262218() {
+               AjdeInteractionTestbed.VERBOSE = true;
+               String p = "pr262218";
+               initialiseProject(p);
+               build(p);
+               checkWasFullBuild();
+               alter(p, "inc1");
+               build(p);
+               checkWasntFullBuild();
+               List l = getCompilerErrorMessages(p);
+               assertEquals("Unexpected compiler error", 0, l.size());
+       }
+
        public void testAnnotations_pr262154() {
                String p = "pr262154";
                initialiseProject(p);