diff --git a/build.gradle.kts b/build.gradle.kts index 2d8f2096f0..787abefbf0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -51,6 +51,8 @@ dependencies { implementation(platform("org.openrewrite:rewrite-bom:${rewriteVersion}")) implementation("org.openrewrite:rewrite-java") + implementation("org.openrewrite:rewrite-properties") + implementation("org.openrewrite:rewrite-xml") implementation("org.openrewrite:rewrite-json") implementation("org.openrewrite:rewrite-maven") implementation("org.openrewrite:rewrite-gradle") diff --git a/src/main/java/org/openrewrite/java/migrate/datanucleus/package-info.java b/src/main/java/org/openrewrite/java/migrate/datanucleus/package-info.java new file mode 100644 index 0000000000..d6f9ff74f5 --- /dev/null +++ b/src/main/java/org/openrewrite/java/migrate/datanucleus/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2025 the original author or authors. + *
+ * Licensed under the Moderne Source Available License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * https://docs.moderne.io/licensing/moderne-source-available-license + *
+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +@NonNullFields +package org.openrewrite.java.migrate.datanucleus; + +import org.jspecify.annotations.NullMarked; +import org.openrewrite.internal.lang.NonNullFields; diff --git a/src/main/resources/META-INF/rewrite/category.yml b/src/main/resources/META-INF/rewrite/category.yml index 15a1c8b890..66919d9069 100644 --- a/src/main/resources/META-INF/rewrite/category.yml +++ b/src/main/resources/META-INF/rewrite/category.yml @@ -81,3 +81,8 @@ type: specs.openrewrite.org/v1beta/category name: Lombok packageName: org.openrewrite.java.migrate.lombok description: Recipes for working with [Lombok](https://projectlombok.org/). +--- +type: specs.openrewrite.org/v1beta/category +name: DataNucleus +packageName: org.openrewrite.java.migrate.datanucleus +description: Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications. diff --git a/src/main/resources/META-INF/rewrite/datanucleus-4.0.yml b/src/main/resources/META-INF/rewrite/datanucleus-4.0.yml new file mode 100644 index 0000000000..fd2142b7ac --- /dev/null +++ b/src/main/resources/META-INF/rewrite/datanucleus-4.0.yml @@ -0,0 +1,173 @@ +# +# Copyright 2025 the original author or authors. +#
+# Licensed under the Moderne Source Available License (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +#
+# https://docs.moderne.io/licensing/moderne-source-available-license +#
+# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_4_0 +displayName: Migrate to DataNucleus 4.0 +description: >- + Migrate DataNucleus 3.x applications to 4.0. This recipe handles package relocations, + type renames, property key changes, and dependency updates introduced in AccessPlatform 4.0. +tags: + - datanucleus + - jdo + - jpa +recipeList: + - org.openrewrite.java.dependencies.UpgradeDependencyVersion: + groupId: org.datanucleus + artifactId: "*" + newVersion: 4.0.x + - org.openrewrite.java.dependencies.RemoveDependency: + groupId: org.datanucleus + artifactId: datanucleus-enhancer + - org.openrewrite.java.migrate.datanucleus.DataNucleusPackageMoves_4_0 + - org.openrewrite.java.migrate.datanucleus.DataNucleusTypeChanges_4_0 + - org.openrewrite.java.migrate.datanucleus.DataNucleusProperties_4_0 + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.datanucleus.DataNucleusPackageMoves_4_0 +displayName: DataNucleus 4.0 package moves +description: Relocate packages that were moved in DataNucleus 4.0. +recipeList: + - org.openrewrite.java.ChangePackage: + oldPackageName: org.datanucleus.store.types.simple + newPackageName: org.datanucleus.store.types.wrappers + - org.openrewrite.java.ChangePackage: + oldPackageName: org.datanucleus.store.types.backed + newPackageName: org.datanucleus.store.types.wrappers.backed + - org.openrewrite.java.ChangePackage: + oldPackageName: org.datanucleus.query.evaluator.memory + newPackageName: org.datanucleus.query.inmemory + - org.openrewrite.java.ChangePackage: + oldPackageName: org.datanucleus.query.node + newPackageName: org.datanucleus.query.compiler + - org.openrewrite.java.ChangePackage: + oldPackageName: org.datanucleus.jta + newPackageName: org.datanucleus.transaction.jta + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.datanucleus.DataNucleusTypeChanges_4_0 +displayName: DataNucleus 4.0 type changes +description: Rename types that were changed in DataNucleus 4.0. +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.datanucleus.PersistenceConfiguration + newFullyQualifiedTypeName: org.datanucleus.Configuration + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.datanucleus.JDOClassLoaderResolver + newFullyQualifiedTypeName: org.datanucleus.ClassLoaderResolverImpl + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.datanucleus.DataNucleusProperties_4_0 +displayName: DataNucleus 4.0 property migrations +description: Rename property keys that changed in DataNucleus 4.0. +recipeList: + # Schema auto-create properties + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.autoCreateSchema + newPropertyKey: datanucleus.schema.autoCreateAll + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.autoCreateTables + newPropertyKey: datanucleus.schema.autoCreateTables + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.autoCreateColumns + newPropertyKey: datanucleus.schema.autoCreateColumns + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.autoCreateConstraints + newPropertyKey: datanucleus.schema.autoCreateConstraints + # Schema validate properties + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.validateSchema + newPropertyKey: datanucleus.schema.validateAll + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.validateTables + newPropertyKey: datanucleus.schema.validateTables + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.validateColumns + newPropertyKey: datanucleus.schema.validateColumns + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.validateConstraints + newPropertyKey: datanucleus.schema.validateConstraints + # Metadata properties + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.metadata.validate + newPropertyKey: datanucleus.metadata.xml.validate + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.defaultInheritanceStrategy + newPropertyKey: datanucleus.metadata.defaultInheritanceStrategy + # Other + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.managedRuntime + newPropertyKey: datanucleus.jmxType + # XML equivalents + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.autoCreateSchema + newValue: datanucleus.schema.autoCreateAll + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.autoCreateTables + newValue: datanucleus.schema.autoCreateTables + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.autoCreateColumns + newValue: datanucleus.schema.autoCreateColumns + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.autoCreateConstraints + newValue: datanucleus.schema.autoCreateConstraints + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.validateSchema + newValue: datanucleus.schema.validateAll + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.validateTables + newValue: datanucleus.schema.validateTables + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.validateColumns + newValue: datanucleus.schema.validateColumns + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.validateConstraints + newValue: datanucleus.schema.validateConstraints + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.metadata.validate + newValue: datanucleus.metadata.xml.validate + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.defaultInheritanceStrategy + newValue: datanucleus.metadata.defaultInheritanceStrategy + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.managedRuntime + newValue: datanucleus.jmxType diff --git a/src/main/resources/META-INF/rewrite/datanucleus-5.0.yml b/src/main/resources/META-INF/rewrite/datanucleus-5.0.yml new file mode 100644 index 0000000000..669d0eff78 --- /dev/null +++ b/src/main/resources/META-INF/rewrite/datanucleus-5.0.yml @@ -0,0 +1,113 @@ +# +# Copyright 2025 the original author or authors. +#
+# Licensed under the Moderne Source Available License (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +#
+# https://docs.moderne.io/licensing/moderne-source-available-license +#
+# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_5_0 +displayName: Migrate to DataNucleus 5.0 +description: >- + Migrate DataNucleus 4.x applications to 5.0. This recipe handles package relocations, + type renames, property key changes, and dependency updates. +tags: + - datanucleus + - jdo + - jpa +recipeList: + - org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_4_0 + - org.openrewrite.java.dependencies.UpgradeDependencyVersion: + groupId: org.datanucleus + artifactId: "*" + newVersion: 5.0.x + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.datanucleus + oldArtifactId: datanucleus-connection-pool + newGroupId: org.datanucleus + newArtifactId: datanucleus-connection-pool2 + newVersion: 5.0.x + - org.openrewrite.java.migrate.datanucleus.DataNucleusPackageMoves_5_0 + - org.openrewrite.java.migrate.datanucleus.DataNucleusTypeChanges_5_0 + - org.openrewrite.java.migrate.datanucleus.DataNucleusProperties_5_0 + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.datanucleus.DataNucleusPackageMoves_5_0 +displayName: DataNucleus 5.0 package moves +description: Relocate packages that were moved in DataNucleus 5.0. +recipeList: + - org.openrewrite.java.ChangePackage: + oldPackageName: org.datanucleus.query.cache + newPackageName: org.datanucleus.query.compiler + - org.openrewrite.java.ChangePackage: + oldPackageName: org.datanucleus.query.symbol + newPackageName: org.datanucleus.query.compiler + - org.openrewrite.java.ChangePackage: + oldPackageName: org.datanucleus.store.encryption + newPackageName: org.datanucleus.store + - org.openrewrite.java.ChangePackage: + oldPackageName: org.datanucleus.store.scostore + newPackageName: org.datanucleus.store.types.scostore + - org.openrewrite.java.ChangePackage: + oldPackageName: org.datanucleus.store.exceptions + newPackageName: org.datanucleus.exceptions + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.datanucleus.DataNucleusTypeChanges_5_0 +displayName: DataNucleus 5.0 type changes +description: Rename types that were changed in DataNucleus 5.0. +recipeList: + - org.openrewrite.java.ChangeType: + oldFullyQualifiedTypeName: org.datanucleus.store.rdbms.adapter.MSSQLServerAdapter + newFullyQualifiedTypeName: org.datanucleus.store.rdbms.adapter.SQLServerAdapter + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.datanucleus.DataNucleusProperties_5_0 +displayName: DataNucleus 5.0 property migrations +description: Rename property keys that changed in DataNucleus 5.0. +recipeList: + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.query.compileOptimiser + newPropertyKey: datanucleus.query.compileOptimiseVarThis + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.rdbms.adapter.informixUseSerialForIdentity + newPropertyKey: datanucleus.rdbms.informix.useSerialForIdentity + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.rdbms.oracleNlsSortOrder + newPropertyKey: datanucleus.rdbms.oracle.nlsSortOrder + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.schema.autoCreateSchema + newPropertyKey: datanucleus.schema.autoCreateDatabase + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.query.compileOptimiser + newValue: datanucleus.query.compileOptimiseVarThis + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.rdbms.adapter.informixUseSerialForIdentity + newValue: datanucleus.rdbms.informix.useSerialForIdentity + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.rdbms.oracleNlsSortOrder + newValue: datanucleus.rdbms.oracle.nlsSortOrder + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.schema.autoCreateSchema + newValue: datanucleus.schema.autoCreateDatabase diff --git a/src/main/resources/META-INF/rewrite/datanucleus-5.1.yml b/src/main/resources/META-INF/rewrite/datanucleus-5.1.yml new file mode 100644 index 0000000000..e38d2c8299 --- /dev/null +++ b/src/main/resources/META-INF/rewrite/datanucleus-5.1.yml @@ -0,0 +1,113 @@ +# +# Copyright 2025 the original author or authors. +#
+# Licensed under the Moderne Source Available License (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +#
+# https://docs.moderne.io/licensing/moderne-source-available-license +#
+# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_5_1 +displayName: Migrate to DataNucleus 5.1 +description: >- + Migrate DataNucleus applications to 5.1. This recipe first applies the 5.0 migration, + then handles the transaction namespace reorganization and other property renames introduced in 5.1. +tags: + - datanucleus + - jdo + - jpa +recipeList: + - org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_5_0 + - org.openrewrite.java.dependencies.UpgradeDependencyVersion: + groupId: org.datanucleus + artifactId: "*" + newVersion: 5.1.x + - org.openrewrite.java.migrate.datanucleus.DataNucleusProperties_5_1 + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.datanucleus.DataNucleusProperties_5_1 +displayName: DataNucleus 5.1 property migrations +description: Rename property keys that changed in DataNucleus 5.1. +recipeList: + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.nontransactionalRead + newPropertyKey: datanucleus.transaction.nontx.read + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.nontransactionalWrite + newPropertyKey: datanucleus.transaction.nontx.write + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.nontx.atomic + newPropertyKey: datanucleus.transaction.nontx.atomic + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.transactionType + newPropertyKey: datanucleus.transaction.type + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.transactionIsolation + newPropertyKey: datanucleus.transaction.isolation + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.jtaLocator + newPropertyKey: datanucleus.transaction.jta.transactionManagerLocator + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.jtaJndiLocation + newPropertyKey: datanucleus.transaction.jta.transactionManagerJNDI + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.datastoreTransactionFlushLimit + newPropertyKey: datanucleus.flush.auto.objectLimit + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.cache.level2.timeout + newPropertyKey: datanucleus.cache.level2.expireMillis + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.nontransactionalRead + newValue: datanucleus.transaction.nontx.read + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.nontransactionalWrite + newValue: datanucleus.transaction.nontx.write + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.nontx.atomic + newValue: datanucleus.transaction.nontx.atomic + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.transactionType + newValue: datanucleus.transaction.type + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.transactionIsolation + newValue: datanucleus.transaction.isolation + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.jtaLocator + newValue: datanucleus.transaction.jta.transactionManagerLocator + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.jtaJndiLocation + newValue: datanucleus.transaction.jta.transactionManagerJNDI + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.datastoreTransactionFlushLimit + newValue: datanucleus.flush.auto.objectLimit + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.cache.level2.timeout + newValue: datanucleus.cache.level2.expireMillis diff --git a/src/main/resources/META-INF/rewrite/datanucleus-5.2.yml b/src/main/resources/META-INF/rewrite/datanucleus-5.2.yml new file mode 100644 index 0000000000..822ded03df --- /dev/null +++ b/src/main/resources/META-INF/rewrite/datanucleus-5.2.yml @@ -0,0 +1,76 @@ +# +# Copyright 2025 the original author or authors. +#
+# Licensed under the Moderne Source Available License (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +#
+# https://docs.moderne.io/licensing/moderne-source-available-license +#
+# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_5_2 +displayName: Migrate to DataNucleus 5.2 +description: >- + Migrate DataNucleus applications to 5.2. This recipe first applies the 5.1 migration, + then handles the column mapping package move and query-related property renames introduced in 5.2. +tags: + - datanucleus + - jdo + - jpa +recipeList: + - org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_5_1 + - org.openrewrite.java.dependencies.UpgradeDependencyVersion: + groupId: org.datanucleus + artifactId: "*" + newVersion: 5.2.x + - org.openrewrite.java.migrate.datanucleus.DataNucleusPackageMoves_5_2 + - org.openrewrite.java.migrate.datanucleus.DataNucleusProperties_5_2 + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.datanucleus.DataNucleusPackageMoves_5_2 +displayName: DataNucleus 5.2 package moves +description: Relocate packages that were moved in DataNucleus 5.2. +recipeList: + - org.openrewrite.java.ChangePackage: + oldPackageName: org.datanucleus.store.rdbms.mapping.datastore + newPackageName: org.datanucleus.store.rdbms.mapping.column + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.datanucleus.DataNucleusProperties_5_2 +displayName: DataNucleus 5.2 property migrations +description: Rename property keys that changed in DataNucleus 5.2. +recipeList: + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.jdoql.strict + newPropertyKey: datanucleus.query.jdoql.strict + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.jpql.strict + newPropertyKey: datanucleus.query.jpql.strict + - org.openrewrite.properties.ChangePropertyKey: + oldPropertyKey: datanucleus.sql.syntaxChecks + newPropertyKey: datanucleus.query.sql.syntaxChecks + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.jdoql.strict + newValue: datanucleus.query.jdoql.strict + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.jpql.strict + newValue: datanucleus.query.jpql.strict + - org.openrewrite.xml.ChangeTagAttribute: + elementName: property + attributeName: name + oldValue: datanucleus.sql.syntaxChecks + newValue: datanucleus.query.sql.syntaxChecks diff --git a/src/main/resources/META-INF/rewrite/recipes.csv b/src/main/resources/META-INF/rewrite/recipes.csv index 5008cc94db..4bee6c6837 100644 --- a/src/main/resources/META-INF/rewrite/recipes.csv +++ b/src/main/resources/META-INF/rewrite/recipes.csv @@ -70,13 +70,13 @@ maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.R maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.RemovedRuntimeTraceMethods,Remove `Runtime.traceInstructions(boolean)` and `Runtime.traceMethodCalls` methods,The `traceInstructions` and `traceMethodCalls` methods in `java.lang.Runtime` were deprecated in Java SE 9 and are no longer available in Java SE 13 and later. The recipe removes the invocations of these methods since the method invocations do nothing functionally.,3,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.AddLombokMapstructBinding,Add `lombok-mapstruct-binding` when both MapStruct and Lombok are used,Add the `lombok-mapstruct-binding` annotation processor as needed when both MapStruct and Lombok are used.,5,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]" maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.AddLombokMapstructBindingMavenDependencyOnly,Add `lombok-mapstruct-binding` dependency for Maven when both MapStruct and Lombok are used,"Add the `lombok-mapstruct-binding` when both MapStruct and Lombok are used, and the dependency does not already exist. Only to be called from `org.openrewrite.java.migrate.AddLombokMapstructBinding` to reduce redundant checks.",2,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]" -maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.UpgradeToJava21,Migrate to Java 21,This recipe will apply changes commonly needed when migrating to Java 21. This recipe will also replace deprecated API with equivalents when there is a clear migration strategy. Build files will also be updated to use Java 21 as the target/source and plugins will be also be upgraded to versions that are compatible with Java 21.,9080,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]" +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.UpgradeToJava21,Migrate to Java 21,This recipe will apply changes commonly needed when migrating to Java 21. This recipe will also replace deprecated API with equivalents when there is a clear migration strategy. Build files will also be updated to use Java 21 as the target/source and plugins will be also be upgraded to versions that are compatible with Java 21.,9081,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]" maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.UpgradeBuildToJava21,Upgrade build to Java 21,Updates build files to use Java 21 as the target/source.,4558,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.UpgradePluginsForJava21,Upgrade plugins to Java 21 compatible versions,Updates plugins and dependencies to version compatible with Java 21.,6,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]" maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.RemovedSubjectMethods,Adopt `javax.security.auth.Subject.current()` and `javax.security.auth.Subject.callAs()` methods`,Replaces the `javax.security.auth.Subject.getSubject()` and `javax.security.auth.Subject.doAs()` methods with `javax.security.auth.Subject.current()` and `javax.security.auth.Subject.callAs()`.,3,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.DeleteDeprecatedFinalize,Avoid using the deprecated empty `finalize()` method in `java.desktop`,The java.desktop module had a few implementations of finalize() that did nothing and have been removed. This recipe will remove these methods.,4,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.SwitchPatternMatching,Adopt switch pattern matching (JEP 441),[JEP 441](https://openjdk.org/jeps/441) describes how some switch statements can be improved with pattern matching. This recipe applies some of those improvements where applicable.,3,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, -maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.UpgradeToJava25,Migrate to Java 25,This recipe will apply changes commonly needed when migrating to Java 25. This recipe will also replace deprecated API with equivalents when there is a clear migration strategy. Build files will also be updated to use Java 25 as the target/source and plugins will be also be upgraded to versions that are compatible with Java 25.,15074,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]" +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.UpgradeToJava25,Migrate to Java 25,This recipe will apply changes commonly needed when migrating to Java 25. This recipe will also replace deprecated API with equivalents when there is a clear migration strategy. Build files will also be updated to use Java 25 as the target/source and plugins will be also be upgraded to versions that are compatible with Java 25.,15075,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,,"[{""name"":""org.openrewrite.maven.table.MavenMetadataFailures"",""displayName"":""Maven metadata failures"",""description"":""Attempts to resolve maven metadata that failed."",""columns"":[{""name"":""group"",""type"":""String"",""displayName"":""Group id"",""description"":""The groupId of the artifact for which the metadata download failed.""},{""name"":""artifactId"",""type"":""String"",""displayName"":""Artifact id"",""description"":""The artifactId of the artifact for which the metadata download failed.""},{""name"":""version"",""type"":""String"",""displayName"":""Version"",""description"":""The version of the artifact for which the metadata download failed.""},{""name"":""mavenRepositoryUri"",""type"":""String"",""displayName"":""Maven repository"",""description"":""The URL of the Maven repository that the metadata download failed on.""},{""name"":""snapshots"",""type"":""String"",""displayName"":""Snapshots"",""description"":""Does the repository support snapshots.""},{""name"":""releases"",""type"":""String"",""displayName"":""Releases"",""description"":""Does the repository support releases.""},{""name"":""failure"",""type"":""String"",""displayName"":""Failure"",""description"":""The reason the metadata download failed.""}]}]" maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.AccessController,Remove Security AccessController,The Security Manager API is unsupported in Java 24. This recipe will remove the usage of `java.security.AccessController`.,4,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.RemoveSecurityPolicy,Remove Security Policy,The Security Manager API is unsupported in Java 24. This recipe will remove the use of `java.security.Policy`.,4,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.RemoveSecurityManager,Remove Security SecurityManager,The Security Manager API is unsupported in Java 24. This recipe will remove the usage of `java.security.SecurityManager`.,4,,,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, @@ -444,6 +444,19 @@ maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.j maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.javaee8.ApacheDefaultProvider,Flags any `org.apache.bval.jsr*` (bval 1.1) and `org.apache.bval.jsr303*` (bval 1.0) package references,This recipe flags any `org.apache.bval.jsr*` (bval 1.1) and `org.apache.bval.jsr303*` (bval 1.0) package references in validation.xml deployment descriptors. Bean Validation 2.0 and later use the Hibernate Validator implementation instead of the Apache BVal implementation which was used for Bean Validation 1.0 and 1.1.,6,,Java EE 8,Modernize,Java,,Recipes for migrating to [Java EE 8](https://javaee.github.io/javaee-spec/javadocs/).,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.nio.file.PathsGetToPathOf,Replace `Paths.get` with `Path.of`,The `java.nio.file.Paths.get` method was introduced in Java SE 7. The `java.nio.file.Path.of` method was introduced in Java SE 11. This recipe replaces all usages of `Paths.get` with `Path.of` for consistency.,3,File,Nio,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.cobertura.RemoveCoberturaMavenPlugin,Remove Cobertura Maven plugin,"This recipe will remove Cobertura, as it is not compatible with Java 11.",2,,Cobertura,Modernize,Java,,,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_4_0,Migrate to DataNucleus 4.0,"Migrate DataNucleus 3.x applications to 4.0. This recipe handles package relocations, type renames, property key changes, and dependency updates introduced in AccessPlatform 4.0.",35,,DataNucleus,Modernize,Java,,Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications.,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.datanucleus.DataNucleusPackageMoves_4_0,DataNucleus 4.0 package moves,Relocate packages that were moved in DataNucleus 4.0.,6,,DataNucleus,Modernize,Java,,Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications.,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.datanucleus.DataNucleusTypeChanges_4_0,DataNucleus 4.0 type changes,Rename types that were changed in DataNucleus 4.0.,3,,DataNucleus,Modernize,Java,,Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications.,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.datanucleus.DataNucleusProperties_4_0,DataNucleus 4.0 property migrations,Rename property keys that changed in DataNucleus 4.0.,23,,DataNucleus,Modernize,Java,,Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications.,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_5_0,Migrate to DataNucleus 5.0,"Migrate DataNucleus 4.x applications to 5.0. This recipe handles package relocations, type renames, property key changes, and dependency updates.",55,,DataNucleus,Modernize,Java,,Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications.,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.datanucleus.DataNucleusPackageMoves_5_0,DataNucleus 5.0 package moves,Relocate packages that were moved in DataNucleus 5.0.,6,,DataNucleus,Modernize,Java,,Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications.,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.datanucleus.DataNucleusTypeChanges_5_0,DataNucleus 5.0 type changes,Rename types that were changed in DataNucleus 5.0.,2,,DataNucleus,Modernize,Java,,Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications.,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.datanucleus.DataNucleusProperties_5_0,DataNucleus 5.0 property migrations,Rename property keys that changed in DataNucleus 5.0.,9,,DataNucleus,Modernize,Java,,Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications.,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_5_1,Migrate to DataNucleus 5.1,"Migrate DataNucleus applications to 5.1. This recipe first applies the 5.0 migration, then handles the transaction namespace reorganization and other property renames introduced in 5.1.",76,,DataNucleus,Modernize,Java,,Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications.,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.datanucleus.DataNucleusProperties_5_1,DataNucleus 5.1 property migrations,Rename property keys that changed in DataNucleus 5.1.,19,,DataNucleus,Modernize,Java,,Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications.,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_5_2,Migrate to DataNucleus 5.2,"Migrate DataNucleus applications to 5.2. This recipe first applies the 5.1 migration, then handles the column mapping package move and query-related property renames introduced in 5.2.",87,,DataNucleus,Modernize,Java,,Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications.,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.datanucleus.DataNucleusPackageMoves_5_2,DataNucleus 5.2 package moves,Relocate packages that were moved in DataNucleus 5.2.,2,,DataNucleus,Modernize,Java,,Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications.,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, +maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.migrate.datanucleus.DataNucleusProperties_5_2,DataNucleus 5.2 property migrations,Rename property keys that changed in DataNucleus 5.2.,7,,DataNucleus,Modernize,Java,,Recipes for migrating [DataNucleus](https://www.datanucleus.org/) JDO/JPA persistence applications.,Modernize your code to best use the project's current JDK version. Take advantage of newly available APIs and reduce the dependency of your code on third party dependencies where there is equivalent functionality in the Java standard library.,Basic building blocks for transforming Java code.,, maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.jspecify.JSpecifyBestPractices,JSpecify best practices,"Apply JSpecify best practices, such as migrating off of alternatives, and adding missing `@Nullable` annotations.",32,,,JSpecify,Java,,,Recipes for adopting [JSpecify](https://jspecify.dev/) nullability annotations.,Basic building blocks for transforming Java code.,, maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.jspecify.MigrateToJSpecify,Migrate to JSpecify,This recipe will migrate to JSpecify annotations from various other nullability annotation standards.,27,,,JSpecify,Java,,,Recipes for adopting [JSpecify](https://jspecify.dev/) nullability annotations.,Basic building blocks for transforming Java code.,, maven,org.openrewrite.recipe:rewrite-migrate-java,org.openrewrite.java.jspecify.MigrateFromJavaxAnnotationApi,Migrate from javax annotation API to JSpecify,Migrate from javax annotation API to JSpecify.,6,,,JSpecify,Java,,,Recipes for adopting [JSpecify](https://jspecify.dev/) nullability annotations.,Basic building blocks for transforming Java code.,, diff --git a/src/test/java/org/openrewrite/java/migrate/datanucleus/UpgradeDataNucleus_4_0Test.java b/src/test/java/org/openrewrite/java/migrate/datanucleus/UpgradeDataNucleus_4_0Test.java new file mode 100644 index 0000000000..5b3b3321e7 --- /dev/null +++ b/src/test/java/org/openrewrite/java/migrate/datanucleus/UpgradeDataNucleus_4_0Test.java @@ -0,0 +1,183 @@ +/* + * Copyright 2025 the original author or authors. + *
+ * Licensed under the Moderne Source Available License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * https://docs.moderne.io/licensing/moderne-source-available-license + *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openrewrite.java.migrate.datanucleus;
+
+import org.junit.jupiter.api.Test;
+import org.openrewrite.DocumentExample;
+import org.openrewrite.java.JavaParser;
+import org.openrewrite.test.RecipeSpec;
+import org.openrewrite.test.RewriteTest;
+
+import static org.openrewrite.java.Assertions.java;
+import static org.openrewrite.properties.Assertions.properties;
+import static org.openrewrite.xml.Assertions.xml;
+
+class UpgradeDataNucleus_4_0Test implements RewriteTest {
+
+ @Override
+ public void defaults(RecipeSpec spec) {
+ spec.recipeFromResources("org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_4_0");
+ }
+
+ @Test
+ @DocumentExample
+ void renameSchemaPropertyKeys() {
+ rewriteRun(
+ properties(
+ """
+ datanucleus.autoCreateSchema=true
+ datanucleus.autoCreateTables=true
+ datanucleus.autoCreateColumns=true
+ datanucleus.autoCreateConstraints=true
+ datanucleus.validateSchema=true
+ datanucleus.validateTables=true
+ datanucleus.validateColumns=true
+ datanucleus.validateConstraints=true
+ """,
+ """
+ datanucleus.schema.autoCreateAll=true
+ datanucleus.schema.autoCreateTables=true
+ datanucleus.schema.autoCreateColumns=true
+ datanucleus.schema.autoCreateConstraints=true
+ datanucleus.schema.validateAll=true
+ datanucleus.schema.validateTables=true
+ datanucleus.schema.validateColumns=true
+ datanucleus.schema.validateConstraints=true
+ """
+ )
+ );
+ }
+
+ @Test
+ void renameMetadataAndOtherPropertyKeys() {
+ rewriteRun(
+ properties(
+ """
+ datanucleus.metadata.validate=true
+ datanucleus.defaultInheritanceStrategy=JDO2
+ datanucleus.managedRuntime=true
+ """,
+ """
+ datanucleus.metadata.xml.validate=true
+ datanucleus.metadata.defaultInheritanceStrategy=JDO2
+ datanucleus.jmxType=true
+ """
+ )
+ );
+ }
+
+ @Test
+ void renameSchemaPropertiesInXml() {
+ rewriteRun(
+ xml(
+ """
+
+
+ * Licensed under the Moderne Source Available License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * https://docs.moderne.io/licensing/moderne-source-available-license + *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openrewrite.java.migrate.datanucleus;
+
+import org.junit.jupiter.api.Test;
+import org.openrewrite.DocumentExample;
+import org.openrewrite.java.JavaParser;
+import org.openrewrite.test.RecipeSpec;
+import org.openrewrite.test.RewriteTest;
+
+import static org.openrewrite.java.Assertions.java;
+import static org.openrewrite.properties.Assertions.properties;
+import static org.openrewrite.xml.Assertions.xml;
+
+class UpgradeDataNucleus_5_0Test implements RewriteTest {
+
+ @Override
+ public void defaults(RecipeSpec spec) {
+ spec.recipeFromResources("org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_5_0");
+ }
+
+ @Test
+ @DocumentExample
+ void renamePropertyKeys() {
+ rewriteRun(
+ properties(
+ """
+ datanucleus.query.compileOptimiser=true
+ datanucleus.rdbms.adapter.informixUseSerialForIdentity=true
+ datanucleus.rdbms.oracleNlsSortOrder=BINARY
+ datanucleus.schema.autoCreateSchema=true
+ """,
+ """
+ datanucleus.query.compileOptimiseVarThis=true
+ datanucleus.rdbms.informix.useSerialForIdentity=true
+ datanucleus.rdbms.oracle.nlsSortOrder=BINARY
+ datanucleus.schema.autoCreateDatabase=true
+ """
+ )
+ );
+ }
+
+ @Test
+ void renamePropertyKeysInXml() {
+ rewriteRun(
+ xml(
+ """
+
+
+ * Licensed under the Moderne Source Available License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * https://docs.moderne.io/licensing/moderne-source-available-license + *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openrewrite.java.migrate.datanucleus;
+
+import org.junit.jupiter.api.Test;
+import org.openrewrite.DocumentExample;
+import org.openrewrite.test.RecipeSpec;
+import org.openrewrite.test.RewriteTest;
+
+import static org.openrewrite.properties.Assertions.properties;
+import static org.openrewrite.xml.Assertions.xml;
+
+class UpgradeDataNucleus_5_1Test implements RewriteTest {
+
+ @Override
+ public void defaults(RecipeSpec spec) {
+ spec.recipeFromResources("org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_5_1");
+ }
+
+ @Test
+ @DocumentExample
+ void renameTransactionProperties() {
+ rewriteRun(
+ properties(
+ """
+ datanucleus.nontransactionalRead=true
+ datanucleus.nontransactionalWrite=false
+ datanucleus.transactionType=JTA
+ datanucleus.transactionIsolation=read-committed
+ """,
+ """
+ datanucleus.transaction.nontx.read=true
+ datanucleus.transaction.nontx.write=false
+ datanucleus.transaction.type=JTA
+ datanucleus.transaction.isolation=read-committed
+ """
+ )
+ );
+ }
+
+ @Test
+ void renameJtaAndCacheProperties() {
+ rewriteRun(
+ properties(
+ """
+ datanucleus.jtaLocator=autodetect
+ datanucleus.jtaJndiLocation=java:comp/TransactionManager
+ datanucleus.datastoreTransactionFlushLimit=1000
+ datanucleus.cache.level2.timeout=3600000
+ """,
+ """
+ datanucleus.transaction.jta.transactionManagerLocator=autodetect
+ datanucleus.transaction.jta.transactionManagerJNDI=java:comp/TransactionManager
+ datanucleus.flush.auto.objectLimit=1000
+ datanucleus.cache.level2.expireMillis=3600000
+ """
+ )
+ );
+ }
+
+ @Test
+ void renameTransactionPropertiesInXml() {
+ rewriteRun(
+ xml(
+ """
+
+
+ * Licensed under the Moderne Source Available License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * https://docs.moderne.io/licensing/moderne-source-available-license + *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openrewrite.java.migrate.datanucleus;
+
+import org.junit.jupiter.api.Test;
+import org.openrewrite.DocumentExample;
+import org.openrewrite.java.JavaParser;
+import org.openrewrite.test.RecipeSpec;
+import org.openrewrite.test.RewriteTest;
+
+import static org.openrewrite.java.Assertions.java;
+import static org.openrewrite.properties.Assertions.properties;
+import static org.openrewrite.xml.Assertions.xml;
+
+class UpgradeDataNucleus_5_2Test implements RewriteTest {
+
+ @Override
+ public void defaults(RecipeSpec spec) {
+ spec.recipeFromResources("org.openrewrite.java.migrate.datanucleus.UpgradeDataNucleus_5_2");
+ }
+
+ @Test
+ @DocumentExample
+ void renameQueryPropertyKeys() {
+ rewriteRun(
+ properties(
+ """
+ datanucleus.jdoql.strict=true
+ datanucleus.jpql.strict=true
+ datanucleus.sql.syntaxChecks=true
+ """,
+ """
+ datanucleus.query.jdoql.strict=true
+ datanucleus.query.jpql.strict=true
+ datanucleus.query.sql.syntaxChecks=true
+ """
+ )
+ );
+ }
+
+ @Test
+ void renameQueryPropertyKeysInXml() {
+ rewriteRun(
+ xml(
+ """
+
+