openrewrite / rewrite

Automated mass refactoring of source code.
https://docs.openrewrite.org
Apache License 2.0
2.03k stars 300 forks source link

Incorrect formatting resulting from `MissingOverrideAnnotation` #1111

Closed jkschneider closed 2 years ago

jkschneider commented 2 years ago

Problem

Describe the issue you are experiencing.

Expected behavior

Describe what you expected to see.

Example diff

 @JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class, property = "@ref")
 public interface Polyglot extends Serializable, Tree {

-    UUID getId();
+    @Override
+ UUID getId();

     Value getValue();

Recipes in example diff:

References:

delanym commented 2 years ago

This is still an issue

-  public Identity() {
+    @Override
+    public Identity() {
traceyyoshima commented 2 years ago

This is still an issue

Hi @delanym, it's pretty late, but I happened to be at my computer.

Based on the output, I don't think it's the same issue. It looks like autodetect set the indent to 4 spaces instead of 2 spaces. I'll try to reproduce your issue tomorrow morning. It may be difficult without seeing more code, but I'll do what I can.