-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
8, 11, 13, 14
-
x86_64
-
windows_10
ADDITIONAL SYSTEM INFORMATION :
jdk 1.8.0_202-b08
A DESCRIPTION OF THE PROBLEM :
in my functioin, lambda method reference is argument, i think it is only a expression, but lamba method reference is calculating, let us see detail
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
public static boolean contains(List list, Object o) {
return execute(list, o, l -> false, list::contains);
}
public static <R> R execute(List list, Object o,
Function<Object, R> defaultConsumer,
Function<Object, R> executeConsumer) {
if (CollectionUtils.isEmpty(list) || null == o) {
return defaultConsumer.apply(list);
}
return executeConsumer.apply(o);
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
when list is null , result Expected is false
ACTUAL -
but throw a NPE (list:contains)
---------- BEGIN SOURCE ----------
public static boolean contains(List list, Object o) {
return execute(list, o, l -> false, list::contains);
}
public static <R> R execute(List list, Object o,
Function<Object, R> defaultConsumer,
Function<Object, R> executeConsumer) {
if (CollectionUtils.isEmpty(list) || null == o) {
return defaultConsumer.apply(list);
}
return executeConsumer.apply(o);
}
---------- END SOURCE ----------
FREQUENCY : always
jdk 1.8.0_202-b08
A DESCRIPTION OF THE PROBLEM :
in my functioin, lambda method reference is argument, i think it is only a expression, but lamba method reference is calculating, let us see detail
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
public static boolean contains(List list, Object o) {
return execute(list, o, l -> false, list::contains);
}
public static <R> R execute(List list, Object o,
Function<Object, R> defaultConsumer,
Function<Object, R> executeConsumer) {
if (CollectionUtils.isEmpty(list) || null == o) {
return defaultConsumer.apply(list);
}
return executeConsumer.apply(o);
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
when list is null , result Expected is false
ACTUAL -
but throw a NPE (list:contains)
---------- BEGIN SOURCE ----------
public static boolean contains(List list, Object o) {
return execute(list, o, l -> false, list::contains);
}
public static <R> R execute(List list, Object o,
Function<Object, R> defaultConsumer,
Function<Object, R> executeConsumer) {
if (CollectionUtils.isEmpty(list) || null == o) {
return defaultConsumer.apply(list);
}
return executeConsumer.apply(o);
}
---------- END SOURCE ----------
FREQUENCY : always