antlr4 icon indicating copy to clipboard operation
antlr4 copied to clipboard

feat: jpms support

Open sgammon opened this issue 4 months ago • 1 comments

Summary

This changeset introduces support for the Java Platform Module System, or JPMS, within the ANTLR v4 runtime and annotations packages.

The runtime package can now be depended on in downstream modules with a requires antlr.runtime directive.

To facilitate this functionality, a breaking change had to be made with regard to packages used for annotations. The following package changes were made:

  • o.a.v.misc.NotNullorg.antlr.v4.annotations.NotNull
  • o.a.v.misc.Nullableorg.antlr.v4.annotations.Nullable
  • o.a.v.r.NullUsageProcessor...processors.NullUsageProcessor

Code generators, service definitions, and other references to these classes were updated accordingly. This change was made to fix split package issues between the ANTLR runtime and annotations modules, which is banned under JPMS.

The JVM target was updated to JVM 11, which allows cleanup of older JDK 1.6 and JDK 1.8 related build wiring. Reasoning: users of 1.6 and 1.8 do not need libs that support JPMS; building multi-release JARs in Maven is hard and error-prone. There isn't much sense in setting a JVM target of 9 or 10, so 11 is the new standard.

Additionally, the codebase now uses a bootstrap JAR to facilitate code-gen in antlr4-runtime; this bootstrap JAR is located in the lib/ folder and automatically installed for the developer if they use either ./mvnw (also added) or ./bootstrap.sh.

This bootstrap JAR will allow iteration on the code generator without needing to release a new plugin version.

Changelog

  • feat: add module-info.java descriptor
  • fix!: update annotation package path to o.a.v.annotations.*
  • chore: upgrade jvm target → 11
  • chore: upgrade all maven plugins to latest
  • chore: centralize maven plugin versions
  • chore: centralize dependency versions
  • chore: refactor build to fix dependency on old plugin version

cc / @sharwell

sgammon avatar Mar 01 '24 08:03 sgammon