Adam Heath wrote:
Adrian Crum wrote:
Adam Heath wrote:
Adrian Crum wrote:
FlexibleStringExpander fse =
FlexibleStringExpander.getInstance("someExpression");
if (fse != null) {
// some code
}
This was always broken. Type foo = new Type(); foo will *never* be
null, period. There are existing places in the code where this new
Type() compared to null takes place, unrelated to FSE.
I was trying to provide a simplified example. You are correct - the
simplified example would never work to begin with. What the simplified
example might really look like:
protected FlexibleStringExpander description = null;
Just for reference, the correct fix here would remove the null default
value, make it final, and remove the condition check below.
Exactly.