Skip to content

Commit 609d032

Browse files
authored
Merge pull request #143 from javaevolved/copilot/update-java-version-guarded-patterns
Fix guarded-patterns: replace instanceof pattern matching with Java 8 compatible old code
2 parents d735465 + bd016a6 commit 609d032

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

content/language/guarded-patterns.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ modernLabel: "Java 21+"
1010
oldApproach: "Nested if"
1111
modernApproach: "when Clause"
1212
oldCode: |-
13-
if (shape instanceof Circle c) {
13+
if (shape instanceof Circle) {
14+
Circle c = (Circle) shape;
1415
if (c.radius() > 10) {
1516
return "large circle";
1617
} else {

0 commit comments

Comments
 (0)