code: public static Object getGenInstance(Class<?> cls, Object... args) throws ParserException
      {
          Class<?> parserClass = getGenClass(cls);
          try
          {
              if (args.length == 0)
              {
                  return parserClass.newInstance();
              }
              else
              {
                  for (Constructor constructor : parserClass.getConstructors())
                  {
                      Class[] parameterTypes = constructor.getParameterTypes();
                      if (parameterTypes.length == args.length)
                      {
                          boolean match = true;
                          int index = 0;
                          for (Class c : parameterTypes)
                          {
                              if (!c.isAssignableFrom(args[index++].getClass()))
                              {
                                  match = false;
                                  break;
                              }
                          }
                          if (match)
                          {
                              return constructor.newInstance(args);
                          }
                      }
                  }
                  throw new IllegalArgumentException("no required constructor for "+cls);
              }
          }
  
          catch (InstantiationException | IllegalAccessException | SecurityException | IllegalArgumentException | InvocationTargetException ex)
          {
              throw new ParserException(ex);
          }
      }
docs: Creates generated class instance either by using ClassLoader or by compiling it dynamically
  @param cls Annotated class acting also as superclass for created parser
  @param args
  @return
  @throws ParserException