Skip to content

Commit bd016a6

Browse files
Copilotbrunoborges
andauthored
Fix guarded-patterns: revert oldLabel to Java 8, use Java 8 compatible old code
Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com> Agent-Logs-Url: https://github.com/javaevolved/javaevolved.github.io/sessions/3b716d37-be8d-4d05-8f2c-416583048b5c
1 parent 8bc9bab commit bd016a6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

content/language/guarded-patterns.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ title: "Guarded patterns with when"
55
category: "language"
66
difficulty: "intermediate"
77
jdkVersion: "21"
8-
oldLabel: "Java 16"
8+
oldLabel: "Java 8"
99
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)