summaryrefslogtreecommitdiffstats
path: root/tests/bugs/IncompatibleClassChangeErrorBug.java
blob: 3bb9687033e8417ac8a62c8d365691f887cc2ef0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import org.aspectj.testing.Tester;
import org.aspectj.lang.*;
import org.aspectj.lang.reflect.*;

/** @testcase PR#901 IncompatibleClassChangeError bug  */
public class IncompatibleClassChangeErrorBug {

    public static void main(String[] args) {
		Tester.expectEvent("printed");
        method1();
        Tester.checkAllEvents();
    }
    public static void method1() {
    }
}

aspect JoinpointTestAspect {
    before() : call(static void method1()) {
        printArgs(thisJoinPoint);
    
		// This call is required to reproduce the bug...
        printStaticInfo(thisJoinPointStaticPart);
    }

    
    private void printArgs(JoinPoint joinPoint) {
        Object[] args = joinPoint.getArgs();
	// While the original code had a for() loop to print arguments
	// bug can be seen without it...
    }
    
    private void printStaticInfo(JoinPoint.StaticPart 
				 joinPointStaticPart) {
		Tester.check(null != joinPointStaticPart, "null parm");
		Tester.event("printed");
    }
}