Add java28-features module: the JDK 28 JEP list so far, one example per JEP on 28-ea+26, behaviour changes against JDK 27
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7N4ZDbUtA3ofqAqRV
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
c0062ea398
commit
d4b8552957
@@ -0,0 +1,9 @@
|
||||
// A value class must set its fields before the superclass constructor runs.
|
||||
value class Account {
|
||||
private final long id;
|
||||
|
||||
Account(long id) {
|
||||
super();
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// An ordinary (identity) record. No value classes anywhere in this file.
|
||||
import java.util.List;
|
||||
|
||||
record Node(String label, List<Node> edges) {
|
||||
static void nullCheck(Object arg, Object owner) {
|
||||
if (arg == null) throw new IllegalArgumentException("null arg for " + owner);
|
||||
}
|
||||
|
||||
public Node {
|
||||
nullCheck(label, this);
|
||||
nullCheck(edges, this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user