code: public static boolean isNonnull(Element element, boolean parametersNonnullByDefault) {
      return hasNonnullAnnotation(element)
          || isConstructor(element)  // Java constructors are always non-null.
          || (isParameter(element)
              && parametersNonnullByDefault
              && !((VariableElement) element).asType().getKind().isPrimitive());
    }
docs: Returns whether an element is marked as always being non-null. Field, method,
  and parameter elements can be defined as non-null with a Nonnull annotation.
  Method parameters can also be defined as non-null by annotating the owning
  package or type element with the ParametersNonnullByDefault annotation.