-
Notifications
You must be signed in to change notification settings - Fork 936
Change response types for POJOs that map one to many #6024
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
Merged
davidh44
merged 6 commits into
master
from
hdavidh/migration-tool-change-response-types
Apr 16, 2025
Merged
Change response types for POJOs that map one to many #6024
davidh44
merged 6 commits into
master
from
hdavidh/migration-tool-change-response-types
Apr 16, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zoewangg
requested changes
Apr 11, 2025
.../resources/software/amazon/awssdk/v2migrationtests/maven/after/src/main/java/foo/bar/S3.java
Show resolved
Hide resolved
...in/java/software/amazon/awssdk/v2migration/openrewrite/ChangeMethodInvocationReturnType.java
Outdated
Show resolved
Hide resolved
zoewangg
approved these changes
Apr 14, 2025
...in/java/software/amazon/awssdk/v2migration/openrewrite/ChangeMethodInvocationReturnType.java
Outdated
Show resolved
Hide resolved
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
There are a handful of POJOs in v1 that map to two types in v2. For instance, v1
AccessControlList
is used as input tosetObjectAcl()
, and also returned as response fromgetObjectAcl()
.In v2,
AccessControlPolicy
is used as input, whileGetObjectAclResponse
is returned as the response.Modifications
Forked
ChangeMethodInvocationReturnType
recipe from OpenRewrite. It is a newer recipe so requires OR version bump, which introduces breaking changes with existing SDK recipes.https://github.com/openrewrite/rewrite/blob/main/rewrite-java/src/main/java/org/openrewrite/java/ChangeMethodInvocationReturnType.java
Using this recipe to correctly change response types based on the method, returning the following responses:
Additional changes:
AmazonS3Exception
toS3Exception
BucketLoggingConfiguration
toBucketLoggingStatus
CannedAccessControlList
toObjectCannedACL
BucketCannedACL
orObjectCannedACL
BucketName
withBucket
in getter methods (already in place for setters)getBucketLocation()
to appendlocationConstraint().toString()
as v1 returns the String regionTesting
Added end to end tests