Subtle difference between these two. Should be:

      if (hasValue == null) {
          return false; // expression could not be evaluated
      }
      if (!hasValue.booleanValue()) {
            return true; // expression was evaluated, but evaluated to null
      }