Note with the issue
vault/10_mechanisms/instanceof-pattern-matching.md
The issue
The note's content on pattern matching for instanceof (JEP 394, Java 16) and record
patterns (JEP 440, Java 21) is technically accurate. The bytecode description, scope
rules, null behavior, and guarded pattern examples are all correct.
Two points require correction, both concerning the primitive types in patterns section.
Point 1 — Wrong JEP number attributed to Java 23.
The primary_source frontmatter field states:
"JEP 488 (primitive types in patterns, preview, Java 23)"
This is incorrect. The first preview of primitive types in patterns was JEP 455,
targeted to Java 23. JEP 488 is the second preview, targeted to Java 24. The full
progression is:
- JEP 455: first preview, Java 23
- JEP 488: second preview, Java 24
- JEP 507: third preview, Java 25
The primary_source field should reference JEP 455 for Java 23, not JEP 488.
Point 2 — Primitive patterns are still preview in Java 25, which the note underreports.
The "Java 21 versus Java 25" section advises the reader to "verify the finalization
status" before using primitive patterns in Java 25. The current status is unambiguous
and should be stated explicitly: JEP 507 (third preview) shipped in Java 25 and the
feature is still in preview. It requires --enable-preview at compilation and at runtime.
It is not available in production code targeting Java 25 without that flag.
Point 3 — Broken links.
Two of the three outgoing links in the Connections section point to notes that do not
exist in the vault:
- [[switch-with-pattern-matching]] -- no file found
- [[sealed-classes-exhaustiveness]] -- no file found
([[unboxing-null-npe]] exists and links correctly.)
Suggested correction
For point 1, replace the primary_source frontmatter value with:
"JEP 394 (instanceof pattern matching, final, Java 16); JEP 440 (record patterns,
final, Java 21); JEP 455 (primitive types in patterns, first preview, Java 23);
JEP 488 (second preview, Java 24); JEP 507 (third preview, Java 25)"
For point 2, replace the open-ended advisory with a precise statement:
"In Java 25 (JEP 507, third preview): primitive type patterns remain in preview.
Using num instanceof int i or any primitive pattern requires --enable-preview at
compilation (javac --enable-preview --release 25) and at runtime
(java --enable-preview). Production code targeting Java 25 cannot rely on primitive
patterns without the preview flag. Finalization is pending a future release."
For point 3: editorial discretion on the broken links.
Affected Java version
Point 1: attribution error spans Java 23 and Java 24.
Point 2: status of primitive patterns is specific to Java 25.
Java 21 behavior is unaffected -- record patterns (JEP 440) and guarded patterns are
final and require no flags in Java 21 or Java 25.
Note with the issue
vault/10_mechanisms/instanceof-pattern-matching.mdThe issue
The note's content on pattern matching for instanceof (JEP 394, Java 16) and record
patterns (JEP 440, Java 21) is technically accurate. The bytecode description, scope
rules, null behavior, and guarded pattern examples are all correct.
Two points require correction, both concerning the primitive types in patterns section.
Point 1 — Wrong JEP number attributed to Java 23.
The primary_source frontmatter field states:
This is incorrect. The first preview of primitive types in patterns was JEP 455,
targeted to Java 23. JEP 488 is the second preview, targeted to Java 24. The full
progression is:
The primary_source field should reference JEP 455 for Java 23, not JEP 488.
Point 2 — Primitive patterns are still preview in Java 25, which the note underreports.
The "Java 21 versus Java 25" section advises the reader to "verify the finalization
status" before using primitive patterns in Java 25. The current status is unambiguous
and should be stated explicitly: JEP 507 (third preview) shipped in Java 25 and the
feature is still in preview. It requires --enable-preview at compilation and at runtime.
It is not available in production code targeting Java 25 without that flag.
Point 3 — Broken links.
Two of the three outgoing links in the Connections section point to notes that do not
exist in the vault:
([[unboxing-null-npe]] exists and links correctly.)
Suggested correction
For point 1, replace the primary_source frontmatter value with:
"JEP 394 (instanceof pattern matching, final, Java 16); JEP 440 (record patterns,
final, Java 21); JEP 455 (primitive types in patterns, first preview, Java 23);
JEP 488 (second preview, Java 24); JEP 507 (third preview, Java 25)"
For point 2, replace the open-ended advisory with a precise statement:
"In Java 25 (JEP 507, third preview): primitive type patterns remain in preview.
Using num instanceof int i or any primitive pattern requires --enable-preview at
compilation (javac --enable-preview --release 25) and at runtime
(java --enable-preview). Production code targeting Java 25 cannot rely on primitive
patterns without the preview flag. Finalization is pending a future release."
For point 3: editorial discretion on the broken links.
Affected Java version
Point 1: attribution error spans Java 23 and Java 24.
Point 2: status of primitive patterns is specific to Java 25.
Java 21 behavior is unaffected -- record patterns (JEP 440) and guarded patterns are
final and require no flags in Java 21 or Java 25.