Add jep512 module: compact source files and instance main methods on JDK 25 and 27
Runnable sources, broken examples and captured transcripts for the ankurm.com JEP 512 article, including the measured launch order and a private-constructor difference between 25 and 27. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TF9JWFvJSNm6HVzswzZU5a
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
class CtorWithArgs {
|
||||
CtorWithArgs(int x) {}
|
||||
void main() { IO.println("instance main, but no zero-argument constructor"); }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
void main() {
|
||||
println("hello");
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
void greet() { IO.println("hi"); }
|
||||
@@ -0,0 +1,4 @@
|
||||
void main() {
|
||||
HttpClient client = HttpClient.newHttpClient();
|
||||
IO.println(client);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
void main() {
|
||||
Target t = new Target();
|
||||
t.main();
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
class PrivateCtor {
|
||||
private PrivateCtor() {}
|
||||
void main() { IO.println("instance main() reached through a PRIVATE zero-argument constructor"); }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class PrivateMain {
|
||||
private static void main() { IO.println("private static main"); }
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
void main() { IO.println("Target"); }
|
||||
@@ -0,0 +1,5 @@
|
||||
package demo;
|
||||
|
||||
void main() {
|
||||
IO.println("a package declaration in a compact file");
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
void main(int count) { IO.println("count = " + count); }
|
||||
Reference in New Issue
Block a user