summaryrefslogtreecommitdiffstats
path: root/tests/bugs/PrivilegeBeyondScope.java
blob: 469aeb1a8578cee55abdba1773c7be9aeb212ab9 (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
import java.util.Observable;


/** @testcase PR#906 privileged access out of code the compiler controls */
public class PrivilegeBeyondScope {

    public static void main (String[] args) {
        new C().get(); 
        throw new Error("expected compiler error");
    } 
}

class C {
    Object get() {return null;}
}

privileged aspect A {
    Observable observable = new Observable();

    after() returning (Object o ) : 
        execution(Object C.get()) {
        observable.setChanged(); // CE 23 (unable to implement privilege outside C
          // CE unable to implement privilege outside code the compiler controls
    }
}