File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed
make/langtools/tools/propertiesparser/resources
src/jdk.compiler/share/classes/com/sun/tools/javac Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 11#
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.
33# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44#
55# This code is free software; you can redistribute it and/or modify it
@@ -82,5 +82,5 @@ suppress.warnings=\
8282 @SuppressWarnings("rawtypes")\n
8383
8484lint.category =\
85- LintCategory.get({0})
85+ LintCategory.get({0}).get()
8686
Original file line number Diff line number Diff line change 2828import java .util .Arrays ;
2929import java .util .EnumSet ;
3030import java .util .Map ;
31+ import java .util .Optional ;
3132import java .util .concurrent .ConcurrentHashMap ;
3233
3334import com .sun .tools .javac .code .Symbol .*;
@@ -362,8 +363,14 @@ public enum LintCategory {
362363 map .put (option , this );
363364 }
364365
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 ));
367374 }
368375
369376 public final String option ;
@@ -441,9 +448,8 @@ private void suppress(LintCategory lc) {
441448
442449 public void visitConstant (Attribute .Constant value ) {
443450 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 );
447453 }
448454 }
449455
Original file line number Diff line number Diff line change @@ -1880,7 +1880,7 @@ compiler.warn.lintOption=\
18801880compiler.warn.constant.SVUID =\
18811881 serialVersionUID must be constant in class {0}
18821882
1883- # lint: dangling
1883+ # lint: dangling-doc-comments
18841884compiler.warn.dangling.doc.comment =\
18851885 documentation comment is not attached to any declaration
18861886
You can’t perform that action at this time.
0 commit comments