-
Notifications
You must be signed in to change notification settings - Fork 106
Closed
Closed
Predicates.instanceOf is not migrated, which creates a conflict with the NoGuavaPredicate recipe#918
Feature
Copy link
Labels
Description
The Predicate class from Guava is converted in java.util.Predicate but the Predicates.instanceOf method, that is not converted, is generally used with it.
What version of OpenRewrite are you using?
I am using
- Rewrite Maven Plugin v6.23.0
- Maven v3.9.5
- org.openrewrite.recipe:rewrite-migrate-java v3.21.0
How are you running OpenRewrite?
I used the Maven command line to launch the recipe on the Sirius Desktop repository :
mvn -U org.openrewrite.maven:rewrite-maven-plugin:6.23.0-SNAPSHOT:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:3.21.0-SNAPSHOT -Drewrite.activeRecipes=org.openrewrite.java.migrate.guava.NoGuava -Drewrite.exportDatatables=true -Dmaven.repo.local=./.repositoryMaven -f packaging/org.eclipse.sirius.parent/pom.xmlWhat is the smallest, simplest way to reproduce the problem?
import java.util.Collection;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
class Test {
boolean test(Collection<Object> collection) {
return Iterables.all(collection, Predicates.instanceOf(String.class));
}
}What did you expect to see?
import java.util.Collection;
import com.google.common.collect.Iterables;
class Test {
boolean test(Collection<Object> collection) {
return Iterables.all(collection, String.class::isInstance);
}
}What did you see instead?
import java.util.Collection;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
class Test {
boolean test(Collection<Object> collection) {
return Iterables.all(collection, Predicates.instanceOf(String.class));
}
}Metadata
Metadata
Labels
Type
Projects
Status
Done