Migrate to JDK 11
Related resources:
- Java 9
- [x] https://www.baeldung.com/new-java-9
- [x] https://nipafx.dev/java-9-migration-guide/
- [ ] https://docs.oracle.com/javase/9/whatsnew/toc.htm
- [ ] https://www.oracle.com/java/technologies/javase/9-all-relnotes.html
- [ ] https://openjdk.org/projects/jdk9/
- [x] https://blog.frankel.ch/migrating-to-java-9/1/
- [x] https://habr.com/ru/companies/jugru/articles/336864/ (in Russian)
- [x] https://habr.com/ru/articles/342170/ (in Russian)
- [ ] https://www.logicbig.com/tutorials/core-java-tutorial/java-9-changes.html
- [ ] https://www.logicbig.com/tutorials/core-java-tutorial/jshell.html
- Java 10
- [ ] https://www.baeldung.com/java-10-overview
- [ ] https://www.oracle.com/java/technologies/javase/10all-relnotes.html
- [ ] https://www.azul.com/109-new-features-in-jdk-10/
- [ ] https://habr.com/ru/articles/349868/ (in Russian)
- [ ] https://www.logicbig.com/tutorials/core-java-tutorial/java-10-changes.html
- Java 11
- [ ] https://www.baeldung.com/java-11-new-features
- [ ] https://nipafx.dev/java-11-migration-guide/
- [ ] https://medium.com/criciumadev/its-time-migrating-to-java-11-5eb3868354f9
- [ ] https://winterbe.com/posts/2018/09/24/java-11-tutorial/
- [ ] https://docs.microsoft.com/en-us/azure/java/jdk/reasons-to-move-to-java-11
- [ ] https://www.azul.com/90-new-features-and-apis-in-jdk-11/
- [ ] https://www.logicbig.com/tutorials/core-java-tutorial/java-11-changes.html
- [ ] http://blog.code-cop.org/2019/12/new-classes-in-java-11.html
- [ ] https://www.mkyong.com/java/java-11-httpclient-examples/
- [ ] https://java.christmas/2019/11
- [x] https://www.baeldung.com/java-11-string-api
- Videos
- [ ] https://www.baeldung.com/java-openrewrite#bd-upgrading-to-java-11 (!)
- [ ] https://docs.openrewrite.org/recipes/java/migrate/java8tojava11 (!!)
- [ ] https://codete.com/blog/java-8-java-11-quick-guide/
- [ ] https://dzone.com/articles/java-17-features-a-comparison-between-versions-8-a
- [ ] https://javadevcentral.com/optional-new-methods
- [ ] https://cl4es.github.io/2018/11/29/OpenJDK-Startup-From-8-Through-11.html
- [ ] https://www.infoq.com/articles/upgrading-java-8-to-12/
- [ ] https://habr.com/ru/articles/485750/ (in Russian)
- [ ] https://java.christmas/2019/17
- [ ] https://java.christmas/2019/19
- [ ] https://advancedweb.hu/new-language-features-since-java-8-to-17/
- [ ] https://habr.com/ru/post/595653/ + https://habr.com/ru/post/597199/ (JDK 17)
- [ ] http://blogs.newardassociates.com/blog/2024/java-cumulative-feature-rollup.html
- [ ] https://javaalmanac.io
- [ ] TODO: beware of large images (see https://github.com/coobird/thumbnailator/issues/156)
- [ ] TODO: Use
String.replace()instead ofStringUtils.replace()(as the former became faster in java 9 and much faster in java 13) - [ ] TODO: property files are UTF-8 by default since Java9, so we can remove native2ascii plugin usage
- [ ] update GitHub actions (see https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#adopt)
- [ ] consider removing
jdk8maven profile - [ ] consider updating postgresql from
9.4.1212.jre7version - [ ] consider replacing
com.github.tomakehurst:wiremock-jre8dependency - [ ] ci: remove support for JDK 8
From https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-Versions:
Please upgrade to Spring Framework 5.1+ (and the corresponding Spring Boot 2.1+) for JDK 11+ support
So, we first should update Spring Boot to 2.1.x: #1161
It seems like Groovy-related stuff requires some additional work in order to work with JDK11 (https://travis-ci.com/github/php-coder/mystamps/jobs/464914094):
- Unit tests fail to compile:
[ERROR] Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.5:testCompile (default) on project mystamps: Error occurred while calling a method on a Groovy class from classpath. InvocationTargetException: BUG! exception in phase 'class generation' in source unit 'src/test/groovy/ru/mystamps/web/common/LocaleUtilsTest.groovy' unsupported Target MODULE -> [Help 1]
- CodeNarc doesn't fail a build but it throws an exception:
[java] java.lang.reflect.InaccessibleObjectException: Unable to make jdk.internal.loader.ClassLoaders$AppClassLoader(jdk.internal.loader.ClassLoaders$PlatformClassLoader,jdk.internal.loader.URLClassPath) accessible: module java.base does not "opens jdk.internal.loader" to unnamed module @271053e1
- Integration test fail but it seem like that it was caused by unit tests:
[ERROR] Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.5:testCompile (default) on project mystamps: Error occurred while calling a method on a Groovy class from classpath. InvocationTargetException: BUG! exception in phase 'class generation' in source unit '/home/travis/build/php-coder/mystamps/src/test/groovy/ru/mystamps/web/common/LocaleUtilsTest.groovy' unsupported Target MODULE -> [Help 1]
Instead of finding a fix for Groovy code (perhaps, updating it), I suggest to migrate unit tests to JUnit (#1246) first.
Notes to myself:
- JFR (Java Flight Recorder) + JMC (Java Mission Control)
- String compaction
- AppCDS (Application Class Data Sharing)