code: public void setObjective(Objective<? super SolutionType, ? super DataType> objective) {
          // check not null
          if(objective == null){
              throw new NullPointerException("Error while setting objective: null is not allowed.");
          }
          this.objective = objective;
      }
docs: Set the objective function. Any objective designed for the solution and data types of the problem,
  or more general types, is accepted. The objective can not be <code>null</code>.
  
  @param objective objective function
  @throws NullPointerException if <code>objective</code> is <code>null</code>