To run each example use: java --enable-preview --source 20 <FileName.java>
- Record patterns (second preview)
- added support for inference of type arguments of generic record patterns;
- now it generic type can be inferred
- given
record Decorator<T>(T t) {}and variableDecorator<Decorator<String>> wr, thee record pattern generic type can be inferred inw insteaceof Decorator(Decorator(var s))
- added support for record patterns to appear in the headere of an enhanced for statement;
for (Point(var x, var y) : shapePoints)
- remove support for named record pattner.
- added support for inference of type arguments of generic record patterns;
- Patteren matching for
switch(fourth preview)- added support for inference of type arguments for generic record patterns
- Virtual threads (second preview)
- small numbeer of API changes described by JEP 425 were made permanent in JDK 19 and are not proporsed to preview:
Thread.join(Durantion)Thread.sleep(Duration)Thread.threadId()Future.resultNow()Future.exceptionNow()Future.state()ExecutorSereviceextendsAutoClosable
- small numbeer of API changes described by JEP 425 were made permanent in JDK 19 and are not proporsed to preview:
JEPs proposed to target: