void (Optional<String> opt) { X x = <warning descr="Method reference invocation 'MethodReferenceConstantValue::strangeMethod' may produce 'NullPointerException'"><warning descr="Method reference result is always 'false'">MethodReferenceConstantValue::strangeMethod</warning></warning>; Boolean aBoolean = opt.map(<warning descr="Method reference result is always 'false'">this::strangeMethod</warning>) .map(<warning descr="Method reference result is always 'true'">Objects::nonNull</warning>) .map(<warning descr="Method reference result is always 'false'">Objects::isNull</warning>) .map(MethodReferenceConstantValue::alwaysTrue) .orElse(false); if (opt.isPresent()) { Stream.generate(<warning descr="Method reference result is always 'true'">opt::isPresent</warning>) .limit(10) .forEach(System.out::println); } }