Skip to content

Commit

Permalink
#3156 = do not transform interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
coiouhkc committed Jun 17, 2023
1 parent acb5cf5 commit 722f905
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ public J.ClassDeclaration visitClassDeclaration(
final J.ClassDeclaration classDecl,
final AtomicBoolean shouldPerformChanges
) {
if (classDecl.getType().hasFlags(Flag.Interface)) {
shouldPerformChanges.set(false);
}
if (classDecl.hasModifier(J.Modifier.Type.Abstract)) {
shouldPerformChanges.set(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

/**
* Cases to test:
* - Interfaces
* - Empty classes & interfaces
* - inheritance
* - instantiations of changed classes
Expand Down Expand Up @@ -280,6 +279,22 @@ public static void doSmth() {
);
}

@Test
void givenInteface() {
rewriteRun(
recipeSpec -> recipeSpec.recipe(new LombokUtilityClass()),
java(
"""
public interface A {
int CONST = 1;
static void doSmth() {
}
}
"""
)
);
}

}

@Test
Expand Down

0 comments on commit 722f905

Please sign in to comment.