langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java
author mchung
Wed, 27 May 2015 13:25:18 -0700
changeset 30846 2b3f379840f0
parent 30730 d3ce7619db2c
child 34752 9c262a013456
permissions -rw-r--r--
8074432: Move jdeps and javap to jdk.jdeps module Reviewed-by: jjg, alanb, erikj
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26101
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
     1
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 26103
diff changeset
     2
 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
26101
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
     4
 *
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
     8
 *
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    13
 * accompanied this code).
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    14
 *
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    18
 *
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    21
 * questions.
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    22
 */
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    23
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    24
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    25
/*
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    26
 * @test
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    27
 * @bug 8034854 8042251
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    28
 * @summary Testing inner classes attributes.
26103
3f96599b20da 8055076: fix test failures in classfile tests
jjg
parents: 26101
diff changeset
    29
 * @library /tools/lib /tools/javac/lib ../lib
30846
2b3f379840f0 8074432: Move jdeps and javap to jdk.jdeps module
mchung
parents: 30730
diff changeset
    30
 * @modules jdk.jdeps/com.sun.tools.classfile
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 26103
diff changeset
    31
 *          jdk.compiler/com.sun.tools.javac.api
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 26103
diff changeset
    32
 *          jdk.compiler/com.sun.tools.javac.file
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 26103
diff changeset
    33
 *          jdk.compiler/com.sun.tools.javac.main
26101
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    34
 * @build InnerClassesTestBase TestBase TestResult InMemoryFileManager ToolBox
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    35
 * @run main InnerClassesTest
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    36
 */
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    37
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    38
import java.util.List;
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    39
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    40
public class InnerClassesTest extends InnerClassesTestBase {
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    41
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    42
    public static void main(String[] args) throws TestFailedException {
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    43
        new InnerClassesTest().test("InnerClassesSrc");
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    44
    }
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    45
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    46
    private List<TestCase> generateClasses() {
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    47
        setInnerClassType(ClassType.CLASS);
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    48
        setHasSyntheticClass(true);
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    49
        return super.generateTestCases();
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    50
    }
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    51
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    52
    private List<TestCase> generateEnums() {
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    53
        setInnerOtherModifiers(Modifier.EMPTY, Modifier.STATIC);
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    54
        setInnerClassType(ClassType.ENUM);
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    55
        setHasSyntheticClass(false);
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    56
        return super.generateTestCases();
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    57
    }
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    58
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    59
    private List<TestCase> generateInterfaces() {
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    60
        setInnerOtherModifiers(Modifier.EMPTY, Modifier.ABSTRACT, Modifier.STATIC);
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    61
        setInnerClassType(ClassType.INTERFACE);
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    62
        return super.generateTestCases();
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    63
    }
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    64
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    65
    private List<TestCase> generateAnnotations() {
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    66
        setInnerOtherModifiers(Modifier.EMPTY, Modifier.ABSTRACT, Modifier.STATIC);
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    67
        setInnerClassType(ClassType.ANNOTATION);
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    68
        return super.generateTestCases();
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    69
    }
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    70
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    71
    @Override
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    72
    public void setProperties() {
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    73
        setOuterAccessModifiers(Modifier.EMPTY);
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    74
        setOuterOtherModifiers(Modifier.EMPTY);
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    75
        setOuterClassType(ClassType.OTHER);
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    76
    }
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    77
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    78
    @Override
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    79
    public List<TestCase> generateTestCases() {
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    80
        List<TestCase> sources = generateClasses();
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    81
        sources.addAll(generateEnums());
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    82
        sources.addAll(generateInterfaces());
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    83
        sources.addAll(generateAnnotations());
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    84
        return sources;
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    85
    }
d5dd2ecd2353 8042251: Implement classfile tests for InnerClasses attribute.
aeremeev
parents:
diff changeset
    86
}