-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow building with QA on Java 17+ #1208
Allow building with QA on Java 17+ #1208
Conversation
Running `mvn ... -Dqa` with Java 17/21 breaks errorprone. Fixed with: * Update errorProne.version:2.18.0 -> 2.24.1 * Add `geowebcache/.mvn/jvm.config` with the required `--add-exports` for the `maven-compiler-plugin` as explained at https://errorprone.info/docs/installation#jdk-16.
Fixes spotbugs when run with Java 21, otherwise getting ``` Execution spotbugs of goal com.github.spotbugs:spotbugs-maven-plugin:4.7.3.4:spotbugs failed: java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release ```
9ad063d
to
5fb1ad3
Compare
proxyUrl = new URL(getGwcConfig().getProxyUrl()); | ||
proxyUrl = new URI(getGwcConfig().getProxyUrl()).toURL(); | ||
log.fine("Using proxy " + proxyUrl.getHost() + ":" + proxyUrl.getPort()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I guess correctly, this change is related to the deprecation or "new URL(string)" in Java 21.
Rather than repeating this pattern over and over, along with the exception rethrowing, could we have a dedicated support method, similar (but not same) to what we have URLs.fileToURL() in GeoTools?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You got it. See org.geowebcache.util.URLs
5fb1ad3
to
94d2d95
Compare
94d2d95
to
001bba7
Compare
* `Thread.getId()` is deprecated. Since it's only used for reporting errors, use `Thread.getName()` instead * `new URL(String)` is deprecated. Use `new URI(String).toURL()` instead, throwing `MalformedURLException` to preserve the old behavior in methods that throw `IOException`. This is centralized in the new utility class/method `org.geowebcache.util.URLs.of(String url)` * `ExecutorService` implements `AutoCloseable` in Java 21, add `@SuppressWarnings("PMD.CloseResource")` in the test classes that use it * Add `@SuppressFBWarnings` for new rules
001bba7
to
b5ea3b7
Compare
Looks good to me, merging. |
Running
mvn ... -Dqa
with Java 17/21 breaks errorprone, as in:Fixed with:
2.18.0
->2.24.1
geowebcache/.mvn/jvm.config
with the required--add-exports
for themaven-compiler-plugin
as explained at https://errorprone.info/docs/installation#jdk-16.Fixes to build with Java 21:
Thread.getId()
is deprecated. Since it's only used for reporting errors, useThread.getName()
insteadnew URL(String)
is deprecated. Usenew URI(String).toURL()
instead, throwingMalformedURLException
to preserve the old behavior in methods that throwIOException
. This is centralized in the new utility class/methodorg.geowebcache.util.URLs.of(String url)
ExecutorService
implementsAutoCloseable
in Java 21, add@SuppressWarnings("PMD.CloseResource")
in the test classes that use it@SuppressFBWarnings
for new rules related to POJO fields unset/null, when they're assigned using reflection by XStream