7
Upgrading to JDK 17
Mark Paluch edited this page 4 years ago
This page describes the experience of the Spring Data team while upgrading the project build from a JDK 8 to JDK 17 baseline.
Related issues
Easy to miss
- Jakarta EE 9 Migration:
javax.enterprise.inject.spi.Extensionservice loader metadata must be renamed tojakarta.enterprise.inject.spi.Extension.
Learnings
- Several dependencies (EJB API, Transaction API, Interceptor API) could be safely removed without breaking anything.
- Newer
javadocrequires presence of compiled code (https://github.com/spring-projects/spring-data-build/issues/1546) otherwise it fails withnot founderrors. - Javadoc in modulepath breaks when dependencies ship split packages (
4c30d24a44) - Javadoc style: Watch out for missing references or self-closing tags, especially during cherry-picking or rebase.
- Records: Seem to work well when using internal components. Records do not seem a good choice when exposing public API. Property accessors and related items (
equals/hashCode/toString) follow semantics that can be undesirable with our general design. - Sealed classes: Similar to records, can be a good choice for internal components. Sealed classes however do not work well with Mocking as the subtypes are restricted and API users cannot create a mock instance.
var: Neat, requires some getting-used-to time.instanceofwith Pattern variable (foo instanceof String theString): A proper replacement forinstanceof+ cast.- Textblocks: A nice fit for
@Querywith a big query. Makes multi-line strings much more readable.