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
69 lines
2.1 KiB
Plaintext
69 lines
2.1 KiB
Plaintext
$ java broken/NoMain.java (JDK 25)
|
|
broken/NoMain.java:1: error: compact source file does not have main method in the form of void main() or void main(String[] args)
|
|
void greet() { IO.println("hi"); }
|
|
^
|
|
1 error
|
|
error: compilation failed
|
|
|
|
$ java broken/NoIoPrefix.java (JDK 25)
|
|
broken/NoIoPrefix.java:2: error: cannot find symbol
|
|
println("hello");
|
|
^
|
|
symbol: method println(String)
|
|
location: class NoIoPrefix
|
|
1 error
|
|
error: compilation failed
|
|
|
|
$ java broken/NotInJavaBase.java (JDK 25)
|
|
broken/NotInJavaBase.java:2: error: cannot find symbol
|
|
HttpClient client = HttpClient.newHttpClient();
|
|
^
|
|
symbol: class HttpClient
|
|
location: class NotInJavaBase
|
|
broken/NotInJavaBase.java:2: error: cannot find symbol
|
|
HttpClient client = HttpClient.newHttpClient();
|
|
^
|
|
symbol: variable HttpClient
|
|
location: class NotInJavaBase
|
|
2 errors
|
|
error: compilation failed
|
|
|
|
$ java broken/WithPackage.java (JDK 25)
|
|
broken/WithPackage.java:1: error: compact source file should not have package declaration
|
|
package demo;
|
|
^
|
|
1 error
|
|
error: compilation failed
|
|
|
|
$ javac -d out broken/Other.java broken/Target.java (JDK 25; Target.java is a compact file)
|
|
broken/Other.java:2: error: Target is abstract; cannot be instantiated
|
|
Target t = new Target();
|
|
^
|
|
broken/Other.java:3: error: cannot find symbol
|
|
t.main();
|
|
^
|
|
symbol: method main()
|
|
location: variable t of type Target
|
|
2 errors
|
|
|
|
$ java broken/Other.java (JDK 25; source launcher, Target.java sits next to it)
|
|
broken/Other.java:2: error: Target is abstract; cannot be instantiated
|
|
Target t = new Target();
|
|
^
|
|
1 error
|
|
error: compilation failed
|
|
|
|
$ java broken/WrongParam.java (JDK 25)
|
|
broken/WrongParam.java:1: error: compact source file does not have main method in the form of void main() or void main(String[] args)
|
|
void main(int count) { IO.println("count = " + count); }
|
|
^
|
|
1 error
|
|
error: compilation failed
|
|
|
|
$ java broken/PrivateMain.java (JDK 25)
|
|
error: can't find main(String[]) or main() method in class: PrivateMain
|
|
|
|
$ java broken/CtorWithArgs.java (JDK 25)
|
|
error: can't find no argument constructor in class: CtorWithArgs
|
|
|