--- /dev/null
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+*/
+package tjp;
+
+public class Demo {
+ static Demo d;
+
+ public static void main(String[] args){
+ new Demo().go();
+ }
+
+ void go(){
+ d = new Demo();
+ d.foo(1,d);
+ System.out.println(d.bar(new Integer(3)));
+ }
+
+ void foo(int i, Object o){
+ System.out.println("Demo.foo(" + i + ", " + o + ")\n");
+ }
+
+ String bar (Integer j){
+ System.out.println("Demo.bar(" + j + ")\n");
+ return "Demo.bar(" + j + ")";
+ }
+}
--- /dev/null
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package tjp;
+
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.reflect.CodeSignature;
+
+aspect GetInfo {
+
+ static final void println(String s){ System.out.println(s); }
+
+ pointcut goCut(): cflow(this(Demo) && execution(void go()));
+
+ pointcut demoExecs(): within(Demo) && execution(* *(..));
+
+ Object around(): demoExecs() && !execution(* go()) && goCut() {
+ println("Intercepted message: " +
+ thisJoinPointStaticPart.getSignature().getName());
+ println("in class: " +
+ thisJoinPointStaticPart.getSignature().getDeclaringType().getName());
+ printParameters(thisJoinPoint);
+ println("Running original method: \n" );
+ Object result = proceed();
+ println(" result: " + result );
+ return result;
+ }
+
+ static private void printParameters(JoinPoint jp) {
+ println("Arguments: " );
+ Object[] args = jp.getArgs();
+ String[] names = ((CodeSignature)jp.getSignature()).getParameterNames();
+ Class[] types = ((CodeSignature)jp.getSignature()).getParameterTypes();
+ for (int i = 0; i < args.length; i++) {
+ println(" " + i + ". " + names[i] +
+ " : " + types[i].getName() +
+ " = " + args[i]);
+ }
+ }
+}
--- /dev/null
+/*
+
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+
+*/
+package tjp;
+
+public class Demo {
+ static Demo d;
+ /* blah blah blah */
+ public static void main(String[] args){
+ new Demo().go();
+ }
+
+ void go(){
+ d = new Demo();
+ d.foo(1,d);
+ System.out.println(d.bar(new Integer(3)));
+ }
+
+ void foo(int i, Object o){
+ System.out.println("Demo.foo(" + i + ", " + o + ")\n");
+ }
+
+ String bar (Integer j){
+ System.out.println("Demo.bar(" + j + ")\n");
+ return "Demo.bar(" + j + ")";
+ }
+}
--- /dev/null
+/*
+Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
+
+Use and copying of this software and preparation of derivative works based
+upon this software are permitted. Any distribution of this software or
+derivative works must comply with all applicable United States export control
+laws.
+
+This software is made available AS IS, and Xerox Corporation makes no warranty
+about the software, its performance or its conformity to any specification.
+*/
+
+package tjp;
+
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.reflect.CodeSignature;
+
+aspect GetInfo {
+
+ static final void println(String s){ System.out.println(s); }
+
+ pointcut goCut(): cflow(this(Demo) && execution(void go()));
+
+ pointcut demoExecs(): within(Demo) && execution(* *(..));
+
+ Object around(): demoExecs() && !execution(* go()) && goCut() {
+ println("Intercepted message: " +
+ thisJoinPointStaticPart.getSignature().getName());
+ println("in class: " +
+ thisJoinPointStaticPart.getSignature().getDeclaringType().getName());
+ printParameters(thisJoinPoint);
+ println("Running original method: \n" );
+ Object result = proceed();
+ println(" result: " + result );
+ return result;
+ }
+
+ static private void printParameters(JoinPoint jp) {
+ println("Arguments: " );
+ Object[] args = jp.getArgs();
+ String[] names = ((CodeSignature)jp.getSignature()).getParameterNames();
+ Class[] types = ((CodeSignature)jp.getSignature()).getParameterTypes();
+ for (int i = 0; i < args.length; i++) {
+ println(" " + i + ". " + names[i] +
+ " : " + types[i].getName() +
+ " = " + args[i]);
+ }
+ }
+}
--- /dev/null
+package pack;
+import p.C1;
+public class C {
+ public void m() {
+ new C1().m1();
+ }
+}
--- /dev/null
+package pack;
+import p.C1;
+public class C {
+ public void m() {
+ new C1().m1();
+ }
+}
--- /dev/null
+package p;
+
+public aspect A1 {
+
+
+}
--- /dev/null
+package p;
+
+public class C1 {
+ public void m1() {
+
+ }
+
+ public void m2() {
+
+ }
+}
--- /dev/null
+package p;
+
+public aspect A1 {
+
+
+}
--- /dev/null
+package p;
+
+public class C1 {
+ public void m1() {
+ System.out.println("Hello");
+ }
+
+ public void m2() {
+
+ }
+}
}
}
+ // test for comment #31 - NPE
public void testPr129163() {
configureBuildStructureModel(true);
initialiseProject("PR129613");
configureBuildStructureModel(false);
}
+ // test for comment #0 - adding a comment to a class file shouldn't
+ // cause us to go back to source and recompile everything. To force this
+ // to behave like AJDT we need to include the aspect in 'inc1' so that
+ // when AjState looks at its timestamp it thinks the aspect has been modified.
+ // The logic within CrosscuttingMembers should then work out correctly
+ // that there haven't really been any changes within the aspect and so
+ // we shouldn't go back to source.
+ public void testPr129163_2() {
+ // want to behave like AJDT
+ configureBuildStructureModel(true);
+ initialiseProject("pr129163_2");
+ build("pr129163_2");
+ checkWasFullBuild();
+ alter("pr129163_2","inc1");
+ build("pr129163_2");
+ checkWasntFullBuild(); // shouldn't be a full build because the
+ // aspect hasn't changed
+ configureBuildStructureModel(false);
+ }
+
+ // test for comment #6 - simulates AJDT core builder test testBug99133a -
+ // changing the contents of a method within a class shouldn't force a
+ // full build of a dependant project. To force this to behave like AJDT
+ // 'inc1' of the dependant project should just be a copy of 'base' so that
+ // AjState thinks somethings changed within the dependant project and
+ // we do a build. Similarly, 'inc1' of the project depended on should
+ // include the aspect even though nothing's changed within it. This causes
+ // AjState to think that the aspect has changed. Together its then up to
+ // logic within CrosscuttingMembers and various equals methods to decide
+ // correctly that we don't have to go back to source.
+ public void testPr129163_3() {
+ configureBuildStructureModel(true);
+ initialiseProject("PR129163_4");
+ build("PR129163_4");
+ checkWasFullBuild(); // should be a full build because initializing project
+ initialiseProject("PR129163_3");
+ configureNewProjectDependency("PR129163_3","PR129163_4");
+ build("PR129163_3");
+ checkWasFullBuild(); // should be a full build because initializing project
+ alter("PR129163_4","inc1");
+ build("PR129163_4");
+ checkWasntFullBuild(); // should be an incremental build because although
+ // "inc1" includes the aspect A1.aj, it actually hasn't
+ // changed so we shouldn't go back to source
+ alter("PR129163_3","inc1");
+ build("PR129163_3");
+ checkWasntFullBuild(); // should be an incremental build because nothing has
+ // changed within the class and no aspects have changed
+ // within the running of the test
+ configureBuildStructureModel(false);
+ }
+
// other possible tests:
// - memory usage (freemem calls?)
// - relationship map