Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions java-24/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To run each example use: `java --enable-preview --source 24 <FileName.java>`
* [479](https://openjdk.org/jeps/479) - Remove the Windows 32-bit x86 Port
* [483](https://openjdk.org/jeps/483) - Ahead-of-Time Class Loading & Linking
* [484](https://openjdk.org/jeps/484) - Class-File API
* [485](https://openjdk.org/jeps/485) - Steam Gatherers
* [485](https://openjdk.org/jeps/485) - Stream Gatherers
* [486](https://openjdk.org/jeps/486) - Permanently Disable the Security Manager
* [487](https://openjdk.org/jeps/487) - Scoped Values (Fourth Preview)
* [488](https://openjdk.org/jeps/488) - Primitive Types in Patterns, instanceof, and switch (Second Preview)
Expand Down Expand Up @@ -67,7 +67,7 @@ To run each example use: `java --enable-preview --source 24 <FileName.java>`
* if external resources cannot be used during the training run, we could mock or disable them (it will be loaded just-in-time)
* we could use a smoke test to run enough scenarios used by the application, some testing classes will be cached (in the future a filter will be provided)
* we should avoid using complete large test suites (unit tests, corner cases, so on) because it will increase the size of the cache with useless classes (scenarios with fewer usage)
* the training run should do similiar things as production run, otherwise the cache will be less useful
* the training run should do similar things as production run, otherwise the cache will be less useful
* **Class-File API**
* provide standard API for parsing, generating and modifying Java class file
* provide standard API that is up to date with the features from current JDK released
Expand All @@ -82,10 +82,10 @@ To run each example use: `java --enable-preview --source 24 <FileName.java>`
* API [`java.lang.classfile`](https://download.java.net/java/early_access/jdk24/docs/api/java.base/java/lang/classfile/package-summary.html) defines three main abstractions:
* element: immutable description of some part of class file (instruction, attribute, field, method or an entire class)
* builder: each compound element has a builder with methods to help construct the element
* transform: represents a function that takes an element and a builder and mediates how that element is transformed (replaced, droped or passed to another builder)
* transform: represents a function that takes an element and a builder and mediates how that element is transformed (replaced, dropped or passed to another builder)
* we can iterate, transform or build elements using streams and Lambdas
* we can use `transformClass`, `transformMethod` and `transformCode` to transform an element
* to read a classe we must use `ClassFile`:
* to read a class we must use `ClassFile`:
* `ClassModel cm = ClassFile.of().parse(bytes);`
* `ClassFile` is an iterable where we can navigates all its elements (fields, methods, etc) using pattern matching (instead of visitor in other libs):
*
Expand All @@ -110,14 +110,14 @@ To run each example use: `java --enable-preview --source 24 <FileName.java>`
System.out.println("Method " + mm.methodName().stringValue());
}
```
* **Steam Gatherers**
* **Stream Gatherers**
* promotion to standard without change
* **Scoped Values**
* re-preview with API changes
* removed methods `callWhere` and `runWhere` to make API more fluent
* `ScopedValue.where(SCOPE, "my-value").run(() -> {});` instead of `ScopedValue.runWhere(SCOPE, "my-value", () -> {})`
* `ScopedValue.where(SCOPE, "my-value").call(() -> {});` instead of `ScopedValue.callWhere(SCOPE, "my-value", () -> {})`
* we can bind multiples values:
* we can bind multiple values:
* `ScopedValue.where(SCOPE_A, "my-value").where(SCOPE_B, "other-value").run(() -> {})`
* **Primitive Types in Patterns, instanceof, and switch**
* re-preview without change
Expand All @@ -135,8 +135,8 @@ To run each example use: `java --enable-preview --source 24 <FileName.java>`
* change the virtual threads to release the platform threads when blocked by synchronized methods and statements
* eliminates nearly all cases of virtual threads being pinned to platform thread
* scenarios where the virtual threads can be pinned:
* when inside a synchronized block, if it tries to get another object's monitor, the virtual thread is blocked and pinned until it can adquire the monitor
* when it tries to invoke a synchronized method that is already locked by another thread, the virtual thread is pinned and blocked until it can adquire the monitor
* when inside a synchronized block, if it tries to get another object's monitor, the virtual thread is blocked and pinned until it can acquire the monitor
* when it tries to invoke a synchronized method that is already locked by another thread, the virtual thread is pinned and blocked until it can acquire the monitor
* the system property `jdk.tracePinnedThreads` was removed
* recommendations:
* use synchronized where practical, since it is more convenient and less error prone
Expand Down