This inspection reports any if
statements with then and else branches which
are both assignment expressions or both return
statements. The same semantics can be expressed more compactly, and arguably
more clearly, with a conditional expression. Example:
if (foo == null) { bar = null; } else { bar = foo.get(); }may be expressed as: bar = foo == null ? null : foo.get(); |
New in 8, Powered by InspectionGadgets |