Class UpgradeKotlin

java.lang.Object
org.openrewrite.Recipe
org.axonframework.migration.UpgradeKotlin
All Implemented Interfaces:
Cloneable

public class UpgradeKotlin extends org.openrewrite.Recipe
Bumps Kotlin to a configurable 2.x line, with validation that the target satisfies the Axon Framework 5 minimum (Kotlin 2.0).

Wraps two upstream recipes to cover the two places a Kotlin version is pinned in a typical Maven build:

  • UpgradeDependencyVersion for org.jetbrains.kotlin:* — bumps kotlin-stdlib, kotlin-reflect, kotlin-stdlib-jdk8, and any other Kotlin runtime artifacts the project declares (Maven and Gradle); and
  • UpgradePluginVersion for org.jetbrains.kotlin:kotlin-maven-plugin — bumps the Kotlin compiler plugin so Maven builds compile against the new language line.

The default target is "2.x" (Node-Semver "latest 2.x"), chosen so projects already on a higher Kotlin 2.x release are left untouched — UpgradeDependencyVersion only upgrades, never downgrades.

The targetVersion option is overridable per invocation; values whose major version is below 2 are rejected so misconfigurations fail loudly rather than silently pinning the build to a Kotlin 1.x line that Axon Framework 5 does not support.

Since:
5.1.1
Author:
Mateusz Nowak
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.openrewrite.Recipe

    org.openrewrite.Recipe.Builder, org.openrewrite.Recipe.DelegatingRecipe
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Default Node-Semver selector used when targetVersion is unset.
    static final int
    Minimum supported major version.

    Fields inherited from class org.openrewrite.Recipe

    contributors, examples, PANIC
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    UpgradeKotlin(@Nullable String targetVersion)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    List<org.openrewrite.Recipe>
     
    @Nullable String
     

    Methods inherited from class org.openrewrite.Recipe

    addDataTable, builder, buildRecipeList, causesAnotherCycle, clone, createRecipeDescriptor, equals, getContributors, getDataTableDescriptors, getDescriptor, getEstimatedEffortPerOccurrence, getExamples, getInstanceName, getInstanceNameSuffix, getJacksonPolymorphicTypeTag, getMaintainers, getName, getTags, getVisitor, hashCode, maxCycles, noop, onComplete, run, run, run, setContributors, setExamples, validate, validate, validateAll, validateAll, withOptions

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_TARGET_VERSION

      public static final String DEFAULT_TARGET_VERSION
      Default Node-Semver selector used when targetVersion is unset. "2.x" resolves to the latest published Kotlin 2.x release, so projects already on a higher 2.x line are left untouched (the underlying upgrade recipes never downgrade).
      See Also:
    • MINIMUM_MAJOR_VERSION

      public static final int MINIMUM_MAJOR_VERSION
      Minimum supported major version. Axon Framework 5 requires Kotlin 2.x or higher; targets whose major component is below this are rejected at configuration time.
      See Also:
  • Constructor Details

    • UpgradeKotlin

      public UpgradeKotlin()
    • UpgradeKotlin

      public UpgradeKotlin(@Nullable String targetVersion)
  • Method Details

    • getTargetVersion

      public @Nullable String getTargetVersion()
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in class org.openrewrite.Recipe
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in class org.openrewrite.Recipe
    • getRecipeList

      public List<org.openrewrite.Recipe> getRecipeList()
      Overrides:
      getRecipeList in class org.openrewrite.Recipe