Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle
final
variables in instanceof
patterns
Fixes #588 PiperOrigin-RevId: 367902205
- Loading branch information
Showing
4 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 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
8 changes: 8 additions & 0 deletions
8
core/src/test/resources/com/google/googlejavaformat/java/testdata/I588.input
This file contains 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class T { | ||
int f(Object x) { | ||
if (x instanceof final Integer i) { | ||
return i; | ||
} | ||
return -1; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
core/src/test/resources/com/google/googlejavaformat/java/testdata/I588.output
This file contains 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class T { | ||
int f(Object x) { | ||
if (x instanceof final Integer i) { | ||
return i; | ||
} | ||
return -1; | ||
} | ||
} |