Use ASN1*String for the result of DER*String.getInstance(..)
org.openrewrite.java.migrate.BouncyCastleDerStringGetInstanceReturnTypeArtifactorg.openrewrite.recipe:rewrite-migrate-javaIn Bouncy Castle 1.71 the getInstance(..) methods on the DER*String ASN.1 types were pulled up to their ASN1*String supertypes, widening their return type. The call itself still compiles, as static methods are inherited, but assigning the result to a DER*String variable or field no longer does. This recipe widens those declared types to the matching ASN1*String, which compiles against both the -jdk15on and -jdk18on artifacts, and can therefore safely be applied ahead of the upgrade.
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.java.migrate.BouncyCastleDerStringGetInstanceReturnTypeIf the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-migrate-java:RELEASEDefinition
This recipe runs the following recipes in order.
- Change method invocation return type
org.openrewrite.java.ChangeMethodInvocationReturnType - Change method invocation return type
org.openrewrite.java.ChangeMethodInvocationReturnType - Change method invocation return type
org.openrewrite.java.ChangeMethodInvocationReturnType - Change method invocation return type
org.openrewrite.java.ChangeMethodInvocationReturnType - Change method invocation return type
org.openrewrite.java.ChangeMethodInvocationReturnType - Change method invocation return type
org.openrewrite.java.ChangeMethodInvocationReturnType - Change method invocation return type
org.openrewrite.java.ChangeMethodInvocationReturnType - Change method invocation return type
org.openrewrite.java.ChangeMethodInvocationReturnType - Change method invocation return type
org.openrewrite.java.ChangeMethodInvocationReturnType - Change method invocation return type
org.openrewrite.java.ChangeMethodInvocationReturnType - Change method invocation return type
org.openrewrite.java.ChangeMethodInvocationReturnType - Change method invocation return type
org.openrewrite.java.ChangeMethodInvocationReturnType
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats