author | jjg |
Thu, 08 Dec 2016 16:52:38 -0800 | |
changeset 42496 | 49cd6effe616 |
parent 36526 | 3b41f1c69604 |
child 44573 | 245bb4e6f983 |
permissions | -rw-r--r-- |
23114 | 1 |
/* |
42496
49cd6effe616
8170953: CheckResourceKeys tests should declare the resource package to be open
jjg
parents:
36526
diff
changeset
|
2 |
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
23114 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/** |
|
25 |
* @test |
|
26 |
* @bug 8033961 |
|
27 |
* @summary Verify that all LintCategories have their descriptions filled. |
|
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
23114
diff
changeset
|
28 |
* @modules jdk.compiler/com.sun.tools.javac.code |
42496
49cd6effe616
8170953: CheckResourceKeys tests should declare the resource package to be open
jjg
parents:
36526
diff
changeset
|
29 |
* jdk.compiler/com.sun.tools.javac.resources:open |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
23114
diff
changeset
|
30 |
* jdk.compiler/com.sun.tools.javac.util |
23114 | 31 |
*/ |
32 |
||
36526 | 33 |
import java.lang.reflect.Layer; |
34 |
import java.lang.reflect.Module; |
|
23114 | 35 |
import java.util.ArrayList; |
36 |
import java.util.List; |
|
37 |
import java.util.Locale; |
|
38 |
import java.util.MissingResourceException; |
|
39 |
import java.util.ResourceBundle; |
|
40 |
import com.sun.tools.javac.code.Lint.LintCategory; |
|
41 |
import com.sun.tools.javac.util.Log.PrefixKind; |
|
42 |
||
43 |
public class VerifyLintDescriptions { |
|
44 |
public static void main(String... args) { |
|
36526 | 45 |
Layer boot = Layer.boot(); |
46 |
Module jdk_compiler = boot.findModule("jdk.compiler").get(); |
|
23114 | 47 |
ResourceBundle b = ResourceBundle.getBundle("com.sun.tools.javac.resources.javac", |
36526 | 48 |
Locale.US, |
49 |
jdk_compiler); |
|
23114 | 50 |
|
51 |
List<String> missing = new ArrayList<>(); |
|
52 |
||
53 |
for (LintCategory lc : LintCategory.values()) { |
|
54 |
try { |
|
55 |
b.getString(PrefixKind.JAVAC.key("opt.Xlint.desc." + lc.option)); |
|
56 |
} catch (MissingResourceException ex) { |
|
57 |
missing.add(lc.option); |
|
58 |
} |
|
59 |
} |
|
60 |
||
61 |
if (!missing.isEmpty()) { |
|
62 |
throw new UnsupportedOperationException("Lints that are missing description: " + missing); |
|
63 |
} |
|
64 |
} |
|
65 |
||
66 |
} |