squid:S2259: No issue regarding raised if public or protected (non final) method may return null

  • Version: Community Edition Version 7.9.1 (build 27448)
  • error observed:
    The following scenario should raise an issue (Null pointers should not be dereferenced (squid:S2259)) in method getB() on calling getB() on potential null getA() return value.
  public A getA() {
    if (isCheck()) {
      return null;
    return nonNull;

  public B getB() {
    return getA().getB(); // should raise issue
  • steps to reproduce: see code above
  • potential workaround: Make method final (if possible)

In my opinion that scenario should raise an issue.