langtools/test/tools/javac/T5003235/T5003235b.java
author jlahoda
Wed, 11 Jan 2017 10:59:57 +0100
changeset 43138 680d378b9d64
parent 41932 b23b4712933b
permissions -rw-r--r--
8169197: Improve error reporting for compiling against unexported package Summary: When a type cannot be found, look into other modules, search for possible viable types, and report them conveniently to the user. Reviewed-by: mcimadamore, jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * @test  /nodynamiccopyright/
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * @bug     5003235
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 * @summary Accessibility of private inner class
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * @author  Peter von der Ah\u00e9
43138
680d378b9d64 8169197: Improve error reporting for compiling against unexported package
jlahoda
parents: 41932
diff changeset
     6
 * @compile/fail/ref=T5003235b.out -XDrawDiagnostics T5003235b.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
class Outer {
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
    public Inner inner;
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
    public void create() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
        inner = new Inner();
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
    private class Inner {
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
        int k = 100;
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
        protected int l = 100;
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
        public int m = 100;
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
        protected int n = 100;
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
}
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
class Access {
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
    public static void main(String[] args) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
        Outer outer = new Outer();
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
        outer.create();
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
        System.out.println("Value of k: " + outer.inner.k);
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
        System.out.println("Value of l: " + outer.inner.l);
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
        System.out.println("Value of m: " + outer.inner.m);
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
        System.out.println("Value of n: " + outer.inner.n);
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
}