How are you running OpenRewrite?
I am using the Maven plugin, and my project is a multi module project.
<profile>
<id>openrewrite</id>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>5.23.1</version>
<configuration>
<activeRecipes>
<recipe>org.openrewrite.java.testing.assertj.Assertj</recipe>
</activeRecipes>
<failOnDryRunResults>true</failOnDryRunResults>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-testing-frameworks</artifactId>
<version>2.4.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
What is the smallest, simplest way to reproduce the problem?
No guarantee on completeness of imports 😄
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertTrue;
class A {
class MyLang { MyLang(String l){} Locale asLocale(){return null;}}
@Test
void regressionAsLocaleShouldStay() {
MyLang underTest = new MyLang("he");
Set<Locale> localeSet = new HashSet<>();
assertTrue(localeSet.contains(underTest.asLocale()));
}
}
What did you expect to see?
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import static org.assertj.core.api.Assertions.assertThat;
class A {
class MyLang { MyLang(String l){} Locale asLocale(){return null;}}
@Test
void regressionAsLocaleShouldStay() {
MyLang underTest = new MyLang("he");
Set<Locale> localeSet = new HashSet<>();
assertThat(localeSet).contains(underTest.asLocale());
}
}
What did you see instead?
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import static org.assertj.core.api.Assertions.assertThat;
class A {
class MyLang { MyLang(String l){} Locale asLocale(){return null;}}
@Test
void regressionAsLocaleShouldStay() {
MyLang underTest = new MyLang("he");
Set<Locale> localeSet = new HashSet<>();
assertThat(localeSet).contains(underTest);
}
}
Comment
In a nutshell: the asLocale call on my custom class is erroneously dropped.
I suppose the asLocale can be skipped for some jdk class but that the recipe does not check for this type
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a multi module project.
What is the smallest, simplest way to reproduce the problem?
No guarantee on completeness of imports 😄
What did you expect to see?
What did you see instead?
Comment
In a nutshell: the
asLocalecall on my custom class is erroneously dropped.I suppose the
asLocalecan be skipped for some jdk class but that the recipe does not check for this type