Closes gh-11788
@ -264,7 +264,7 @@ public final class PropertyMapper {
* @param target the target type to match
* @return a new filtered source instance
*/
public <R> Source<R> whenInstanceOf(Class<R> target) {
public <R extends T> Source<R> whenInstanceOf(Class<R> target) {
return when(target::isInstance).as(target::cast);
}
@ -151,7 +151,8 @@ public class PropertyMapperTests {
@Test
public void whenInstanceOfWhenValueIsNotTargetTypeShouldNotMatch() {
this.map.from(() -> 123).whenInstanceOf(Double.class).toCall(Assert::fail);
this.map.from(() -> (Number) 123L).whenInstanceOf(Double.class)
.toCall(Assert::fail);