1 /* |
1 /* |
2 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
29 * @modules jdk.compiler/com.sun.tools.javac.api |
29 * @modules jdk.compiler/com.sun.tools.javac.api |
30 * jdk.compiler/com.sun.tools.javac.main |
30 * jdk.compiler/com.sun.tools.javac.main |
31 * jdk.jdeps/com.sun.tools.classfile |
31 * jdk.jdeps/com.sun.tools.classfile |
32 * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase |
32 * @build toolbox.ToolBox InMemoryFileManager TestResult TestBase |
33 * @build InnerClassesTestBase |
33 * @build InnerClassesTestBase |
34 * @run main InnerClassesTest |
34 * @run main InnerClassesTest true |
|
35 * @run main InnerClassesTest false |
35 */ |
36 */ |
36 |
37 |
|
38 import java.util.Arrays; |
37 import java.util.List; |
39 import java.util.List; |
38 |
40 |
39 public class InnerClassesTest extends InnerClassesTestBase { |
41 public class InnerClassesTest extends InnerClassesTestBase { |
40 |
42 |
|
43 final boolean expectSyntheticClass; |
|
44 |
|
45 public InnerClassesTest(boolean expectSyntheticClass) { |
|
46 this.expectSyntheticClass = expectSyntheticClass; |
|
47 } |
|
48 |
41 public static void main(String[] args) throws TestFailedException { |
49 public static void main(String[] args) throws TestFailedException { |
42 new InnerClassesTest().test("InnerClassesSrc"); |
50 boolean expectSyntheticClass = Boolean.parseBoolean(args[0]); |
|
51 new InnerClassesTest(expectSyntheticClass).test("InnerClassesSrc"); |
43 } |
52 } |
44 |
53 |
45 private List<TestCase> generateClasses() { |
54 private List<TestCase> generateClasses() { |
46 setInnerClassType(ClassType.CLASS); |
55 setInnerClassType(ClassType.CLASS); |
47 setHasSyntheticClass(true); |
56 setHasSyntheticClass(expectSyntheticClass); |
48 return super.generateTestCases(); |
57 return super.generateTestCases(); |
49 } |
58 } |
50 |
59 |
51 private List<TestCase> generateEnums() { |
60 private List<TestCase> generateEnums() { |
52 setInnerOtherModifiers(Modifier.EMPTY, Modifier.STATIC); |
61 setInnerOtherModifiers(Modifier.EMPTY, Modifier.STATIC); |
80 sources.addAll(generateEnums()); |
89 sources.addAll(generateEnums()); |
81 sources.addAll(generateInterfaces()); |
90 sources.addAll(generateInterfaces()); |
82 sources.addAll(generateAnnotations()); |
91 sources.addAll(generateAnnotations()); |
83 return sources; |
92 return sources; |
84 } |
93 } |
|
94 |
|
95 @Override |
|
96 protected List<String> getCompileOptions() { |
|
97 return !expectSyntheticClass ? |
|
98 super.getCompileOptions() : |
|
99 Arrays.asList("-source", "10", "-target", "10"); |
|
100 } |
85 } |
101 } |