aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core/testdata/src1/Privileged.java
blob: 064f1c75511c9943342890b0fa33ec5cec6605b4 (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
import java.io.*;
import org.aspectj.lang.*;

public class Privileged {
	public static void main(String[] args) {
		Privileged p = new Privileged();
		
		System.out.println("got: " + A.getX(p));
		System.out.println("s: " + s);
	}
	
	private int m() {
		return 2;
	}
	
	private int x = 1;
	
	private static String s = "hi";
}


privileged aspect A {
	static int getX(Privileged p) {
		Runnable r = new Runnable() {
			public void run() {
				Privileged.s += 10;
			}
		};
		r.run();
		return p.x + p.m();
	}
}