summaryrefslogtreecommitdiffstats
path: root/tests/new/TypeDeclInAdvice.java
blob: e39d3421ee4ab92d63dca119d8ecf2d0532fb30a (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
39
import org.aspectj.testing.Tester;

public class TypeDeclInAdvice {
  public static void main(String[] args) { test(); }

  public static void test() {
    Foo foo = new Foo();
    foo.m();
  }
}

aspect A {
    void around(): this(Foo) && call(void m(..)) {
	class Internal {
	    int val() { return 1; }
	}
	int i = 0;
	Internal j;
	
	i = 1;
	j = new Internal();
	
	proceed();

	//System.out.println("j: " + j);
	
	Tester.checkEqual(i, 1, "i");
	Tester.checkEqual(j.val(), 1, "j.val()");
    }
}

class Foo {
    Foo() {
	//System.out.println("constructor Foo()");  
    }
    void m() {
	//System.out.println("method m()");
    }
}