Skip to content

Commit 9a25608

Browse files
committed
fix: add docs
1 parent e5af872 commit 9a25608

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

docs/src/modules/ROOT/pages/integration/integration.adoc

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -993,8 +993,10 @@ class Resource {
993993
[#integrationWithJPMS]
994994
=== Java platform module system (Jigsaw)
995995

996-
When using Timefold Solver from code on the modulepath (Java 9 and higher),
997-
_open_ your packages that contain your domain objects, constraints and solver configuration
996+
Starting in version 2.0, Timefold Solver has official support for the https://openjdk.org/projects/jigsaw/spec/[Java Platform Module System (JPMS)].
997+
998+
When using Timefold Solver from code on the modulepath,
999+
_export_ and _open_ your packages that contain your domain objects, constraints and solver configuration
9981000
_to all modules_ in your `module-info.java` file:
9991001

10001002
[source,java,options="nowrap"]
@@ -1003,13 +1005,32 @@ module org.acme.vehiclerouting {
10031005
requires ai.timefold.solver.core;
10041006
...
10051007
1006-
opens org.acme.vehiclerouting.domain; // Domain classes
1007-
opens org.acme.vehiclerouting.solver; // Constraints
1008+
exports org.acme.vehiclerouting.domain; // Domain classes
1009+
exports org.acme.vehiclerouting.solver; // Constraints
1010+
1011+
opens org.acme.vehiclerouting.domain to ai.timefold.solver.core; // Domain classes
1012+
opens org.acme.vehiclerouting.solver to ai.timefold.solver.core; // Constraints
10081013
...
10091014
}
10101015
----
10111016

1012-
Otherwise Timefold Solver can't reach those classes or files, even if they are exported.
1017+
If this is not setup correctly, you will get errors. Usually, these mention the `unnamed module` and give detailed information of what needs to be changed.
1018+
1019+
[source,options="nowrap"]
1020+
----
1021+
class org.acme.schooltimetabling.domain.Timetable$Timefold$MemberAccessor$Field$lessons (in unnamed module @0x273444fe)
1022+
cannot access class org.acme.schooltimetabling.domain.Timetable (in module hello.world.school.timetabling)
1023+
because module hello.world.school.timetabling does not export org.acme.schooltimetabling.domain to unnamed module @0x273444fe
1024+
----
1025+
1026+
[WARNING]
1027+
====
1028+
Only JPMS exported packages are part of the supported public API.
1029+
====
1030+
If you access non-exported classes (for example by running on the classpath), and we later change or remove them, we will not treat that as a breaking change.
1031+
Those classes are not covered by compatibility guarantees.
1032+
1033+
You can opt-out of JPMS by running all jar-files on the classpath, usually by not including `module-info.jar` file in your own project.
10131034

10141035

10151036
[#integrationWithHumanPlanners]

0 commit comments

Comments
 (0)