Cleanup package structure and add support for Java Platform Module System
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 30/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 活跃
- 技术栈
- java
- 领域
- build-system
调研方向
Start with the NamespacePrefixMapper signatures in both SiriXml utility classes and review the dependency and package findings in the issue. Check .github/workflows/push.yml, jaxb-bindings.xml, and the compiler settings to understand the JDK 11 build. Done means the API/module-path decision is documented and the chosen JPMS approach is validated against the listed package and dependency constraints.
由索引模型根据 Issue 内容生成。
描述
I took a quick look at what is needed to support JPMS (adding module-info.java) to this library. Below is the claude report.
Supporting JPMS has many benefits - not limited to these:
- Better performance (restrict reflection - code can be optimized)
- Future JDKs will be stricter
- Slim API surface help reducing context - helping humans as well as AI
- Multiple versions of the same lib can be used in one VM, supporting backwards compatibility
- Fine grained dependency graphs helps tooling (build in seconds, not minutes for OTP)
Cons:
- Maintaining the
module-info.java
Investigation: adding module-info.java (JPMS) to siri-java-model
Environment note first:
CI builds with JDK 11.
Package inventory (what module-info.java would need to export)
Handwritten:
org.entur.siri,org.entur.siri.adapter,org.entur.siri.validatororg.entur.siri21.util,org.rutebanken.siri20.util
Generated (confirmed for 2.0, inferred for 2.1 from jaxb-bindings.xml — same pattern):
uk.org.siri.siri20/uk.org.siri.siri21uk.org.ifopt.siri20/uk.org.ifopt.siri21uk.org.acbs.siri20/uk.org.acbs.siri21eu.datex2.siri20.schema._2_0rc1._2_0/eu.datex2.siri21.schema._2_0rc1._2_0net.opengis.gml.siri— 2.1-only, generated from a GML schema binding not mentioned in CLAUDE.mdorg.w3._2001.xmlschema— sharedAdapter1/Adapter2classes for the dateTime/duration bindings; both 2.0 and 2.1 xjc runs generate into this same package/class names (harmless today since it's one jar/one module, just worth knowing)
The blocker: a hard split-package conflict
SiriXml.toXml(Siri, NamespacePrefixMapper, ...) in both util classes is public API typed against com.sun.xml.bind.marshaller.NamespacePrefixMapper, supplied by the compile-scope dependency com.googlecode.jaxb-namespaceprefixmapper-interfaces:JAXBNamespacePrefixMapper. That jar's classes live in:
com.sun.xml.bind.marshaller— the exact same package used by the real JAXB RI (com.sun.xml.bind:jaxb-core/jaxb-impl, currently test-scope here)com.sun.xml.internal.bind.marshallerorg.eclipse.persistence.oxm/.internal.oxm
It's a compile-time stub deliberately shaped to shadow whichever real JAXB runtime (Metro or EclipseLink MOXy) a consumer puts on the classpath — that trick only works on the classpath. On the module path, having this shim module and a real jaxb-impl/MOXy module present together is a guaranteed java.lang.module.FindException (two modules can never contain the same package, exported or not). Since this library's whole purpose is marshalling XML — which requires a real JAXB runtime at deploy time — any consumer trying to run this fully modularized alongside an actual JAXB implementation will hit this immediately.
This is the one finding that needs a decision before module-info.java is worth writing:
- keep the library usable (as today) mainly via the classpath/unnamed module, and add
module-info.javapurely for consumers who read this jar on the module path without also modularizing their JAXB runtime — narrow but non-breaking, or - break the
NamespacePrefixMapperAPI (replace it with a type this library owns, or drop the overload) so the module no longer needs that shim as a compile dependency — clean, but an API-breaking change.
Other things module-info.java needs to account for
- Reflection for JAXB (un)marshalling: generated classes use private fields; the JAXB runtime a consumer supplies (unknown module name, chosen by them) needs reflective field access. The practical answer is
open module ...(or opens-per-package) rather than plainexports, since we can't predict/opens ... toan implementation module we don't control. - Dependencies without a real module identity:
jackson-databind,jackson-core,jackson-module-jakarta-xmlbind-annotations,slf4j-api(2.0.7), andJAXBNamespacePrefixMapperall lackmodule-info.classandAutomatic-Module-Name— they'd resolve as automatic modules with filename-derived names (brittle, not guaranteed stable across versions). Onlyjakarta.xml.bind-apiandjackson-annotationsship real module descriptors. - Module naming: no existing
Automatic-Module-Nameis set today, so any current module-path consumer relies on the jar-filename-derived name (siri.java.model). Publishing amodule-info.javawith an explicit name (suggestorg.entur.siri) changes that name — a breaking change for any such consumer, worth a release note. - Compiler plugin:
maven-compiler-plugin3.8.0 with<source>/<target>11</target>supportsmodule-info.javafine, but since it's built with--release 11semantics missing, consider switching to<release>11</release>so building on newer JDKs doesn't accidentally leak newer JDK APIs — a good companion change, not required for JPMS itself.
Suggested next step
Given the split-package issue, decide the NamespacePrefixMapper question first since it determines whether this is a same-version additive change or needs a major version bump:
- draft
module-info.javaas anopen module, keeping the currentNamespacePrefixMapperAPI as-is, documenting the module-path caveat, or - first look at removing/replacing the
JAXBNamespacePrefixMapperdependency.
- 主要语言
- Java
- 星标
- 10
- 派生
- 6
- 平均合并
- 19 小时 8 分钟
- 30 天内合并 PR
- 4
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
entur/siri-java-model 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 30/100
entur/siri-java-model#32 ·
-
难度 5/5 一周以上 新手友好度 20/100
entur/siri-java-model#29 · 1 条评论 ·
-
bug
难度 2/5 1-3 小时 新手友好度 55/100
entur/siri-java-model#28 ·
-
难度 4/5 3-5 天 新手友好度 35/100
entur/siri-java-model#1 ·
查看 entur/siri-java-model 的全部 Issue
相似的 Issue
-
staticAssetsPath follows symlinks outside the directory on Windows可能已有人在做 @ybelMekk 今天认领。 未关闭bug security findings
难度 2/5 1-3 小时 新手友好度 84/100
navikt/mock-oauth2-server#1132 ·
维护者通常 1 天内回复
-
agent:working follow-up
难度 2/5 1-3 小时 新手友好度 76/100
Sanne/incus-spawn#1683 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
checkstyle/checkstyle#22210 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
google/error-prone#6239 · 1 条评论 ·
维护者通常 1 天内回复
-
[Failing Test]: BigqueryClient.queryUnflattened fails BigQuery ITs on a transient 503可能已有人在做 @mxtymoshyk 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复