Object () { Long size = null; try (MyAutoCloseable autoCloseable = new MyAutoCloseable()) { size = autoCloseable.countClose(); return size; } catch (MyAutoCloseable.MyClosingException e) { return <warning descr="Expression 'size' might evaluate to null but is returned by the method which is not declared as @Nullable">size</warning>; } }