Skip to content

Conversation

@steve-aom-elliott
Copy link
Contributor

Adding simple test showcasing recipe not failing, but result not being possible to parse again.

What's changed?

  • So far just a failing test

What's your motivation?

Change package can result in type ambiguity upon reparsing, leading to compilation failures.

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

@steve-aom-elliott steve-aom-elliott added bug Something isn't working recipe Requested Recipe java labels Jan 14, 2026
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Jan 14, 2026
@Test
void ambiguousImportIssue() {
rewriteRun(
spec -> spec.recipe(new ChangePackage("origpkg.validation", "newpkg.validation", true)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we had a similar PR posted with a potential fix:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the looks of that PR, that's just dealing with getting the name right. I think the issue here is not the names themselves but rather that if you change a package name, there may then be two potential sources for the same class, etc. that you are using in your code if you're referencing it in a not fully-qualified type of way.

timtebeek and others added 2 commits January 15, 2026 12:19
… issue (#6058)

* fix: ChangePackage from packageName is part of the submodule dir name issue

ie:
```
submodule name: p1-core and ChangePackage from: p1.sub1-> to: p2.sub1

before this pr result ->  p2-core/src/java/sub1/xx
after  this pr result   -> p1-core/src/java/p2/sub1/xx
```

* fixup! fix: ChangePackage from packageName is part of the submodule dir name issue

* Apply suggestions from code review

---------

Co-authored-by: Tim te Beek <[email protected]>
Co-authored-by: Tim te Beek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working java recipe Requested Recipe

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

4 participants