Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: openrewrite/rewrite-migrate-java
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.32.1
Choose a base ref
...
head repository: openrewrite/rewrite-migrate-java
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.33.0
Choose a head ref
  • 12 commits
  • 39 files changed
  • 7 contributors

Commits on Apr 12, 2026

  1. Configuration menu
    Copy the full SHA
    bc4a22c View commit details
    Browse the repository at this point in the history

Commits on Apr 13, 2026

  1. Configuration menu
    Copy the full SHA
    bac7053 View commit details
    Browse the repository at this point in the history
  2. Add --add-opens JVM args to surefire/failsafe for Java 25 (#1055)

    * Add --add-opens JVM args to surefire/failsafe for Java 25
    
    Java 25 enforces module boundaries more strictly, causing tests that use
    reflection (Mockito, Spring, Hibernate) to fail without --add-opens args.
    Add a new AddSurefireArgLine recipe that merges --add-opens arguments
    into the argLine configuration of maven-surefire-plugin and
    maven-failsafe-plugin, and wire it into UpgradePluginsForJava25.
    
    The recipe handles plugins with no configuration, existing configuration
    without argLine, and existing argLine values (merging without duplicates).
    
    Fixes moderneinc/customer-requests#1821
    
    * Gate --add-opens flags on actual dependencies using ModuleHasDependency
    
    Split the single unconditional AddSurefireArgLine invocation into three
    conditional wrapper recipes gated by ModuleHasDependency preconditions:
    - AddSurefireArgLineForMockito: Mockito/ByteBuddy flags, gated on mockito-*
    - AddSurefireArgLineForSpring: Spring flags, gated on spring-*
    - AddSurefireArgLineForNetty: Netty flags, gated on netty-*
    
    This avoids adding unnecessary --add-opens arguments to projects that
    don't use those frameworks.
    
    * Remove Spring and Netty --add-opens variants, keep only Mockito
    
    * Update recipes.csv with regenerated recipe counts
    
    * Rename AddSurefireArgLine to AddSurefireFailsafeArgLine, fix copyright years and formatting
    
    - Rename recipe class to better reflect that it covers both surefire and failsafe
    - Update copyright year to 2026 in new files
    - Fix extra spaces inside parentheses in recipe implementation
    - Update all YAML, examples, and CSV references
    - Regenerate recipes.csv
    
    ---------
    
    Co-authored-by: Steve Elliott <[email protected]>
    timtebeek and steve-aom-elliott authored Apr 13, 2026
    Configuration menu
    Copy the full SHA
    38caf16 View commit details
    Browse the repository at this point in the history

Commits on Apr 14, 2026

  1. Collapse UpgradeDockerImageVersion cartesian via ChangeFrom capture (#…

    …1060)
    
    `getRecipeList()` previously emitted one `ChangeFrom` per (image,
    oldVersion, suffix) triple because `ChangeFrom.newTag` was a literal
    string with no template support. ~35 hard-coded suffixes × 10 image
    families × (version - 8) version steps produced 3,150 children per
    invocation at version=17 and 5,950 at version=25.
    
    `ChangeFrom` now supports glob `*` capture and `$N` backref substitution
    in its new* fields. Replace the suffix enumeration with a single
    `oldTag = "<oldVersion>*"` + `newTag = "<version>$1"` recipe per
    (image, oldVersion) pair. `$1` carries whatever follows the old version
    digits (may be empty, `-jdk-alpine`, `-jre-noble`, or any arbitrary
    suffix), so the rewrite preserves the full OS/jdk/jre variant without
    enumerating it in advance.
    
    Per-invocation child count drops from ~3,150 -> ~90 at version=17
    (35x), and from ~5,950 -> ~170 at version=25. Add two parameterized
    test cases exercising an exotic suffix that previously only survived
    the now-removed wildcard fallback (and lost its suffix).
    jkschneider authored Apr 14, 2026
    Configuration menu
    Copy the full SHA
    f1fb66d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bb638a2 View commit details
    Browse the repository at this point in the history

Commits on Apr 16, 2026

  1. Support copyOf migration for Guava (#1062)

    * Add copyOf migration
    
    * recipes.csv
    greg-at-moderne authored Apr 16, 2026
    Configuration menu
    Copy the full SHA
    634e7d9 View commit details
    Browse the repository at this point in the history
  2. Rename _ identifier to __ for Java ≤ 8 source files (#1063)

    * Rename `_` identifier to `__` for Java ≤ 8 source files
    
    In Java 9+, `_` became a reserved keyword causing compile errors.
    This recipe renames single-underscore identifiers to double-underscore
    as a prerequisite migration step for projects upgrading from Java 8.
    
    Closes moderneinc/customer-requests#2221
    
    * Extract package-private RenameIdentifierVisitor for reuse in tests
    
    Addresses review feedback: the visitor logic is now shared between the
    recipe and the test setup recipe via RenameIdentifierVisitor(oldName, newName).
    
    * Move RenameIdentifierVisitor to static nested class
    
    Inline the visitor as a static nested class of RenameUnderscoreIdentifier
    instead of a separate top-level file.
    
    * Regenerate recipes.csv
    
    * Use @requiredargsconstructor on RenameIdentifierVisitor
    
    * Use import for @requiredargsconstructor
    
    * Use @value on RenameIdentifierVisitor
    
    * Remove redundant private final modifiers on @value fields
    Jenson3210 authored Apr 16, 2026
    Configuration menu
    Copy the full SHA
    461609f View commit details
    Browse the repository at this point in the history

Commits on Apr 17, 2026

  1. Fix ClassCastException on parenthesized initializers in var recip…

    …es (#1064)
    
    `UseVarForConstructors` and `UseVarForGenericMethodInvocations` unwrap
    the initializer for local `instanceof` checks but pass the original
    `VariableDeclarations` (still wrapping `J.Parentheses`) to downstream
    casts/`transformToVar`, which re-fetch and cast the raw initializer.
    Rewrite the declaration to use the unwrapped initializer (preserving
    the original prefix) before handing it off.
    knutwannheden authored Apr 17, 2026
    Configuration menu
    Copy the full SHA
    3b7b950 View commit details
    Browse the repository at this point in the history

Commits on Apr 20, 2026

  1. Configuration menu
    Copy the full SHA
    a471dd1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    968a22f View commit details
    Browse the repository at this point in the history

Commits on Apr 21, 2026

  1. Configuration menu
    Copy the full SHA
    0ca5cc8 View commit details
    Browse the repository at this point in the history
  2. Fix MigrateCollections* template errors on complex expression conte…

    …xts (#1067)
    
    The `MigrateCollections{Empty,Singleton,Unmodifiable}*` family applied
    `JavaTemplate` in `.contextSensitive()` mode. When the
    `Collections.emptyList()` (etc.) call sat inside a switch expression
    (`case 0 -> Collections.emptyList()`), a ternary branch, a method
    argument, or similar non-statement contexts, the block-statement stub
    generator in rewrite-core either produced 0 statements (for
    `J.SwitchExpression` parents, which it does not handle) or 2 statements
    (for some substitutions with method-invocation values), causing
    `IllegalArgumentException: Expected a template that would generate
    exactly one statement to replace one statement, but generated {0,2}`.
    
    Dropping `.contextSensitive()` makes these simple static-factory
    templates context-free, so the stub is a trivial
    `class Template {{ Object o = List.of(); }}` that always parses to one
    statement regardless of surrounding syntax.
    
    Also guard every `MigrateCollections*` recipe with
    `KotlinFileChecker`/`GroovyFileChecker` preconditions — consistent with
    `ReplaceUnusedVariablesWithUnderscore` and `IfElseIfConstructToSwitch` —
    since `JavaTemplate` cannot reliably target non-Java trees, and the
    idiomatic replacement in Kotlin (`emptyList()`) and Groovy (`[]`) isn't
    `List.of()` anyway.
    knutwannheden authored Apr 21, 2026
    Configuration menu
    Copy the full SHA
    eac4344 View commit details
    Browse the repository at this point in the history
Loading