langtools/test/tools/javac/T8022053/UnverifiableInitForNestedLocalClassTest.java
author sogoel
Thu, 05 Jun 2014 10:57:10 -0700
changeset 24797 850ebd4d80a7
parent 19501 9dac9369db2c
permissions -rw-r--r--
8044072: Group 2: create .out files for OverrideChecks tests in tools/javac dir Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19501
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
     1
/*
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
     4
 *
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
     8
 *
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    13
 * accompanied this code).
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    14
 *
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    18
 *
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    21
 * questions.
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    22
 */
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    23
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    24
/*
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    25
 * @test
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    26
 * @bug 8022053
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    27
 * @summary 8022053: javac generates unverifiable initializer for nested subclass of local class
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    28
 * @run main UnverifiableInitForNestedLocalClassTest
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    29
 */
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    30
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    31
public class UnverifiableInitForNestedLocalClassTest {
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    32
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    33
    public static void main(final String[] args) {
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    34
        test("test");
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    35
    }
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    36
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    37
    static void test(final String arg) {
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    38
        final String inlined = " inlined ";
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    39
        class LocalClass {
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    40
            String m() {
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    41
                return "LocalClass " + arg + inlined;
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    42
            }
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    43
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    44
            class SubClass extends LocalClass {
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    45
                @Override
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    46
                String m() {
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    47
                    return "SubClass " + arg + inlined;
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    48
                }
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    49
            }
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    50
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    51
            class SubSubClass extends SubClass {
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    52
                @Override
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    53
                String m() {
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    54
                    return "SubSubClass " + arg + inlined;
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    55
                }
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    56
            }
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    57
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    58
            class AnotherLocal {
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    59
                class AnotherSub extends LocalClass {
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    60
                    @Override
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    61
                    String m() {
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    62
                        return "AnotherSub " + arg + inlined;
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    63
                    }
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    64
                }
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    65
            }
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    66
        }
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    67
        System.out.println(new LocalClass().m());
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    68
        System.out.println(new LocalClass().new SubClass().m());
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    69
        System.out.println(new LocalClass().new SubSubClass().m());
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    70
        System.out.println(new LocalClass().new AnotherLocal().new AnotherSub().m());
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    71
    }
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    72
9dac9369db2c 8022053: javac generates unverifiable initializer for nested subclass of local class
vromero
parents:
diff changeset
    73
}