< prev index next >

test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassConstructorsTest.java

Print this page
rev 50608 : imported patch jep181-rev5


  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8189335
  27  * @summary Synthetic anonymous class used as access constructor tag conflicting with a top level class.
  28  * @modules jdk.compiler/com.sun.tools.javac.api
  29  *          jdk.compiler/com.sun.tools.javac.main
  30  *          jdk.jdeps/com.sun.tools.classfile
  31  * @library /tools/lib /tools/javac/lib ../lib
  32  * @build toolbox.ToolBox InMemoryFileManager TestResult
  33  * @build AccessToPrivateInnerClassConstructorsTest SyntheticTestDriver ExpectedClass ExpectedClasses
  34  * @run main SyntheticTestDriver AccessToPrivateInnerClassConstructorsTest 1
  35  * @run main AccessToPrivateInnerClassConstructorsTest
  36  */
  37 
  38 @ExpectedClass(className = "AccessToPrivateInnerClassConstructorsTest",
  39         expectedMethods = {"<init>()", "main(java.lang.String[])", "f()", "g()"})
  40 @ExpectedClass(className = "AccessToPrivateInnerClassConstructorsTest$1",
  41         expectedMethods = {"<init>()"})
  42 @ExpectedClass(className = "AccessToPrivateInnerClassConstructorsTest$A",
  43         expectedMethods = {
  44                 "<init>(AccessToPrivateInnerClassConstructorsTest)",
  45                 "<init>(AccessToPrivateInnerClassConstructorsTest, " +
  46                        "AccessToPrivateInnerClassConstructorsTest$1)"},
  47         expectedNumberOfSyntheticFields = 1,
  48         expectedNumberOfSyntheticMethods = 2)
  49 @ExpectedClass(className = "AccessToPrivateInnerClassConstructorsTest$1Local",
  50         expectedMethods = {"<init>(AccessToPrivateInnerClassConstructorsTest)"},
  51         expectedNumberOfSyntheticFields = 1)
  52 @ExpectedClass(className = "AccessToPrivateInnerClassConstructorsTest$2Local",
  53         expectedMethods = {"<init>(AccessToPrivateInnerClassConstructorsTest)"},
  54         expectedNumberOfSyntheticFields = 1)
  55 public class AccessToPrivateInnerClassConstructorsTest {
  56 
  57     public static void main(String... args) {
  58         new AccessToPrivateInnerClassConstructorsTest().f();
  59     }
  60 
  61     private class A {
  62         private A() { }
  63         private A(AccessToPrivateInnerClassConstructorsTest$1 o) { }
  64     }
  65 
  66     void f() {
  67         new A();
  68         new A(null);


  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8189335
  27  * @summary Synthetic anonymous class used as access constructor tag conflicting with a top level class.
  28  * @modules jdk.compiler/com.sun.tools.javac.api
  29  *          jdk.compiler/com.sun.tools.javac.main
  30  *          jdk.jdeps/com.sun.tools.classfile
  31  * @library /tools/lib /tools/javac/lib ../lib
  32  * @build toolbox.ToolBox InMemoryFileManager TestResult
  33  * @build AccessToPrivateInnerClassConstructorsTest SyntheticTestDriver ExpectedClass ExpectedClasses
  34  * @run main SyntheticTestDriver AccessToPrivateInnerClassConstructorsTest 0
  35  * @run main AccessToPrivateInnerClassConstructorsTest
  36  */
  37 
  38 @ExpectedClass(className = "AccessToPrivateInnerClassConstructorsTest",
  39         expectedMethods = {"<init>()", "main(java.lang.String[])", "f()", "g()"})
  40 @ExpectedClass(className = "AccessToPrivateInnerClassConstructorsTest$1",
  41         expectedMethods = {"<init>()"})
  42 @ExpectedClass(className = "AccessToPrivateInnerClassConstructorsTest$A",
  43         expectedMethods = {
  44                 "<init>(AccessToPrivateInnerClassConstructorsTest)",
  45                 "<init>(AccessToPrivateInnerClassConstructorsTest, " +
  46                        "AccessToPrivateInnerClassConstructorsTest$1)"},
  47         expectedNumberOfSyntheticFields = 1,
  48         expectedNumberOfSyntheticMethods = 0)
  49 @ExpectedClass(className = "AccessToPrivateInnerClassConstructorsTest$1Local",
  50         expectedMethods = {"<init>(AccessToPrivateInnerClassConstructorsTest)"},
  51         expectedNumberOfSyntheticFields = 1)
  52 @ExpectedClass(className = "AccessToPrivateInnerClassConstructorsTest$2Local",
  53         expectedMethods = {"<init>(AccessToPrivateInnerClassConstructorsTest)"},
  54         expectedNumberOfSyntheticFields = 1)
  55 public class AccessToPrivateInnerClassConstructorsTest {
  56 
  57     public static void main(String... args) {
  58         new AccessToPrivateInnerClassConstructorsTest().f();
  59     }
  60 
  61     private class A {
  62         private A() { }
  63         private A(AccessToPrivateInnerClassConstructorsTest$1 o) { }
  64     }
  65 
  66     void f() {
  67         new A();
  68         new A(null);
< prev index next >