Add jpms-basics module: JPMS for working developers, exports vs opens, split packages, automatic modules, jdeps and jlink on JDK 25

Five modules built with plain javac/java/jdeps/jlink on Temurin 25.0.5.1. Sources, broken/ cases,
run.sh and captured transcripts in output/. README row added.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b4XrpfdpsacrvqnrBM
This commit is contained in:
asmhatre
2026-11-26 20:53:17 +05:30
co-authored by Claude Sonnet 5.5
parent 1fb1455734
commit de2660e998
51 changed files with 953 additions and 0 deletions
@@ -0,0 +1,9 @@
package com.acme.badinternal;
import com.acme.greeter.internal.Secrets; // public class, but the package is not exported
public class Main {
public static void main(String[] args) {
System.out.println(Secrets.token());
}
}
@@ -0,0 +1,3 @@
module com.acme.badinternal {
requires com.acme.greeter;
}
@@ -0,0 +1,9 @@
package com.acme.badnoreq;
import com.acme.greeter.api.Greeter;
public class Main {
public static void main(String[] args) {
System.out.println(new Greeter().greet("x"));
}
}
@@ -0,0 +1,3 @@
module com.acme.badnoreq {
// forgot: requires com.acme.greeter;
}
@@ -0,0 +1,10 @@
package com.acme.badtransitive;
import com.acme.greeter.api.Greeter;
public class Main {
public static void main(String[] args) {
var g = new Greeter().greet("x"); // returns com.acme.model.Greeting
System.out.println(g.text());
}
}
@@ -0,0 +1,3 @@
module com.acme.badtransitive {
requires com.acme.greeter; // greeter here was built with a plain `requires com.acme.model`
}
@@ -0,0 +1 @@
package cyc.a; public class A { }
@@ -0,0 +1 @@
module cyc.a { requires cyc.b; exports cyc.a; }
@@ -0,0 +1 @@
package cyc.b; public class B { }
@@ -0,0 +1 @@
module cyc.b { requires cyc.a; exports cyc.b; }
@@ -0,0 +1,3 @@
package com.acme.shared;
public class PartA { }
@@ -0,0 +1 @@
module split.a { exports com.acme.shared; }
@@ -0,0 +1,3 @@
package com.acme.shared;
public class PartB { }
@@ -0,0 +1 @@
module split.b { exports com.acme.shared; }
@@ -0,0 +1,11 @@
package com.acme.splitapp;
import com.acme.shared.PartA;
import com.acme.shared.PartB;
public class Main {
public static void main(String[] args) {
System.out.println(PartA.class.getName() + " from " + PartA.class.getModule());
System.out.println(PartB.class.getName() + " from " + PartB.class.getModule());
}
}
@@ -0,0 +1 @@
module splitapp { requires split.a; requires split.b; }
@@ -0,0 +1 @@
package com.acme.bademptyexport; public class Thing { }
@@ -0,0 +1,3 @@
module com.acme.bademptyexport {
exports com.acme.nothing; // typo: the package is com.acme.bademptyexport
}