I have a method like
Bar yieldBar(Foo foo) {
Bar bar = new Bar();
bar.setFoo(foo);
return bar;
}
And I want this call to simply return null if foo
is null. Is there a way to implement something like
@NullPassthrough
Bar yieldBar(Foo foo) {
...
}
Which would be equivalent to below through some compile time generated wrapper:
Bar yieldBar(Foo foo) {
if (foo == null) return null;
return yieldBar(foo);
}
Bar yieldBarHelper(Foo foo) {
...
}