View | Details | Raw Unified | Return to bug 104218
Collapse All | Expand All

(-)reweavable/Advisable.java (+4 lines)
Added Link Here
1
public interface Advisable {
2
3
	public void addJoinPoint (String name); 
4
}
(-)reweavable/Aspect1.aj (+7 lines)
Added Link Here
1
public aspect Aspect1 {
2
3
	before (Advisable a) : execution(void test1()) && this(a){
4
		System.err.println(thisJoinPoint);
5
		a.addJoinPoint(thisJoinPoint.getSignature().getName());
6
	}
7
}
(-)reweavable/Aspect2.aj (+7 lines)
Added Link Here
1
public aspect Aspect2 {
2
3
	before (Advisable a) : execution(void test2()) && this(a){
4
		System.err.println(thisJoinPoint);
5
		a.addJoinPoint(thisJoinPoint.getSignature().getName());
6
	}
7
}
(-)reweavable/Main.java (+28 lines)
Added Link Here
1
import java.util.*;
2
3
public class Main implements Advisable {
4
	
5
	private static List joinPoints = new ArrayList();
6
	
7
	public void test1 () {
8
		
9
	}
10
	
11
	public void test2 () {
12
		
13
	}
14
	
15
	public void addJoinPoint (String name) {
16
		joinPoints.add(name);
17
	}
18
	
19
	public static void main (String[] args) {
20
		System.err.println("? Main.main()");
21
		joinPoints = new ArrayList();
22
		new Main().test1();
23
		new Main().test2();
24
		if (joinPoints.size() != 2) {
25
			throw new RuntimeException("size=" + joinPoints.size());
26
		}
27
	}
28
}
(-)src/org/aspectj/systemtest/reweavable/ReweavableTests.java (+39 lines)
Added Link Here
1
/* *******************************************************************
2
 * Copyright (c) 2004 IBM Corporation
3
 * All rights reserved.
4
 * This program and the accompanying materials are made available
5
 * under the terms of the Common Public License v1.0
6
 * which accompanies this distribution and is available at
7
 * http://www.eclipse.org/legal/cpl-v10.html 
8
 * 
9
 * ******************************************************************/
10
package org.aspectj.systemtest.reweavable;
11
12
import java.io.File;
13
import junit.framework.Test;
14
import org.aspectj.testing.XMLBasedAjcTestCase;
15
16
public class ReweavableTests extends org.aspectj.testing.XMLBasedAjcTestCase {
17
18
  public static Test suite() {
19
    return XMLBasedAjcTestCase.loadSuite(ReweavableTests.class);
20
  }
21
22
  protected File getSpecFile() {
23
    return new File("../tests/src/org/aspectj/systemtest/reweavable/reweavable.xml");
24
  }
25
26
  public void test001(){
27
    runTest("Ensure 1st aspect is rewoven when weaving 2nd aspect");
28
  }
29
30
  public void test002(){
31
    runTest("Ensure 1st aspect is rewoven when weaving 2nd aspect - aspectpath");
32
  }
33
34
  public void test003(){
35
    runTest("Ensure 1st aspect is rewoven when weaving 2nd aspect - classpath");
36
  }
37
38
}
39
(-)src/org/aspectj/systemtest/reweavable/reweavable-tests.xml (+91 lines)
Added Link Here
1
<!-- AspectJ v1.0.x Tests -->
2
3
    <ajc-test dir="reweavable"
4
      title="Ensure 1st aspect is rewoven when weaving 2nd aspect"
5
      keywords="reweavable">
6
        <compile
7
        	files="Main.java, Advisable.java, Aspect1.aj"
8
			outjar="main1.jar"
9
            options="-Xreweavable -showWeaveInfo"
10
        >
11
        	<message kind="weave" text="Type 'Main' (Main.java:7) advised by before advice from 'Aspect1' (Aspect1.aj:3)"/>
12
        </compile>	
13
        <compile
14
        	classpath="aspect1.jar"
15
        	files="Aspect2.aj"
16
        	inpath="main1.jar"
17
            options="-Xreweavable -showWeaveInfo -verbose"
18
        >
19
        	<message kind="weave" text="Type 'Main' (Main.java:7) advised by before advice from 'Aspect1' (Aspect1.aj:3)"/>
20
        	<message kind="weave" text="Type 'Main' (Main.java:11) advised by before advice from 'Aspect2' (Aspect2.aj:3)"/>
21
        </compile>	
22
        <run class="Main"/>
23
    </ajc-test>
24
25
    <ajc-test dir="reweavable"
26
      title="Ensure 1st aspect is rewoven when weaving 2nd aspect - aspectpath"
27
      keywords="reweavable">
28
        <compile
29
        	files="Main.java, Advisable.java"
30
			outjar="main1.jar"
31
        >
32
        </compile>	
33
        <compile
34
        	classpath="main1.jar"
35
        	files="Aspect1.aj"
36
			outjar="aspect1.jar"
37
        >
38
        </compile>	
39
        <compile
40
        	inpath="main1.jar"
41
        	aspectpath="aspect1.jar"
42
			outjar="main2.jar"
43
            options="-Xreweavable,-1.5,-showWeaveInfo"
44
        >	
45
        	<message kind="weave" text="Type 'Main' (Main.java:7) advised by before advice from 'Aspect1' (Aspect1.aj:3)"/>
46
        </compile>	
47
        <compile
48
        	aspectpath="aspect1.jar"
49
        	inpath="main2.jar"
50
        	files="Aspect2.aj"
51
            options="-Xreweavable -showWeaveInfo"
52
        >
53
        	<message kind="weave" text="Type 'Main' (Main.java:7) advised by before advice from 'Aspect1' (Aspect1.aj:3)"/>
54
        	<message kind="weave" text="Type 'Main' (Main.java:11) advised by before advice from 'Aspect2' (Aspect2.aj:3)"/>
55
        </compile>	
56
    </ajc-test>
57
58
59
    <ajc-test dir="reweavable"
60
      title="Ensure 1st aspect is rewoven when weaving 2nd aspect - classpath"
61
      keywords="reweavable">
62
        <compile
63
        	files="Main.java, Advisable.java"
64
			outjar="main1.jar"
65
        >
66
        </compile>	
67
        <compile
68
        	classpath="main1.jar"
69
        	files="Aspect1.aj"
70
			outjar="aspect1.jar"
71
        >
72
        </compile>	
73
        <compile
74
        	inpath="main1.jar"
75
        	aspectpath="aspect1.jar"
76
			outjar="main2.jar"
77
            options="-Xreweavable,-1.5,-showWeaveInfo"
78
        >	
79
        	<message kind="weave" text="Type 'Main' (Main.java:7) advised by before advice from 'Aspect1' (Aspect1.aj:3)"/>
80
        </compile>	
81
        <compile
82
        	classpath="aspect1.jar"
83
        	inpath="main2.jar"
84
        	files="Aspect2.aj"
85
            options="-Xreweavable -showWeaveInfo"
86
        >
87
        	<message kind="weave" text="Type 'Main' (Main.java:7) advised by before advice from 'Aspect1' (Aspect1.aj:3)"/>
88
        	<message kind="weave" text="Type 'Main' (Main.java:11) advised by before advice from 'Aspect2' (Aspect2.aj:3)"/>
89
        </compile>	
90
    </ajc-test>
91
(-)src/org/aspectj/systemtest/reweavable/reweavable.xml (+9 lines)
Added Link Here
1
<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[
2
<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/reweavable/reweavable-tests.xml">
3
]>
4
5
<!-- AspectJ v1.0.x Tests -->
6
7
<suite>
8
&tests;
9
</suite>

Return to bug 104218