InnerClassLiterals.java revision 0
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson/*
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * Copyright 1998 Sun Microsystems, Inc. All Rights Reserved.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson *
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * This code is free software; you can redistribute it and/or modify it
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * under the terms of the GNU General Public License version 2 only, as
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * published by the Free Software Foundation.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson *
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * This code is distributed in the hope that it will be useful, but WITHOUT
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * version 2 for more details (a copy is included in the LICENSE file that
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * accompanied this code).
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson *
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * You should have received a copy of the GNU General Public License version
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * 2 along with this work; if not, write to the Free Software Foundation,
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson *
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
f71f7a61dec7c9089378d14493ad564a1dedf0b5neil_a_wilson * CA 95054 USA or visit www.sun.com if you need additional information or
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * have any questions.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson */
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson/*
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * @bug 4030384
a3d3ab94806056d2355afea6fe8daac41059b9fbludovicp * @summary Verify inner class can be used in class literal.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * Also includes a few other sanity checks.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * @author William Maddox (maddox)
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson *
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * @compile InnerClassLiterals.java
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * @run main InnerClassLiterals
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson */
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilsonpublic class InnerClassLiterals {
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson // Should not generate access errors.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson public static void main(String[] args) {
69de0fe5b7ed905860bef5f86937d30cc206ef7dneil_a_wilson Class x1 = int.class;
014019918f7e3844f558f6159b8d41517254edc2lutoff Class x2 = float.class;
69de0fe5b7ed905860bef5f86937d30cc206ef7dneil_a_wilson Class x3 = void.class;
69de0fe5b7ed905860bef5f86937d30cc206ef7dneil_a_wilson Class x4 = String.class;
69de0fe5b7ed905860bef5f86937d30cc206ef7dneil_a_wilson Class x5 = Integer.class;
3cedecd5ea21cca5d9709abf320a2082cd3694e5jvergara Class x6 = InnerClassLiterals.class;
69de0fe5b7ed905860bef5f86937d30cc206ef7dneil_a_wilson // Bug 4030384: Compiler did not allow this.
69de0fe5b7ed905860bef5f86937d30cc206ef7dneil_a_wilson Class x7 = InnerClassLiterals.Inner1.class;
69de0fe5b7ed905860bef5f86937d30cc206ef7dneil_a_wilson Class x8 = InnerClassLiterals.Inner2.class;
014019918f7e3844f558f6159b8d41517254edc2lutoff }
014019918f7e3844f558f6159b8d41517254edc2lutoff
014019918f7e3844f558f6159b8d41517254edc2lutoff class Inner1 {}
014019918f7e3844f558f6159b8d41517254edc2lutoff
014019918f7e3844f558f6159b8d41517254edc2lutoff static class Inner2 {}
014019918f7e3844f558f6159b8d41517254edc2lutoff}
014019918f7e3844f558f6159b8d41517254edc2lutoff