8.24.0 release (2024-04-25)
info
This changelog only shows what recipes have been added, removed, or changed. OpenRewrite may do releases that do not include these types of changes. To see these changes, please go to the releases page.
New Recipes
- org.openrewrite.apache.httpclient5.MigrateAuthScope: Replace removed constant
org.apache.http.auth.AuthScope.AuthScope.ANY
withnew org.apache.hc.client5.http.auth.AuthScope(null, -1)
- org.openrewrite.github.ChangeAction: Change a GitHub Action in any
.github/workflows/*.yml
file. - org.openrewrite.github.gradle.RenameGradleBuildActionToSetupGradle: Rename the deprecated
gradle/gradle-build-action
togradle/actions/setup-gradle@v3
. - org.openrewrite.github.gradle.RenameWrapperValidationAction: Rename the deprecated
gradle/wrapper-validation-action
togradle/actions/wrapper-validation@v3
. - org.openrewrite.hibernate.MigrateBooleanMappings: Replaces type mapping of booleans with appropriate attribute converters.
- org.openrewrite.hibernate.MigrateToHibernate63: This recipe will apply changes commonly needed when migrating to Hibernate 6.3.x.
- org.openrewrite.hibernate.MigrateToHypersistenceUtilsHibernate6.3: This recipe will migrate any existing dependencies on
io.hypersistence:hypersistence-utils-hibernate-62
toio.hypersistence:hypersistence-utils-hibernate-63
. - org.openrewrite.java.dependencies.ChangeDependencyGroupIdAndArtifactId: Change a Gradle or Maven dependency coordinate. Either the
newGroupId
ornewArtifactId
must differ from the previous value. - org.openrewrite.java.dependencies.UpgradeTransitiveDependencyVersion: Upgrades the version of a transitive dependency in a Maven pom.xml or Gradle build.gradle. Leaves direct dependencies unmodified. Can be paired with the regular Upgrade Dependency Version recipe to upgrade a dependency everywhere, regardless of whether it is direct or transitive.
- org.openrewrite.java.logging.log4j.LoggingExceptionConcatenationRecipe: By using the exception as another parameter you get the whole stack trace.
- org.openrewrite.java.migrate.DeprecatedCountStackFramesMethod:
Thread.countStackFrames()
has been removed in Java SE 14 and has been changed in this release to unconditionally throwUnsupportedOperationException
This recipe removes the usage of this method in your application as long as the method is not assigned to a variable.
For more information on the Java SE 14 deprecation of this method, see https://bugs.java.com/bugdatabase/view_bug?bug_id=8205132. - org.openrewrite.java.migrate.RemovedFileIOFinalizeMethods: The
finalize
method injava.io.FileInputStream
andjava.io.FileOutputStream
is no longer available in Java SE 12 and later. The recipe replaces it with theclose
method. - org.openrewrite.java.migrate.RemovedRMIConnectorServerCredentialTypesConstant: This recipe replaces the
RMIConnectorServer.CREDENTIAL_TYPES
constant with theRMIConnectorServer.CREDENTIALS_FILTER_PATTERN
constant. - org.openrewrite.java.migrate.RemovedSSLSessionGetPeerCertificateChainMethodImpl: The
javax.net.ssl.SSLSession.getPeerCertificateChain()
method implementation was removed from the SunJSSE provider and HTTP client implementation in Java SE 15. The default implementation will now throw anUnsupportedOperationException
. Applications using this method should be updated to use thejavax.net.ssl.SSLSession.getPeerCertificates()
method instead. - org.openrewrite.java.migrate.RemovedSecurityManagerMethods: Replace
SecurityManager
methodscheckAwtEventQueueAccess()
,checkSystemClipboardAccess()
,checkMemberAccess()
andcheckTopLevelWindow()
deprecated in Java SE 11 bycheckPermission(new java.security.AllPermission())
. - org.openrewrite.java.migrate.RemovedZipFinalizeMethods: The
finalize
method injava.util.zip.ZipFile
is replaced with theclose
method and is replaced by theend
method in
java.util.zip.Inflater
andjava.util.zip.Deflater
as it is no longer available in Java SE 12 and later. - org.openrewrite.java.migrate.SunNetSslPackageUnavailable: The internal API
com.sun.net.ssl
is removed. The package was intended for internal use only and replacement APIs can be found in thejavax.net.ssl
package. - org.openrewrite.java.migrate.guava.NoGuavaMapsNewHashMap: Prefer the Java standard library over third-party usage of Guava in simple cases like this.
- org.openrewrite.java.migrate.jakarta.JavaxEEApiToJakarta: Java EE has been rebranded to Jakarta EE, necessitating a package relocation.
- org.openrewrite.java.migrate.jakarta.UpdateJakartaPlatform10: Update Jakarta EE Platform Dependencies to 10.0.0
- org.openrewrite.java.migrate.javax.AddColumnAnnotation: When an attribute is annotated with
@ElementCollection
, a separate table is created for the attribute that includes the attribute
ID and value. In OpenJPA, the column for the annotated attribute is named element, whereas EclipseLink names the column based on
the name of the attribute. To remain compatible with tables that were created with OpenJPA, add a@Column
annotation with the name
attribute set to element. - org.openrewrite.java.migrate.javax.AddCommonAnnotationsDependencies: Add the necessary
annotation-api
dependency from Jakarta EE 8 to maintain compatibility with Java version 11 or greater. - org.openrewrite.java.migrate.javax.AddDefaultConstructorToEntityClass: When a Java Persistence API (JPA) entity class has a constructor with arguments, the class must also have a default, no-argument constructor. The OpenJPA implementation automatically generates the no-argument constructor, but the EclipseLink implementation does not.
- org.openrewrite.java.migrate.javax.RemoveEmbeddableId: According to the Java Persistence API (JPA) specification, if an entity defines an attribute with an
@EmbeddedId
annotation, the embeddable class cannot contain an attribute with an@Id
annotation. If both the@EmbeddedId
annotation and the@Id
annotation are defined, OpenJPA ignores the@Id
annotation, whereas EclipseLink throws an exception. - org.openrewrite.java.migrate.javax.UseJoinColumnForMapping: In OpenJPA, when a relationship attribute has either a
@OneToOne
or a@ManyToOne
annotation with a@Column
annotation, the@Column
annotation is treated as a@JoinColumn
annotation. EclipseLink throws an exception that indicates that the entity class must use@JoinColumn
instead of@Column
to map a relationship attribute. - org.openrewrite.java.spring.boot3.MigrateDropWizardDependencies: Migrate dropWizard dependencies to the new artifactId, since these are changed with Spring Boot 3.
- org.openrewrite.java.testing.cleanup.SimplifyTestThrows: Replace all thrown exception classes of test method signatures by
Exception
. - org.openrewrite.java.testing.junit5.AddJupiterDependencies: Adds JUnit Jupiter dependencies to a Maven or Gradle project. Junit Jupiter can be added either with the artifact junit-jupiter, or both of junit-jupiter-api and junit-jupiter-engine. This adds "junit-jupiter" dependency unless "junit-jupiter-api" or "junit-jupiter-engine" are already present.
- org.openrewrite.maven.UpgradeTransitiveDependencyVersion: Upgrades the version of a transitive dependency in a Maven pom file. Leaves direct dependencies unmodified. Can be paired with the regular Upgrade Dependency Version recipe to upgrade a dependency everywhere, regardless of whether it is direct or transitive.
- org.openrewrite.staticanalysis.ReplaceCollectionToArrayArgWithEmptyArray: Changes new array creation with
Collection#toArray(T[])
to use an empty array argument, which is better for performance.
According to theCollection#toArray(T[])
documentation:
> If the collection fits in the specified array, it is returned therein.
However, although it's not intuitive, allocating a right-sized array ahead of time to pass to the API appears to be generally worse for performance according to benchmarking and JVM developers due to a number of implementation details in both Java and the virtual machine.
H2 achieved significant performance gains by switching to empty arrays instead pre-sized ones.
Removed Recipes
- org.openrewrite.java.migrate.jakarta.MaybeAddJakartaServletApi: Adds the
jakarta.servlet-api
dependency, unless the project already usesspring-boot-starter-web
, which transitively includes a compatible implementation under a different GAV.