test/tools/javac/T5003235/T5003235b.java

changeset 1
9a66ca7c79fa
child 611
4172cfff05f0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/T5003235/T5003235b.java	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,33 @@
     1.4 +/*
     1.5 + * @test  /nodynamiccopyright/
     1.6 + * @bug     5003235
     1.7 + * @summary Accessibility of private inner class
     1.8 + * @author  Peter von der Ah\u00e9
     1.9 + * @compile/fail/ref=T5003235b.out -XDstdout -XDdiags=%b:%l:%_%m T5003235b.java
    1.10 + */
    1.11 +
    1.12 +class Outer {
    1.13 +    public Inner inner;
    1.14 +
    1.15 +    public void create() {
    1.16 +        inner = new Inner();
    1.17 +    }
    1.18 +
    1.19 +    private class Inner {
    1.20 +        int k = 100;
    1.21 +        protected int l = 100;
    1.22 +        public int m = 100;
    1.23 +        protected int n = 100;
    1.24 +    }
    1.25 +}
    1.26 +
    1.27 +class Access {
    1.28 +    public static void main(String[] args) {
    1.29 +        Outer outer = new Outer();
    1.30 +        outer.create();
    1.31 +        System.out.println("Value of k: " + outer.inner.k);
    1.32 +        System.out.println("Value of l: " + outer.inner.l);
    1.33 +        System.out.println("Value of m: " + outer.inner.m);
    1.34 +        System.out.println("Value of n: " + outer.inner.n);
    1.35 +    }
    1.36 +}

mercurial