-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8359493: Refactor how aggregated mandatory warnings are handled in the compiler #25810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
75d9edf
Refactor MandatoryWarningHandler to just be an aggregator.
archiecobbs 81670b1
Apply some review suggestions.
archiecobbs 2ebeefc
Add DiagnosticFlag support to compiler.properties and put AGGREGATE t…
archiecobbs 95b368f
Move (most) SOURCE_LEVEL flags into compiler.properties.
archiecobbs 94cda82
Merge branch 'master' into MandatoryWarningCleanup
archiecobbs 8d822b1
Remove assumptions about mandatoryness from the MandatoryWarningAggre…
archiecobbs 2b16d65
Address review suggestions.
archiecobbs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# | ||
# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. | ||
# Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. | ||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
# | ||
# This code is free software; you can redistribute it and/or modify it | ||
|
@@ -27,13 +27,17 @@ toplevel.decl=\ | |
package {0};\n\ | ||
\n\ | ||
{1}\n\ | ||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;\n\ | ||
import com.sun.tools.javac.util.JCDiagnostic.Error;\n\ | ||
import com.sun.tools.javac.util.JCDiagnostic.Warning;\n\ | ||
import com.sun.tools.javac.util.JCDiagnostic.LintWarning;\n\ | ||
import com.sun.tools.javac.util.JCDiagnostic.Note;\n\ | ||
import com.sun.tools.javac.util.JCDiagnostic.Fragment;\n\ | ||
import com.sun.tools.javac.code.Lint.LintCategory;\n\ | ||
\n\ | ||
import java.util.Locale;\n\ | ||
import java.util.stream.Stream;\n\ | ||
\n\ | ||
public class {2} '{'\n\ | ||
{3}\n\ | ||
'}'\n | ||
|
@@ -58,22 +62,22 @@ factory.decl.method.arg=\ | |
arg{0} | ||
|
||
factory.decl.method.body=\ | ||
return new {0}({1}, {2}, {3}); | ||
return new {0}({1}, {2}, {3}, {4}); | ||
|
||
factory.decl.method.body.lint=\ | ||
return new {0}({1}, {2}, {3}, {4}); | ||
return new {0}({1}, {2}, {3}, {4}, {5}); | ||
|
||
factory.decl.field=\ | ||
/**\n\ | ||
' '* {4}\n\ | ||
' '*/\n\ | ||
public static final {0} {1} = new {0}({2}, {3}); | ||
public static final {0} {1} = new {0}({2}, {3}, {4}); | ||
|
||
factory.decl.field.lint=\ | ||
/**\n\ | ||
' '* {5}\n\ | ||
' '*/\n\ | ||
public static final {0} {1} = new {0}({2}, {3}, {4}); | ||
public static final {0} {1} = new {0}({2}, {3}, {4}, {5}); | ||
|
||
wildcards.extends=\ | ||
{0}<? extends {1}> | ||
|
@@ -84,3 +88,10 @@ suppress.warnings=\ | |
lint.category=\ | ||
LintCategory.get({0}).get() | ||
|
||
diagnostic.flags=\n\ | ||
' 'Stream.of({0})\n\ | ||
' '.map(s -> s.replace(''-'', ''_''))\n\ | ||
' '.map(s -> s.toUpperCase(Locale.ROOT))\n\ | ||
' '.map(DiagnosticFlag::valueOf)\n\ | ||
' '.toArray(DiagnosticFlag[]::new) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If instead of an array we returned a list, or a set, maybe we could use empty list/set if there's no flag (instead of |
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These transformations could be also done in Java code inside
ClassGenerator
right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's simpler. Thanks for this and your other suggestions - all good ones. They should all be addressed in 2b16d65.