Skip to content

Conversation

@rkampani
Copy link

@rkampani rkampani commented May 19, 2025

What's changed?

Relates to #5397
Jep 513 calls for allowing statements before the call to super() in Java constructors, allowing for simple assignments and validations before doing expensive construction.

Java version >= 25
(Also double check Jep 513 lands in Java 25)

Before Applying Recipe

class A {
    public A(String bar) {
        super();
        if(bar.equals("test"))
            throw new RuntimeException();
    }
}

After Applying Recipe

class A {
    public A(String bar) {
        if(bar.equals("test"))
            throw new RuntimeException();
        super();
    }
}

What's your motivation?

Anything in particular you'd like reviewers to focus on?

Anyone you would like to review specifically?

Have you considered any alternatives or workarounds?

Any additional context

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@timtebeek
Copy link
Member

Great to see already, but apologies for the mix up; this should have gone into rewrite-migrate-java along with the other Java migration recipes. Would you mind targeting that one instead?

@rkampani
Copy link
Author

Done — closing this PR as it was targeted to the rewrite-migrate-java repo, as requested.

@rkampani rkampani closed this May 19, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite May 19, 2025
@timtebeek
Copy link
Member

Thanks! And sorry again for the confusion; we'd logged the issue as to not forget, but didn't expect your enthusiasm to pick it up already. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants