Issue #14891: MissingSwitchDefault should not violate switch that con…#14973
Conversation
|
Github, generate report |
37bdf86 to
4341db8
Compare
|
@nrmancuso , @rnveach , try think of we should collect such test bundles (config , list of projects) in our test-configs repository. @relentless-pursuit , as you finish generation of basic set of configs, you will be immediately huge help for others. People will not use gist anymore for simple cases. |
rnveach
left a comment
There was a problem hiding this comment.
Add one more input example where the switch does have a default.
https://checkstyle.org/checks/coding/missingswitchdefault.html#Description
This check does not validate switch statements that use pattern or null labels. Rationale: Switch statements that use pattern or null labels are checked by the compiler for exhaustiveness.
You made a point to update the javadoc. Shouldn't this be updated as well?
See the Java Language Specification for more information about switch statements and expressions
Shouldn't we update this to the new JLS also show the new patterns?
I assumed that the word "pattern" in "that use pattern or null labels." includes both normal type patterns and record pattern |
4341db8 to
e36a233
Compare
|
Github, generate site |
| * and expressions. | ||
| * </p> | ||
| * <p> | ||
| * See the <a href="https://docs.oracle.com/javase/specs/jls/se17/html/jls-14.html#jls-14.30"> |
There was a problem hiding this comment.
new record pattern syntax introduced in Java 21
I would expect use to use the new JLS in which it was introduced. Update the one before it as well.
…h that contains record pattern case label
e36a233 to
ba2f05c
Compare
|
Github, generate site |
closes #14891 :
Diff Regression config: https://gist.githubusercontent.com/mahfouz72/afd57aa6e51ca161b7927acd959e5211/raw/fd6bb80bfe66feb1d7bf946caf87c0a7be981f6c/check.xml
Diff Regression projects: https://gist.githubusercontent.com/mahfouz72/a3d0af030c8f5efd0d8a39f2c14750bc/raw/a3424ad9b6f722e5de1a927e3d85e383101b2b93/projects-to-test-on.properties