build(java21): update jackson/commons-io deps and servlet imports#341
build(java21): update jackson/commons-io deps and servlet imports#341Aarogaming wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR continues the Java 21 migration across the multi-module Maven build by updating compiler/checkstyle configuration, aligning dependency versions (notably Jackson and Commons IO), and modernizing some code patterns/APIs to Java 21.
Changes:
- Bump Maven plugins and switch compilation target to Java 21 via
<release>21</release>across modules; update CI to build with JDK 21. - Update selected dependencies (Jackson to 2.17.0; Commons IO to 2.17.0; Guice to 5.1.0).
- Modernize Java sources/tests (e.g.,
Optional.isEmpty(),List.getFirst(), pattern matching forinstanceof,String::formatted, text blocks,@Serial).
Reviewed changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| rewrite.yml | Adds a new Rewrite config file (currently empty). |
| pom.xml | Updates parent build plugin versions and sets Java 21 compilation via <release>. |
| ask-sdk/tst/com/amazon/ask/builder/StandardSkillBuilderTest.java | Updates list indexing to getFirst() for Java 21 collections. |
| ask-sdk/pom.xml | Updates compiler plugin and switches to <release>21</release>. |
| ask-sdk-servlet-support/tst/com/amazon/ask/servlet/util/ServletUtilsTest.java | Replaces boxed constructor usage with Long.valueOf. |
| ask-sdk-servlet-support/src/com/amazon/ask/servlet/verifiers/SkillRequestTimestampVerifier.java | Replaces String.format with String::formatted for messages. |
| ask-sdk-servlet-support/src/com/amazon/ask/servlet/verifiers/SkillRequestSignatureVerifier.java | Uses Java 21 pattern matching and String::formatted for exceptions/messages. |
| ask-sdk-servlet-support/src/com/amazon/ask/servlet/SkillServlet.java | Reorders imports and adds @Serial for serialVersionUID. |
| ask-sdk-servlet-support/pom.xml | Updates Commons IO and switches compiler config to <release>21</release>. |
| ask-sdk-runtime/tst/com/amazon/ask/util/impl/NamespacedTypeDeserializerTest.java | Replaces String.format with String::formatted. |
| ask-sdk-runtime/tst/com/amazon/ask/util/impl/JacksonJsonUnmarshallerTest.java | Replaces String.format with String::formatted. |
| ask-sdk-runtime/src/com/amazon/ask/util/impl/NamespaceEnabledJacksonJsonUnmarshaller.java | Modernizes Optional usage to isEmpty(). |
| ask-sdk-runtime/src/com/amazon/ask/util/ValidationUtils.java | Replaces String.format with String::formatted in exceptions. |
| ask-sdk-runtime/src/com/amazon/ask/response/template/loader/impl/ConcurrentLRUTemplateCache.java | Updates log message formatting to String::formatted. |
| ask-sdk-runtime/src/com/amazon/ask/response/template/loader/impl/AbstractLocalTemplateFileLoader.java | Updates error/warn message formatting to String::formatted. |
| ask-sdk-runtime/src/com/amazon/ask/response/template/impl/BaseTemplateFactory.java | Updates error message formatting to String::formatted. |
| ask-sdk-runtime/src/com/amazon/ask/impl/AbstractSkill.java | Modernizes Optional usage to isEmpty(). |
| ask-sdk-runtime/pom.xml | Updates Jackson deps and switches compiler config to <release>21</release>. |
| ask-sdk-local-debug/src/com/amazon/ask/localdebug/util/RequestResponseUtils.java | Updates error message formatting to String::formatted. |
| ask-sdk-local-debug/src/com/amazon/ask/localdebug/util/ReflectionUtils.java | Updates error message formatting to String::formatted. |
| ask-sdk-local-debug/src/com/amazon/ask/localdebug/util/ArgumentParserUtils.java | Updates argument/error formatting to String::formatted. |
| ask-sdk-local-debug/src/com/amazon/ask/localdebug/guice/ConfigModule.java | Updates URI/error formatting to String::formatted. |
| ask-sdk-local-debug/src/com/amazon/ask/localdebug/config/SkillInvokerConfiguration.java | Updates error formatting to String::formatted. |
| ask-sdk-local-debug/pom.xml | Updates Guice and switches compiler config to <release>21</release>. |
| ask-sdk-lambda-support/pom.xml | Updates Commons IO and switches compiler config to <release>21</release>. |
| ask-sdk-freemarker/tst/com/amazon/ask/response/template/FreeMarkerRendererTest.java | Replaces string concatenation with a Java text block. |
| ask-sdk-freemarker/src/com/amazon/ask/response/template/renderer/impl/FreeMarkerTemplateRenderer.java | Updates formatting from String.format to String::formatted. |
| ask-sdk-freemarker/pom.xml | Switches compiler config to <release>21</release>. |
| ask-sdk-dynamodb-persistence-adapter/tst/com/amazon/ask/attributes/persistence/impl/DynamoDbPersistenceAdapterTest.java | Updates list indexing to getFirst(). |
| ask-sdk-dynamodb-persistence-adapter/src/com/amazon/ask/attributes/persistence/impl/DynamoDbPersistenceAdapter.java | Updates exception message formatting to String::formatted. |
| ask-sdk-dynamodb-persistence-adapter/pom.xml | Switches compiler config to <release>21</release>. |
| ask-sdk-core/tst/com/amazon/ask/util/UserAgentUtilsTest.java | Updates formatting to String::formatted. |
| ask-sdk-core/tst/com/amazon/ask/request/intent/SlotValueWrapperTest.java | Updates list indexing to getFirst(). |
| ask-sdk-core/tst/com/amazon/ask/builder/SkillBuilderTest.java | Updates list indexing to getFirst(). |
| ask-sdk-core/src/com/amazon/ask/util/UserAgentUtils.java | Updates formatting to String::formatted. |
| ask-sdk-core/src/com/amazon/ask/response/template/loader/impl/LocaleTemplateEnumerator.java | Updates error formatting to String::formatted. |
| ask-sdk-core/src/com/amazon/ask/request/intent/SlotValueWrapper.java | Uses pattern matching for instanceof and cleaner Optional creation. |
| ask-sdk-core/pom.xml | Switches compiler config to <release>21</release>. |
| ask-sdk-apache-client/tst/com/amazon/ask/services/ApacheHttpApiClientTest.java | Updates list indexing to getFirst(). |
| ask-sdk-apache-client/src/com/amazon/ask/services/ApacheHttpApiClient.java | Uses pattern matching for instanceof to avoid a cast. |
| ask-sdk-apache-client/pom.xml | Switches compiler config to <release>21</release>. |
| .github/workflows/maven.yml | Updates CI workflow to build with JDK 21. |
Comments suppressed due to low confidence (1)
rewrite.yml:2
rewrite.ymlis currently empty (only blank lines). If this is meant to configure OpenRewrite for the migration, it should contain the actual recipe/config; otherwise it should be removed to avoid confusion and accidental tooling pickup.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return Class.forName(fullyQualifiedClassName); | ||
| } catch (ClassNotFoundException e) { | ||
| LOG.error(String.format("Class not found exception for class - %s", fullyQualifiedClassName), e.toString()); | ||
| LOG.error("Class not found exception for class - %s".formatted(fullyQualifiedClassName), e.toString()); |
There was a problem hiding this comment.
This LOG.error(...) call passes e.toString() as the second argument, which won’t log the stack trace (and may be ignored since the message has no {} placeholders). Pass the actual exception as the throwable parameter (or include it as the last arg) so the error is diagnosable.
| LOG.error("Class not found exception for class - %s".formatted(fullyQualifiedClassName), e.toString()); | |
| LOG.error("Class not found exception for class - %s".formatted(fullyQualifiedClassName), e); |
Summary
Notes