-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OrderImports breaks the build by collapsing enum import + whitespace inconsistencies #4165
Comments
Hi! Thanks for reporting in such detail with reproduction samples; looking above this seems at least closely related to this issue: Would you say those are the same case? Or do you think your use of a custom style factors in here as well? What I like about that other issue is that we have a fairly simple unit test to replicate the issue there: #3283 (comment) Do appreciate you calling this out! Definitely something we should fix to have a good experience running |
Yeah, I think that PR is similar to my first observation. |
@timo-a we have recently made some improvements to the |
Specifically, these changes were made just now, and are available in the latest snapshot ; a release will go out tomorrow: |
I just had another look at it with rewrite-maven-plugin 5.40.2. |
Thanks a lot for the runnable test! That should really help pinpoint a cause and get it fixed. I've asked Laurens to have a look. |
|
Observation 3 has resolved itself, but observation 2 has not. I've opened #4548 as a reproducible example. |
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a single module project.
What is the
smallest, simplestway to reproduce the problem?This example is not minimal, but it is reproducible.
./gradlew publishToMavenLocal
mvn -P openrewrite org.openrewrite.maven:rewrite-maven-plugin:run
What did you see?
this change set: timo-a/jackson-core@c2970c0
are replaced with
in PrettyPrinterTest. As a consequence
Spacing.NONE
in line 271 can no longer be resolved. I don't know what issue the compiler has here, but apparently there is an edge case concerning enum imports. Other files are affected as well, but it is the same pattern there.extends
on new line is indentedExample: timo-a/jackson-core@c2970c0#diff-88fe5e2a29aa76eab8d3ec510f7aeb1ed3505a08c183f74e01543ff398ef7d0d
The docs only speak of ordering imports:
so this is unexpected.
Based on my style specification, I expect imports to be split in at most three groups: other, my explicitly defined package and static imports. However there is always (?) a blank line after java imports while not necessarily above it,
example: timo-a/jackson-core@c2970c0#diff-fc3028f1ae776b0c8a46f8cacd73ecad36c879df456fb575d69ff48f5a2c3291
Are you interested in contributing a fix to OpenRewrite?
no, just reporting
The text was updated successfully, but these errors were encountered: