File tree 3 files changed +14
-8
lines changed
make/langtools/tools/propertiesparser/resources
src/jdk.compiler/share/classes/com/sun/tools/javac
3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 1
1
#
2
- # Copyright (c) 2015, 2019 , Oracle and/or its affiliates. All rights reserved.
2
+ # Copyright (c) 2015, 2024 , Oracle and/or its affiliates. All rights reserved.
3
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
#
5
5
# This code is free software; you can redistribute it and/or modify it
@@ -82,5 +82,5 @@ suppress.warnings=\
82
82
@SuppressWarnings("rawtypes")\n
83
83
84
84
lint.category =\
85
- LintCategory.get({0})
85
+ LintCategory.get({0}).get()
86
86
Original file line number Diff line number Diff line change 28
28
import java .util .Arrays ;
29
29
import java .util .EnumSet ;
30
30
import java .util .Map ;
31
+ import java .util .Optional ;
31
32
import java .util .concurrent .ConcurrentHashMap ;
32
33
33
34
import com .sun .tools .javac .code .Symbol .*;
@@ -362,8 +363,14 @@ public enum LintCategory {
362
363
map .put (option , this );
363
364
}
364
365
365
- public static LintCategory get (String option ) {
366
- return map .get (option );
366
+ /**
367
+ * Get the {@link LintCategory} having the given command line option.
368
+ *
369
+ * @param option lint category option string
370
+ * @return corresponding {@link LintCategory}, or empty if none exists
371
+ */
372
+ public static Optional <LintCategory > get (String option ) {
373
+ return Optional .ofNullable (map .get (option ));
367
374
}
368
375
369
376
public final String option ;
@@ -441,9 +448,8 @@ private void suppress(LintCategory lc) {
441
448
442
449
public void visitConstant (Attribute .Constant value ) {
443
450
if (value .type .tsym == syms .stringType .tsym ) {
444
- LintCategory lc = LintCategory .get ((String ) (value .value ));
445
- if (lc != null )
446
- suppress (lc );
451
+ LintCategory .get ((String )value .value )
452
+ .ifPresent (this ::suppress );
447
453
}
448
454
}
449
455
Original file line number Diff line number Diff line change @@ -1880,7 +1880,7 @@ compiler.warn.lintOption=\
1880
1880
compiler.warn.constant.SVUID =\
1881
1881
serialVersionUID must be constant in class {0}
1882
1882
1883
- # lint: dangling
1883
+ # lint: dangling-doc-comments
1884
1884
compiler.warn.dangling.doc.comment =\
1885
1885
documentation comment is not attached to any declaration
1886
1886
You can’t perform that action at this time.
0 commit comments