Skip to content

Commit 11f3b11

Browse files
committed
Add test classes and features for Java 24 and 25
- includes samples for standard features only - adds markdown javadoc for JEPs - organizes classes related to Java 24 and 25 - introduces `CompactSourceFile` and `JavaBaseImport` classes
1 parent dadbe57 commit 11f3b11

File tree

4 files changed

+113
-0
lines changed

4 files changed

+113
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// Is a final top-level class in the unnamed package;
2+
/// Extends java.lang.Object and does not implement any interfaces;
3+
/// Has a default constructor with no parameters, and no other constructors;
4+
/// Has, as its members, the fields and methods in the compact source file; and
5+
/// Must have a launchable main method; if it does not, a compile-time error is reported.
6+
void main() {
7+
IO.println("Compact source file & main method here ...");
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package pl.mperor.lab.java;
2+
3+
import module java.base;
4+
5+
class JavaBaseImport {
6+
7+
private final List<String> listFromUtilPackage = List.of("a", "b", "c");
8+
private final File fileFromIoPackage = new File("file.txt");
9+
10+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package pl.mperor.lab.java;
2+
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.Test;
5+
6+
import java.util.List;
7+
import java.util.stream.Gatherers;
8+
import java.util.stream.IntStream;
9+
10+
/// Java 24 (March 2025)
11+
/// [JDK 24](https://openjdk.org/projects/jdk/24)
12+
///
13+
/// - STANDARD FEATURES:
14+
/// - 472: Prepare to Restrict the Use of JNI
15+
/// - 475: Late Barrier Expansion for G1
16+
/// - 479: Remove the Windows 32-bit x86 Port
17+
/// - 483: Ahead-of-Time Class Loading & Linking
18+
/// - 484: Class-File API
19+
/// - 485: Stream Gatherers
20+
/// - 486: Permanently Disable the Security Manager
21+
/// - 490: ZGC: Remove the Non-Generational Mode
22+
/// - 491: Synchronize Virtual Threads without Pinning
23+
/// - 493: Linking Run-Time Images without JMODs
24+
/// - 496: Quantum-Resistant Module-Lattice-Based Key Encapsulation Mechanism
25+
/// - 497: Quantum-Resistant Module-Lattice-Based Digital Signature Algorithm
26+
/// - 498: Warn upon Use of Memory-Access Methods in sun.misc.Unsafe
27+
/// - 501: Deprecate the 32-bit x86 Port for Removal
28+
///
29+
/// - PREVIEW & INCUBATOR:
30+
/// - 404: Generational Shenandoah (Experimental)
31+
/// - 450: Compact Object Headers (Experimental)
32+
/// - 478: Key Derivation Function API (Preview)
33+
/// - 487: Scoped Values (Fourth Preview)
34+
/// - 488: Primitive Types in Patterns, instanceof, and switch (Second Preview)
35+
/// - 489: Vector API (Ninth Incubator)
36+
/// - 492: Flexible Constructor Bodies (Third Preview)
37+
/// - 494: Module Import Declarations (Second Preview)
38+
/// - 495: Simple Source Files and Instance Main Methods (Fourth Preview)
39+
public class Java24 {
40+
41+
@Test
42+
public void testWindowFixedGatherer() {
43+
var result = IntStream.rangeClosed(1, 3)
44+
.boxed()
45+
.gather(Gatherers.windowFixed(2))
46+
.toList();
47+
48+
Assertions.assertEquals(
49+
List.of(
50+
List.of(1, 2),
51+
List.of(3)
52+
), result);
53+
}
54+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package pl.mperor.lab.java;
2+
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.Test;
5+
import pl.mperor.lab.common.TestUtils;
6+
7+
/// Java 25 (September 2025)
8+
/// [JDK 25](https://openjdk.org/projects/jdk/25)
9+
///
10+
/// - STANDARD FEATURES:
11+
/// - 503: Remove the 32-bit x86 Port
12+
/// - 506: Scoped Values
13+
/// - 510: Key Derivation Function API
14+
/// - 511: Module Import Declarations
15+
/// - 512: Compact Source Files and Instance Main Methods
16+
/// - 513: Flexible Constructor Bodies
17+
/// - 514: Ahead-of-Time Command-Line Ergonomics
18+
/// - 515: Ahead-of-Time Method Profiling
19+
/// - 518: JFR Cooperative Sampling
20+
/// - 519: Compact Object Headers
21+
/// - 520: JFR Method Timing & Tracing
22+
/// - 521: Generational Shenandoah
23+
///
24+
/// - PREVIEW & INCUBATOR:
25+
/// - 470: PEM Encodings of Cryptographic Objects (Preview)
26+
/// - 502: Stable Values (Preview)
27+
/// - 505: Structured Concurrency (Fifth Preview)
28+
/// - 507: Primitive Types in Patterns, instanceof, and switch (Third Preview)
29+
/// - 508: Vector API (Tenth Incubator)
30+
/// - 509: JFR CPU-Time Profiling (Experimental)
31+
public class Java25 {
32+
33+
@Test
34+
public void testPrintFromIOClass() {
35+
var out = TestUtils.setTempSystemOut();
36+
IO.println("Hello World!"); // ⇒ System.out.println("Hello World!");
37+
Assertions.assertEquals("Hello World!" + System.lineSeparator(), out.all());
38+
TestUtils.resetSystemOut();
39+
}
40+
41+
}

0 commit comments

Comments
 (0)