Skip to content

Commit 3e7d40e

Browse files
committed
Update class format for Java 19 ...
- samples only for standard features - Javadoc markdown for JEPs
1 parent d486d36 commit 3e7d40e

File tree

1 file changed

+13
-36
lines changed

1 file changed

+13
-36
lines changed
Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,17 @@
11
package pl.mperor.lab.java;
22

3-
import org.junit.jupiter.api.Assertions;
4-
import org.junit.jupiter.api.Test;
5-
import pl.mperor.lab.TestUtils;
6-
import pl.mperor.lab.TestUtils.ReadableOut;
7-
8-
/**
9-
* Java 19 (September 2022)
10-
*/
3+
/// Java 19™ (September 2022)
4+
/// [JDK 19](https://openjdk.org/projects/jdk/19)
5+
///
6+
/// - STANDARD FEATURES:
7+
/// - 422: Linux/RISC-V Port
8+
///
9+
/// - PREVIEW & INCUBATOR:
10+
/// - 405: Record Patterns (Preview)
11+
/// - 424: Foreign Function & Memory API (Preview)
12+
/// - 425: Virtual Threads (Preview)
13+
/// - 427: Pattern Matching for switch (Third Preview)
14+
/// - 428: Structured Concurrency (Incubator)
15+
/// - 426: Vector API (Fourth Incubator)
1116
public class Java19 {
12-
13-
@Test
14-
public void testRecordPatternDeconstruct() {
15-
record Point(int x, int y) {}
16-
record LineSegment(Point start, Point end) {}
17-
Object obj = new LineSegment(new Point(0,1), new Point(1, 2));
18-
19-
if(obj instanceof LineSegment(Point(int x, int y), Point end)) {
20-
Assertions.assertEquals(0, x);
21-
Assertions.assertEquals(1, y);
22-
Assertions.assertEquals(new Point (1,2), end);
23-
}
24-
}
25-
26-
@Test
27-
public void testVirtualThreads() throws InterruptedException {
28-
ReadableOut out = TestUtils.setTempSystemOut();
29-
Thread virtualThread = Thread.startVirtualThread(() ->
30-
System.out.print("Hello from Virtual Thread!")
31-
);
32-
virtualThread.join();
33-
TestUtils.resetSystemOut();
34-
35-
Assertions.assertTrue(virtualThread.isDaemon() && virtualThread.isVirtual());
36-
Assertions.assertEquals(Thread.NORM_PRIORITY, virtualThread.getPriority());
37-
Assertions.assertEquals("Hello from Virtual Thread!", out.all());
38-
}
39-
4017
}

0 commit comments

Comments
 (0)