public Token(TokenType type,TokenPosition position,int length,String data){
  super(position);
  if (length < 0)   throw new IllegalArgumentException("Token length must not be negative");
  this.type=Objects.requireNonNull(type);
  this.length=length;
  this.data=data;
}

public Token ( TokenType type , TokenPosition position , int length , String data ) { super ( position ) ; if ( length < 0 ) throw new IllegalArgumentException ( "Token length must not be negative" ) ; this . type = Objects . requireNonNull ( type ) ; this . length = length ; this . data = data ; }
creates a new token with the given parameters .
