void (Optional<String> opt) { boolean present = opt.isPresent(); boolean absent = !present; boolean otherAbsent = !!absent; if(otherAbsent) { System.out.println(opt.<warning descr="The call to 'get' always fails, according to its method contracts">get</warning>()); } else { System.out.println(opt.get()); } }