"import" comment deleted after "Optimize Imports" command

Answered

Hello, I just noticed that a comment after an import statement is no longer present after optimization!

Before <ctrl-alt-o>:

After <ctrl-alt-o>:

 

My IDEA version is:

IntelliJ IDEA 2022.2.3 (Ultimate Edition)
Build #IU-222.4345.14, built on October 5, 2022
Licensed to ...
Subscription is active until ...
Runtime version: 17.0.4.1+7-b469.62 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0

Could this be a bug?

0
2 comments

Looks like it is a known problem https://youtrack.jetbrains.com/issue/IDEA-128133

As a workaround, you can perform reformat code action for such files with `Code | Reformat File... | Optimize Imports` option disabled.

0

Thanks Egor for the hint.

0

Please sign in to leave a comment.