Actual java code is:
((rrd == null || !rrd)
&& null != dam
&& null != dam.getac()
&& null != dam.getac().getc()
&& null != sname
&& sname.equalsIgnoreCase(dam.getac().getc()))
But when I look into class file it's:
((rrd != null) && (rrd.booleanValue()))
|| ((((null == dam)
|| (null == dam.getac())
|| (null == dam.getac().getc())
|| (null == sname)
|| (!(sname.equalsIgnoreCase(dam.getac().getc()))))))
All ||
and &&
interchanged.
Can anyone explain why?
The expressions are not equivalent but inverted. It looks like the compiler avoids an outer (or implied) not here.
Note that short-circuiting is possible for both operations, ||
and &&
-- in the first case when a true sub-expression is encountered and in the second case when a false sub-expression is encountered. So the ability to short-circuit alone does not explain this.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments