langtools/test/tools/javac/importscope/ImportMembersTest.java
author akulyakh
Thu, 21 May 2015 11:41:04 -0700
changeset 30730 d3ce7619db2c
parent 27997 44407cab4584
child 36526 3b41f1c69604
permissions -rw-r--r--
8076543: Add @modules as needed to the langtools tests Reviewed-by: jjg, shurailine
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27997
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
     1
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 27997
diff changeset
     2
 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
27997
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
     4
 *
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
     8
 *
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    13
 * accompanied this code).
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    14
 *
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    18
 *
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    21
 * questions.
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    22
 */
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    23
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    24
/*
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    25
 * @test
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    26
 * @bug 8065360
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    27
 * @summary The test checks possibility of class members to be imported.
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    28
 * @library /tools/lib
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 27997
diff changeset
    29
 * @modules jdk.compiler/com.sun.tools.javac.api
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 27997
diff changeset
    30
 *          jdk.compiler/com.sun.tools.javac.file
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 27997
diff changeset
    31
 *          jdk.compiler/com.sun.tools.javac.main
27997
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    32
 * @build ToolBox ImportMembersTest
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    33
 * @run main ImportMembersTest
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    34
 */
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    35
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    36
import javax.tools.JavaCompiler;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    37
import javax.tools.ToolProvider;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    38
import java.io.StringWriter;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    39
import java.util.ArrayList;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    40
import java.util.Arrays;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    41
import java.util.List;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    42
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    43
/**
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    44
 * The test checks that members of a class, an enum, an interface or annotation
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    45
 * can be imported with help of a static import or an import statement.
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    46
 * The tests generates a code, compiles it and checks whether it can be compiled
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    47
 * successfully or fails with a proper message.
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    48
 * The following is the example of a test case:
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    49
 * package pkg;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    50
 * class ChildA extends A {}
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    51
 *
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    52
 * package pkg;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    53
 * class A {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    54
 *     static class Inner {}
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    55
 *     static Object field;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    56
 *     static void method() {}
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    57
 * }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    58
 *
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    59
 * package pkg;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    60
 * import static pkg.ChildA.method;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    61
 * public class Test {{
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    62
 *     method();
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    63
 * }}
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    64
 *
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    65
 */
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    66
public class ImportMembersTest {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    67
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    68
    private static final String[] expectedErrorMessages = {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    69
            "Test.java:\\d+:\\d+: compiler.err.cant.resolve.location: .*\n1 error\n",
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    70
            "Test.java:\\d+:\\d+: compiler.err.import.requires.canonical: .*\n1 error\n"
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    71
    };
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    72
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    73
    private static final String sourceTemplate =
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    74
            "package pkg;\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    75
            "#IMPORT\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    76
            "public class Test {{\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    77
            "    #STATEMENT\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    78
            "}}\n";
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    79
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    80
    public static void main(String[] args) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    81
        new ImportMembersTest().test();
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    82
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    83
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    84
    public void test() {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    85
        int passed = 0;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    86
        int total = 0;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    87
        for (ClassType classType : ClassType.values()) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    88
            for (ImportType importType : ImportType.values()) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    89
                for (MemberType memberType : MemberType.values()) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    90
                    ++total;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    91
                    List<ToolBox.JavaSource> sources = classType.getSources();
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    92
                    sources.add(new ToolBox.JavaSource("Test.java",
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    93
                            generateSource(classType, memberType, importType)));
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    94
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    95
                    CompilationResult compilationResult = compile(sources);
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    96
                    boolean isErrorExpected = importType.hasError(classType, memberType);
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    97
                    if (!compilationResult.isSuccessful) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    98
                        if (isErrorExpected) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
    99
                            String expectedErrorMessage =
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   100
                                    getExpectedErrorMessage(classType, importType, memberType);
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   101
                            if (compilationResult.message.matches(expectedErrorMessage)) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   102
                                ++passed;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   103
                            } else {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   104
                                reportFailure(sources, String.format("Expected compilation failure message:\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   105
                                                "%s\ngot message:\n%s",
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   106
                                        expectedErrorMessage, compilationResult.message));
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   107
                            }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   108
                        } else {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   109
                            reportFailure(sources, String.format("Unexpected compilation failure:\n%s",
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   110
                                    compilationResult.message));
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   111
                        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   112
                    } else {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   113
                        if (isErrorExpected) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   114
                            reportFailure(sources, "Expected compilation failure.");
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   115
                        } else {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   116
                            ++passed;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   117
                        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   118
                    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   119
                }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   120
            }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   121
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   122
        String message = String.format(
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   123
                "Total test cases run: %d, passed: %d, failed: %d.",
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   124
                total, passed, total - passed);
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   125
        if (passed != total) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   126
            throw new RuntimeException(message);
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   127
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   128
        echo(message);
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   129
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   130
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   131
    private String getExpectedErrorMessage(ClassType classType, ImportType importType, MemberType memberType) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   132
        String expectedErrorMessage;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   133
        if (importType == ImportType.IMPORT && classType == ClassType.CHILD_A &&
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   134
                memberType == MemberType.CLASS) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   135
            expectedErrorMessage = expectedErrorMessages[1];
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   136
        } else {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   137
            expectedErrorMessage = expectedErrorMessages[0];
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   138
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   139
        return expectedErrorMessage;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   140
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   141
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   142
    private void reportFailure(List<ToolBox.JavaSource> sources, String message) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   143
        echo("Test case failed!");
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   144
        printSources(sources);
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   145
        echo(message);
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   146
        echo();
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   147
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   148
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   149
    private String generateSource(ClassType classType, MemberType memberType, ImportType importType) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   150
        String importString = importType.generateImport(classType.getClassName(), memberType.getMemberType());
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   151
        String statement;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   152
        if (importType.hasError(classType, memberType)) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   153
            // if the source code has a compilation error, nothing is added.
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   154
            // just to prevent the compiler from appending additional
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   155
            // compilation errors to output
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   156
            statement = "";
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   157
        } else if (memberType == MemberType.STAR) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   158
            // in case of import-on-demand, every class member is used
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   159
            if (importType == ImportType.STATIC_IMPORT) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   160
                statement = MemberType.CLASS.getStatement() + "\n    "
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   161
                        + MemberType.FIELD.getStatement();
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   162
                // an annotation does not have a static method.
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   163
                if (classType != ClassType.D) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   164
                    statement += "\n    " + MemberType.METHOD.getStatement() + "\n";
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   165
                }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   166
            } else {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   167
                statement = classType != ClassType.CHILD_A
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   168
                        ? MemberType.CLASS.getStatement() : "";
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   169
            }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   170
        } else {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   171
            statement = memberType.getStatement();
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   172
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   173
        return sourceTemplate
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   174
                .replace("#IMPORT", importString)
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   175
                .replace("#STATEMENT", statement);
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   176
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   177
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   178
    private static class CompilationResult {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   179
        public final boolean isSuccessful;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   180
        public final String message;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   181
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   182
        public CompilationResult(boolean isSuccessful, String message) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   183
            this.isSuccessful = isSuccessful;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   184
            this.message = message;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   185
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   186
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   187
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   188
    private CompilationResult compile(List<ToolBox.JavaSource> sources) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   189
        StringWriter writer = new StringWriter();
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   190
        JavaCompiler jc = ToolProvider.getSystemJavaCompiler();
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   191
        Boolean call = jc.getTask(writer, null, null, Arrays.asList("-XDrawDiagnostics"), null, sources).call();
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   192
        return new CompilationResult(call, writer.toString().replace(ToolBox.lineSeparator, "\n"));
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   193
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   194
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   195
    public void printSources(List<ToolBox.JavaSource> sources) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   196
        for (ToolBox.JavaSource javaSource : sources) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   197
            echo(javaSource.getCharContent(true).toString());
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   198
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   199
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   200
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   201
    public void echo() {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   202
        echo("");
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   203
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   204
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   205
    public void echo(String output) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   206
        printf(output + "\n");
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   207
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   208
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   209
    public void printf(String template, Object...args) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   210
        System.err.print(String.format(template, args).replace("\n", ToolBox.lineSeparator));
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   211
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   212
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   213
    enum ClassType {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   214
        A("A",
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   215
        "package pkg;\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   216
        "class A {\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   217
        "    static class Inner {}\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   218
        "    static Object field;\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   219
        "    static void method() {}\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   220
        "}\n"
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   221
        ),
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   222
        B("B",
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   223
        "package pkg;\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   224
        "interface B {\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   225
        "    static class Inner {}\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   226
        "    static Object field = null;\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   227
        "    static void method() {}\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   228
        "}\n"
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   229
        ),
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   230
        C("C",
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   231
        "package pkg;\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   232
        "enum C {field;\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   233
        "    static class Inner {}\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   234
        "    static void method() {}\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   235
        "}\n"
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   236
        ),
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   237
        D("D",
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   238
        "package pkg;\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   239
        "@interface D {\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   240
        "    static class Inner {}\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   241
        "    static Object field = null;\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   242
        "}\n"
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   243
        ),
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   244
        CHILD_A("ChildA",
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   245
        "package pkg;\n" +
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   246
        "class ChildA extends A {}\n",
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   247
        A);
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   248
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   249
        private final String className;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   250
        private final String source;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   251
        private final ClassType parentType;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   252
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   253
        private ClassType(String className, String source) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   254
            this(className, source, null);
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   255
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   256
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   257
        private ClassType(String className, String source, ClassType classType) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   258
            this.className = className;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   259
            this.source = source;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   260
            this.parentType = classType;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   261
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   262
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   263
        public String getClassName() {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   264
            return className;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   265
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   266
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   267
        public List<ToolBox.JavaSource> getSources() {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   268
            List<ToolBox.JavaSource> sourceList = new ArrayList<>();
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   269
            ClassType current = this;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   270
            while (current != null) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   271
                sourceList.add(new ToolBox.JavaSource(current.className, current.source));
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   272
                current = current.parentType;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   273
            }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   274
            return sourceList;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   275
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   276
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   277
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   278
    enum MemberType {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   279
        CLASS("Inner", "Inner inner = null;"),
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   280
        FIELD("field", "Object o = field;"),
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   281
        METHOD("method", "method();"),
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   282
        STAR("*", ""),
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   283
        NOT_EXIST("NotExist", "");
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   284
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   285
        private final String memberType;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   286
        private final String statement;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   287
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   288
        private MemberType(String memberType, String statement) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   289
            this.memberType = memberType;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   290
            this.statement = statement;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   291
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   292
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   293
        public String getStatement() {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   294
            return statement;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   295
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   296
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   297
        public String getMemberType() {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   298
            return memberType;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   299
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   300
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   301
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   302
    enum ImportType {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   303
        IMPORT("import pkg.#CLASS_NAME.#MEMBER_NAME;"),
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   304
        STATIC_IMPORT("import static pkg.#CLASS_NAME.#MEMBER_NAME;");
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   305
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   306
        private final String importType;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   307
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   308
        private ImportType(String importType) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   309
            this.importType = importType;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   310
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   311
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   312
        public String generateImport(String className, String memberName) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   313
            return importType
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   314
                    .replace("#CLASS_NAME", className)
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   315
                    .replace("#MEMBER_NAME", memberName);
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   316
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   317
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   318
        public boolean hasError(ClassType classType, MemberType memberType) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   319
            switch (memberType) {
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   320
                case FIELD:
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   321
                    return this != ImportType.STATIC_IMPORT;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   322
                case METHOD:
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   323
                    return this != ImportType.STATIC_IMPORT || classType == ClassType.D;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   324
                case NOT_EXIST:
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   325
                    return true;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   326
                case CLASS:
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   327
                    return classType.parentType != null && this != STATIC_IMPORT;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   328
                default:
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   329
                    return false;
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   330
            }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   331
        }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   332
    }
44407cab4584 8065360: Implement a test that checks possibilty of class members to be imported
aeremeev
parents:
diff changeset
   333
}