Skip to content

Commit

Permalink
Drop intermediate JavaVersion11/17/21 recipes (#468)
Browse files Browse the repository at this point in the history
* Drop intermediate JavaVersion11/17/21 recipes

These only delegate to UpgradeJavaVersion, but had a displayName and description that were Maven specific, despite also updating Gradle build files, and source file markers after 9c6acfb

* Drop duplicate tests
  • Loading branch information
timtebeek authored May 1, 2024
1 parent e31312e commit dda4fa4
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 179 deletions.
19 changes: 6 additions & 13 deletions src/main/resources/META-INF/rewrite/java-version-11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ recipeList:
- org.openrewrite.java.migrate.cobertura.RemoveCoberturaMavenPlugin
- org.openrewrite.java.migrate.wro4j.UpgradeWro4jMavenPluginVersion
- org.openrewrite.java.migrate.jacoco.UpgradeJaCoCoMavenPluginVersion
- org.openrewrite.java.migrate.JavaVersion11
- org.openrewrite.java.migrate.UpgradeJavaVersion:
version: 11
- org.openrewrite.maven.UpgradePluginVersion:
groupId: org.apache.maven.plugins
artifactId: maven-compiler-plugin
newVersion: 3.6.2
# Disabled due to null safety issues in the current implementation
# https://github.com/openrewrite/rewrite-migrate-java/issues/250
# - org.openrewrite.java.migrate.util.JavaUtilAPIs
Expand All @@ -71,18 +76,6 @@ recipeList:

---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.migrate.JavaVersion11
displayName: Change Maven Java version property values to 11
description: Change maven.compiler.source and maven.compiler.target values to 11.
recipeList:
- org.openrewrite.java.migrate.UpgradeJavaVersion:
version: 11
- org.openrewrite.maven.UpgradePluginVersion:
groupId: org.apache.maven.plugins
artifactId: maven-compiler-plugin
newVersion: 3.6.2
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.migrate.javax.AddJaxbDependencies
displayName: Add explicit JAXB dependencies
description: >
Expand Down
14 changes: 2 additions & 12 deletions src/main/resources/META-INF/rewrite/java-version-17.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ tags:
- java17
recipeList:
- org.openrewrite.java.migrate.Java8toJava11
- org.openrewrite.java.migrate.JavaVersion17
- org.openrewrite.java.migrate.UpgradeJavaVersion:
version: 17
- org.openrewrite.java.migrate.lang.StringFormatted
- org.openrewrite.github.SetupJavaUpgradeJavaVersion:
minimumJavaMajorVersion: 17
Expand Down Expand Up @@ -57,17 +58,6 @@ recipeList:
- org.openrewrite.java.migrate.RemovedFileIOFinalizeMethods
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.migrate.JavaVersion17
displayName: Change Maven Java version property values to 17
description: Change maven.compiler.source and maven.compiler.target values to 17.
tags:
- java17
- compiler
recipeList:
- org.openrewrite.java.migrate.UpgradeJavaVersion:
version: 17
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.migrate.DeprecatedJavaxSecurityCert
displayName: Use `java.security.cert` instead of `javax.security.cert`
description: The `javax.security.cert` package has been deprecated for removal.
Expand Down
14 changes: 2 additions & 12 deletions src/main/resources/META-INF/rewrite/java-version-21.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ tags:
- java21
recipeList:
- org.openrewrite.java.migrate.UpgradeToJava17
- org.openrewrite.java.migrate.JavaVersion21
- org.openrewrite.java.migrate.UpgradeJavaVersion:
version: 21
- org.openrewrite.java.migrate.RemoveIllegalSemicolons
- org.openrewrite.java.migrate.lang.ThreadStopUnsupported
- org.openrewrite.java.migrate.net.URLConstructorsToURIRecipes
Expand Down Expand Up @@ -61,17 +62,6 @@ recipeList:

---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.migrate.JavaVersion21
displayName: Change Maven Java version property values to 21
description: Change maven.compiler.source and maven.compiler.target values to 21.
tags:
- java21
- compiler
recipeList:
- org.openrewrite.java.migrate.UpgradeJavaVersion:
version: 21
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.migrate.util.SequencedCollection
displayName: Adopt `SequencedCollection`
description: Replace older code patterns with `SequencedCollection` methods, as per https://openjdk.org/jeps/431.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,30 @@ void gradleSourceTargetFromJava11ToJava17() {
);
}

@Test
void gradleSourceTargetFromJava11ToJava21ThroughEnum() {
rewriteRun(
spec -> spec.recipe(new UpgradeJavaVersion(21)),
buildGradle(
//language=groovy
"""
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
""",
//language=groovy
"""
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
""",
spec -> spec.markers(new JavaVersion(UUID.randomUUID(), "", "", "11.0.15+10", "11.0.15+10"))
)
);
}

@Test
void gradleNoChangeIfUpgradeFromJava11ToJava8() {
rewriteRun(
Expand Down

0 comments on commit dda4fa4

Please sign in to comment.