Use ASN1*String for the result of DER*String.getInstance(..)

MSAL

In 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.

org.openrewrite.java.migrate.BouncyCastleDerStringGetInstanceReturnType
mod run . --recipe=org.openrewrite.java.migrate.BouncyCastleDerStringGetInstanceReturnType

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Change method invocation return type
  2. Change method invocation return type
  3. Change method invocation return type
  4. Change method invocation return type
  5. Change method invocation return type
  6. Change method invocation return type
  7. Change method invocation return type
  8. Change method invocation return type
  9. Change method invocation return type
  10. Change method invocation return type
  11. Change method invocation return type
  12. Change method invocation return type