--- /dev/null
+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
--- /dev/null
+package generics;
+import java.util.List;
+
+
+public interface DeleteAction<T extends Object>{
+
+ public void delete();
+
+ public T getSelected();
+
+}
+
\ No newline at end of file
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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;
+
+}
--- /dev/null
+package test;
+
+
+public class OtherClass {
+ void x() {
+ Demo d = new Demo(4);
+ d.foo(null);
+ d.x ++;
+ }
+}
\ No newline at end of file
--- /dev/null
+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;
+ }
+
+}
--- /dev/null
+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
--- /dev/null
+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;
+
+}
}
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);
}
/*
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);