From c6ce2ebae96c6b478c732f91e48f1d8862dc2539 Mon Sep 17 00:00:00 2001 From: hdavidh Date: Mon, 16 Sep 2024 13:35:50 -0700 Subject: [PATCH] Remove packages to skip --- v2-migration/pom.xml | 11 ------- .../awssdk/v2migration/ChangeSdkType.java | 14 --------- .../awssdk/v2migration/ChangeSdkTypeTest.java | 29 +------------------ 3 files changed, 1 insertion(+), 53 deletions(-) diff --git a/v2-migration/pom.xml b/v2-migration/pom.xml index 556ec9a6e862..ec62e91dd3f1 100644 --- a/v2-migration/pom.xml +++ b/v2-migration/pom.xml @@ -142,17 +142,6 @@ - - com.amazonaws - aws-java-sdk-dynamodb - test - - - com.fasterxml.jackson - jackson-core - - - com.amazonaws aws-java-sdk-s3 diff --git a/v2-migration/src/main/java/software/amazon/awssdk/v2migration/ChangeSdkType.java b/v2-migration/src/main/java/software/amazon/awssdk/v2migration/ChangeSdkType.java index da67dab0b866..ce7c32a47fe3 100644 --- a/v2-migration/src/main/java/software/amazon/awssdk/v2migration/ChangeSdkType.java +++ b/v2-migration/src/main/java/software/amazon/awssdk/v2migration/ChangeSdkType.java @@ -22,7 +22,6 @@ import static software.amazon.awssdk.v2migration.internal.utils.SdkTypeUtils.isV1ModelClass; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.IdentityHashMap; @@ -66,10 +65,6 @@ public class ChangeSdkType extends Recipe { "com\\.amazonaws\\.services\\.[a-zA-Z0-9]+\\.model\\.\\*"; private static final String V1_SERVICE_WILD_CARD_CLASS_PATTERN = "com\\.amazonaws\\.services\\.[a-zA-Z0-9]+\\.\\*"; - private static final Set PACKAGES_TO_SKIP = new HashSet<>( - Arrays.asList("com.amazonaws.services.s3.transfer", - "com.amazonaws.services.dynamodbv2.datamodeling")); - @Override public String getDisplayName() { return "Change AWS SDK for Java v1 types to v2 equivalents"; @@ -140,11 +135,6 @@ private static boolean isWildcard(String fullName) { private static boolean isV1Class(JavaType.FullyQualified fullyQualified) { String fullyQualifiedName = fullyQualified.getFullyQualifiedName(); - if (shouldSkip(fullyQualifiedName)) { - log.info(() -> String.format("Skipping transformation for %s because it is not supported in the migration " - + "tooling at the moment", fullyQualifiedName)); - return false; - } if (!isV1ModelClass(fullyQualified) && !isV1ClientClass(fullyQualified)) { return false; @@ -157,10 +147,6 @@ private static boolean isV1Class(JavaType.FullyQualified fullyQualified) { return true; } - private static boolean shouldSkip(String fqcn) { - return PACKAGES_TO_SKIP.stream().anyMatch(fqcn::startsWith); - } - @Override public JavaType visitType(JavaType javaType, ExecutionContext ctx) { if (javaType == null || javaType instanceof JavaType.Unknown) { diff --git a/v2-migration/src/test/java/software/amazon/awssdk/v2migration/ChangeSdkTypeTest.java b/v2-migration/src/test/java/software/amazon/awssdk/v2migration/ChangeSdkTypeTest.java index d5222293f4f5..812fc3c0a84b 100644 --- a/v2-migration/src/test/java/software/amazon/awssdk/v2migration/ChangeSdkTypeTest.java +++ b/v2-migration/src/test/java/software/amazon/awssdk/v2migration/ChangeSdkTypeTest.java @@ -28,8 +28,7 @@ public class ChangeSdkTypeTest implements RewriteTest { @Override public void defaults(RecipeSpec spec) { - spec.recipe(new ChangeSdkType()).parser(Java8Parser.builder().classpath("aws-java-sdk-sqs", "sqs", "aws-java-sdk-s3", - "aws-java-sdk-dynamodb")); + spec.recipe(new ChangeSdkType()).parser(Java8Parser.builder().classpath("aws-java-sdk-sqs", "sqs")); } @Test @@ -216,30 +215,4 @@ void shouldChangeFieldsInInnerClass() { ) ); } - - @Test - @EnabledOnJre({JRE.JAVA_8}) - void hasUnsupportedFeature_shouldSkip() { - rewriteRun( - java( - "import com.amazonaws.services.s3.transfer.TransferManager;\n" + - "import com.amazonaws.services.sqs.model.DeleteQueueRequest;\n" + - "import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;\n" + - "class Test {\n" + - " private TransferManager transferManager;\n" + - " private DeleteQueueRequest deleteQueue;\n" + - " private DynamoDBMapper ddbMapper;\n" + - "}\n", - "import com.amazonaws.services.s3.transfer.TransferManager;\n" - + "import software.amazon.awssdk.services.sqs.model.DeleteQueueRequest;\n" - + "import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;\n" - + "\n" - + "class Test {\n" - + " private TransferManager transferManager;\n" - + " private DeleteQueueRequest deleteQueue;\n" - + " private DynamoDBMapper ddbMapper;\n" - + "}" - ) - ); - } }