void (boolean b) { System.out.println(Optional.of("xyz").get()); Optional<String> test; if(b) { test = Optional.empty(); } else { test = Optional.empty(); } System.out.println(test.<warning descr="The call to 'get' always fails, according to its method contracts">get</warning>()); }