author | jlahoda |
Tue, 24 Sep 2019 15:40:26 +0200 | |
branch | JDK-8226585-branch |
changeset 58290 | d885633d9de4 |
parent 58109 | ee07de0d2c16 |
permissions | -rw-r--r-- |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
1 |
/* |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
4 |
* |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
8 |
* |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
13 |
* accompanied this code). |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
14 |
* |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
18 |
* |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
21 |
* questions. |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
22 |
*/ |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
23 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
24 |
/* |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
25 |
* @test |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
26 |
* @bug 8226585 |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
27 |
* @summary Verify behavior w.r.t. preview feature API errors and warnings |
58290 | 28 |
* @library /tools/lib /tools/javac/lib |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
29 |
* @modules |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
30 |
* java.base/jdk.internal |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
31 |
* jdk.compiler/com.sun.tools.javac.api |
58290 | 32 |
* jdk.compiler/com.sun.tools.javac.file |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
33 |
* jdk.compiler/com.sun.tools.javac.main |
58290 | 34 |
* jdk.compiler/com.sun.tools.javac.util |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
35 |
* @build toolbox.ToolBox toolbox.JavacTask |
58290 | 36 |
* @build combo.ComboTestHelper |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
37 |
* @compile --enable-preview -source ${jdk.version} PreviewErrors.java |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
38 |
* @run main/othervm --enable-preview PreviewErrors |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
39 |
*/ |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
40 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
41 |
import java.io.IOException; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
42 |
import java.nio.file.Files; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
43 |
import java.nio.file.Path; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
44 |
import java.nio.file.Paths; |
58290 | 45 |
|
46 |
import combo.ComboInstance; |
|
47 |
import combo.ComboParameter; |
|
48 |
import combo.ComboTask; |
|
49 |
import combo.ComboTestHelper; |
|
50 |
import java.util.Arrays; |
|
51 |
import java.util.Set; |
|
52 |
import java.util.stream.Collectors; |
|
53 |
import javax.tools.Diagnostic; |
|
54 |
||
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
55 |
import jdk.internal.PreviewFeature; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
56 |
|
58290 | 57 |
import toolbox.JavacTask; |
58 |
import toolbox.ToolBox; |
|
59 |
||
60 |
public class PreviewErrors extends ComboInstance<PreviewErrors> { |
|
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
61 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
62 |
protected ToolBox tb; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
63 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
64 |
PreviewErrors() { |
58290 | 65 |
super(); |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
66 |
tb = new ToolBox(); |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
67 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
68 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
69 |
public static void main(String... args) throws Exception { |
58290 | 70 |
new ComboTestHelper<PreviewErrors>() |
71 |
.withDimension("ESSENTIAL", (x, essential) -> x.essential = essential, EssentialAPI.values()) |
|
72 |
.withDimension("PREVIEW", (x, preview) -> x.preview = preview, Preview.values()) |
|
73 |
.withDimension("LINT", (x, lint) -> x.lint = lint, Lint.values()) |
|
74 |
.withDimension("SUPPRESS", (x, suppress) -> x.suppress = suppress, Suppress.values()) |
|
75 |
.run(PreviewErrors::new); |
|
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
76 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
77 |
|
58290 | 78 |
private EssentialAPI essential; |
79 |
private Preview preview; |
|
80 |
private Lint lint; |
|
81 |
private Suppress suppress; |
|
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
82 |
|
58290 | 83 |
@Override |
84 |
public void doWork() throws IOException { |
|
85 |
Path base = Paths.get("."); |
|
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
86 |
Path src = base.resolve("src"); |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
87 |
Path srcJavaBase = src.resolve("java.base"); |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
88 |
Path classes = base.resolve("classes"); |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
89 |
Path classesJavaBase = classes.resolve("java.base"); |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
90 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
91 |
Files.createDirectories(classesJavaBase); |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
92 |
|
58290 | 93 |
tb.writeJavaFiles(srcJavaBase, |
94 |
""" |
|
95 |
package java.lang; |
|
96 |
public class Extra { |
|
97 |
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.${preview} |
|
98 |
${essential}) |
|
99 |
public static void test() { } |
|
100 |
} |
|
101 |
""".replace("${preview}", PreviewFeature.Feature.values()[0].name()) |
|
102 |
.replace("${essential}", essential.expand(null))); |
|
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
103 |
|
58290 | 104 |
new JavacTask(tb) |
105 |
.outdir(classesJavaBase) |
|
106 |
.options("--patch-module", "java.base=" + srcJavaBase.toString()) |
|
107 |
.files(tb.findJavaFiles(srcJavaBase)) |
|
108 |
.run() |
|
109 |
.writeAll(); |
|
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
110 |
|
58290 | 111 |
ComboTask task = newCompilationTask() |
112 |
.withSourceFromTemplate(""" |
|
113 |
package test; |
|
114 |
public class Test { |
|
115 |
#{SUPPRESS} |
|
116 |
public void test() { |
|
117 |
Extra.test(); |
|
118 |
} |
|
119 |
} |
|
120 |
""") |
|
121 |
.withOption("-XDrawDiagnostics") |
|
122 |
.withOption("--patch-module") |
|
123 |
.withOption("java.base=" + classesJavaBase.toString()) |
|
124 |
.withOption("-source") |
|
125 |
.withOption(String.valueOf(Runtime.version().feature())); |
|
126 |
if (preview.expand(null)!= null) { |
|
127 |
task = task.withOption(preview.expand(null)); |
|
128 |
} |
|
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
129 |
|
58290 | 130 |
if (lint.expand(null) != null) { |
131 |
task = task.withOption(lint.expand(null)); |
|
132 |
} |
|
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
133 |
|
58290 | 134 |
task.generate(result -> { |
135 |
Set<String> actual = Arrays.stream(Diagnostic.Kind.values()) |
|
136 |
.flatMap(kind -> result.diagnosticsForKind(kind).stream()) |
|
137 |
.map(d -> d.getLineNumber() + ":" + d.getColumnNumber() + ":" + d.getCode()) |
|
138 |
.collect(Collectors.toSet()); |
|
139 |
Set<String> expected; |
|
140 |
boolean ok; |
|
141 |
if (essential == EssentialAPI.YES) { |
|
142 |
if (preview == Preview.YES) { |
|
143 |
if (lint == Lint.ENABLE_PREVIEW) { |
|
144 |
expected = Set.of("5:14:compiler.warn.is.preview"); |
|
145 |
} else { |
|
146 |
expected = Set.of("-1:-1:compiler.note.preview.filename", |
|
147 |
"-1:-1:compiler.note.preview.recompile"); |
|
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
148 |
} |
58290 | 149 |
ok = true; |
150 |
} else { |
|
151 |
expected = Set.of("5:14:compiler.err.is.preview"); |
|
152 |
ok = false; |
|
153 |
} |
|
154 |
} else { |
|
155 |
if (suppress == Suppress.YES) { |
|
156 |
expected = Set.of(); |
|
157 |
} else if ((preview == Preview.YES && (lint == Lint.NONE || lint == Lint.DISABLE_PREVIEW)) || |
|
158 |
(preview == Preview.NO && lint == Lint.DISABLE_PREVIEW)) { |
|
159 |
expected = Set.of("-1:-1:compiler.note.preview.filename", |
|
160 |
"-1:-1:compiler.note.preview.recompile"); |
|
161 |
} else { |
|
162 |
expected = Set.of("5:14:compiler.warn.is.preview"); |
|
163 |
} |
|
164 |
ok = true; |
|
165 |
} |
|
166 |
if (ok) { |
|
167 |
if (!result.get().iterator().hasNext()) { |
|
168 |
throw new IllegalStateException("Did not succeed as expected."); |
|
169 |
} |
|
170 |
} else { |
|
171 |
if (result.get().iterator().hasNext()) { |
|
172 |
throw new IllegalStateException("Succeed unexpectedly."); |
|
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
173 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
174 |
} |
58290 | 175 |
if (!expected.equals(actual)) { |
176 |
throw new IllegalStateException("Unexpected output for " + essential + ", " + preview + ", " + lint + ", " + suppress + ": " + actual.toString()); |
|
177 |
} |
|
178 |
}); |
|
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
179 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
180 |
|
58290 | 181 |
public enum EssentialAPI implements ComboParameter { |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
182 |
YES(", essentialAPI=true"), |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
183 |
NO(", essentialAPI=false"); |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
184 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
185 |
private final String code; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
186 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
187 |
private EssentialAPI(String code) { |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
188 |
this.code = code; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
189 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
190 |
|
58290 | 191 |
public String expand(String optParameter) { |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
192 |
return code; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
193 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
194 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
195 |
|
58290 | 196 |
public enum Preview implements ComboParameter { |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
197 |
YES("--enable-preview"), |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
198 |
NO(null); |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
199 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
200 |
private final String opt; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
201 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
202 |
private Preview(String opt) { |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
203 |
this.opt = opt; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
204 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
205 |
|
58290 | 206 |
public String expand(String optParameter) { |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
207 |
return opt; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
208 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
209 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
210 |
|
58290 | 211 |
public enum Lint implements ComboParameter { |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
212 |
NONE(null), |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
213 |
ENABLE_PREVIEW("-Xlint:preview"), |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
214 |
DISABLE_PREVIEW("-Xlint:-preview"); |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
215 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
216 |
private final String opt; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
217 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
218 |
private Lint(String opt) { |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
219 |
this.opt = opt; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
220 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
221 |
|
58290 | 222 |
public String expand(String optParameter) { |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
223 |
return opt; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
224 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
225 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
226 |
|
58290 | 227 |
public enum Suppress implements ComboParameter { |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
228 |
YES("@SuppressWarnings(\"preview\")"), |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
229 |
NO(""); |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
230 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
231 |
private final String code; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
232 |
|
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
233 |
private Suppress(String code) { |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
234 |
this.code = code; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
235 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
236 |
|
58290 | 237 |
public String expand(String optParameter) { |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
238 |
return code; |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
239 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
240 |
} |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
diff
changeset
|
241 |
} |