Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.openrewrite.staticanalysis;

import org.junit.jupiter.api.Test;
import org.junitpioneer.jupiter.ExpectedToFail;
import org.openrewrite.DocumentExample;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;
Expand Down Expand Up @@ -86,6 +87,42 @@ public String toString() {
);
}

@ExpectedToFail("Both variants are renamed to hashCode(), producing two colliding declarations")
@Test
void doNotRenameWhenTwoMisspelledVariantsWouldCollide() {
rewriteRun(
//language=java
java(
"""
class Test {
public int hashcode() {
return 1;
}

public int hashCODE() {
return 2;
}
}
"""
)
);
}

@ExpectedToFail("An annotation type member may not carry the name of an Object method")
@Test
void doNotRenameAnnotationTypeMember() {
rewriteRun(
//language=java
java(
"""
@interface Test {
int hashcode();
}
"""
)
);
}

@Test
void compliantWhenHasMismatchingTypeInformation() {
rewriteRun(
Expand Down
Loading