Code change: a null check is not needed before using instanceof.

Description

There are numerous examples of there is a null check that is not needed before using instanceof.

See the Java Language Specification, at http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.20.2 which states:

"At run time, the result of the instanceof operator is true if the value of the RelationalExpression is not null and the reference could be cast (�15.16) to the ReferenceType without raising a ClassCastException. Otherwise the result is false."

So if the operand is null, the result is false.

I've attached a patch that removes the check in 15 occurrences in 9 source files in various modules.

Assignee

Tijs Rademakers

Reporter

David Malkovsky

Labels

None

Components

Fix versions

Priority

Major
Configure