Creates a lexer instance via reflection. The object is not created with the default
constructor because it will not initialize the backtracking state of the lexer.
Instead, we pass <code>null</code> as CharStream argument.
764779
@Override
	public T get() {
		try {
			return clazz.getConstructor(CharStream.class).newInstance(new Object[] { null });
		}
		catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
13684
public Reflect create() throws ReflectionException {
      try {
         return on(clazz.getConstructor(), accessAll);
      } catch (NoSuchMethodException e) {
         if (accessAll) {
            try {
               return on(clazz.getDeclaredConstructor(), accessAll);
            } catch (NoSuchMethodException e2) {
               throw new ReflectionException(e2);
            }
         }
         throw new ReflectionException(e);
      }
   }
557858
public void load( InputStream is ) throws IOException
    {
        Properties lexPro = new Properties();
        lexPro.load(new BufferedInputStream(is));
        
        //about the lexicon, the lexicon path
        String lexDirs = lexPro.getProperty("lexicon.path");
        if ( lexDirs == null ) {
            throw new IOException("Missing lexicon.path property in jcseg.properties file!!!");
        }
        
        if ( ! "null".equalsIgnoreCase(lexDirs) ) {
            if ( lexDirs.indexOf("{jar.dir}") > -1 ) {
                lexDirs = lexDirs.replace("{jar.dir}", Util.getJarHome(this));
            }
            
            //Multiple path for lexicon.path.
            lexPath = lexDirs.split(";");
            File f  = null;
            for ( int i = 0; i < lexPath.length; i++ ) {
                lexPath[i] = java.net.URLDecoder.decode(lexPath[i], "UTF-8");
                f = new File(lexPath[i]);
                if ( ! f.exists() ) {
                    throw new IOException("Invalid sub lexicon path " + lexPath[i] 
                            + " for lexicon.path in jcseg.properties");
                }
                f = null;    //Let gc do its work
            }
        }
        
        //reset all the options
        if ( lexPro.getProperty("jcseg.maxlen") != null )
            MAX_LENGTH = Integer.parseInt(lexPro.getProperty("jcseg.maxlen"));
        if ( lexPro.getProperty("jcseg.icnname") != null
                && lexPro.getProperty("jcseg.icnname").equals("1"))
            I_CN_NAME = true;
        if ( lexPro.getProperty("jcseg.cnmaxlnadron") != null )
            MAX_CN_LNADRON = Integer.parseInt(lexPro.getProperty("jcseg.cnmaxlnadron"));
        if ( lexPro.getProperty("jcseg.nsthreshold") != null )
            NAME_SINGLE_THRESHOLD = Integer.parseInt(lexPro.getProperty("jcseg.nsthreshold"));
        if ( lexPro.getProperty("jcseg.pptmaxlen") != null ) 
            PPT_MAX_LENGTH = Integer.parseInt(lexPro.getProperty("jcseg.pptmaxlen"));
        if ( lexPro.getProperty("jcseg.loadpinyin") != null
                && lexPro.getProperty("jcseg.loadpinyin").equals("1")) 
            LOAD_CJK_PINYIN = true;
        if ( lexPro.getProperty("jcseg.loadsyn") != null
                && lexPro.getProperty("jcseg.loadsyn").equals("1") )
            LOAD_CJK_SYN = true;
        if ( lexPro.getProperty("jcseg.loadpos") != null
                && lexPro.getProperty("jcseg.loadpos").equals("1")) 
            LOAD_CJK_POS = true;
        if ( lexPro.getProperty("jcseg.loadentity") != null
                && lexPro.getProperty("jcseg.loadentity").equals("0")) 
            LOAD_CJK_ENTITY = false;
        if ( lexPro.getProperty("jcseg.loadparameter") != null
                && lexPro.getProperty("jcseg.loadparameter").equals("0")) 
            LOAD_PARAMETER = false;
        if ( lexPro.getProperty("jcseg.clearstopword") != null
                && lexPro.getProperty("jcseg.clearstopword").equals("1"))
            CLEAR_STOPWORD = true;
        if ( lexPro.getProperty("jcseg.cnnumtoarabic") != null
                && lexPro.getProperty("jcseg.cnnumtoarabic").equals("0"))
            CNNUM_TO_ARABIC = false;
        if ( lexPro.getProperty("jcseg.cnfratoarabic") != null
                && lexPro.getProperty("jcseg.cnfratoarabic").equals("0"))
            CNFRA_TO_ARABIC = false;
        if ( lexPro.getProperty("jcseg.keepunregword") != null
                && lexPro.getProperty("jcseg.keepunregword").equals("1"))
            KEEP_UNREG_WORDS = true;
        if ( lexPro.getProperty("lexicon.autoload") != null
                && lexPro.getProperty("lexicon.autoload").equals("1"))
            lexAutoload = true;
        if ( lexPro.getProperty("lexicon.polltime") != null )
            polltime = Integer.parseInt(lexPro.getProperty("lexicon.polltime"));
        
        //secondary split
        if ( lexPro.getProperty("jcseg.ensencondseg") != null
                && lexPro.getProperty("jcseg.ensencondseg").equals("0"))
            EN_SECOND_SEG = false;
        if ( lexPro.getProperty("jcseg.stokenminlen") != null )
            STOKEN_MIN_LEN = Integer.parseInt(lexPro.getProperty("jcseg.stokenminlen"));
        
        //load the keep punctuation
        if ( lexPro.getProperty("jcseg.keeppunctuations") != null )
            KEEP_PUNCTUATIONS = lexPro.getProperty("jcseg.keeppunctuations");
    }
89712
@SuppressWarnings("unchecked")
   private Handler createHandler() throws Throwable
   {
      Class clz = handler;

      while (clz != Object.class)
      {
         try
         {
            Constructor c = clz.getDeclaredConstructor((Class[])null);
            c.setAccessible(true);

            return (Handler)c.newInstance((Object[])null);
         }
         catch (Throwable t)
         {
            t.printStackTrace(System.err);
         }

         clz = clz.getSuperclass();
      }

      throw new IllegalStateException("Unable to find default constructor");
   }
1030813
public static StderrStream create()
  {
    if (_stderr == null) {
      _stderr = new StderrStream();
      ConstPath path = new ConstPath(null, _stderr);
      path.setScheme("stderr");
      //_stderr.setPath(path);
    }

    return _stderr;
  }
634133
protected void _generate(SarlConstructor constructor, PyAppendable it, IExtraLanguageGeneratorContext context) {
		if (constructor.isStatic()) {
			generateExecutable("___static_init___", constructor, false, false, null, //$NON-NLS-1$
					getTypeBuilder().getDocumentation(constructor),
					it, context);
			it.newLine().append("___static_init___()"); //$NON-NLS-1$
		} else {
			generateExecutable("__init__", constructor, true, false, null, //$NON-NLS-1$
					getTypeBuilder().getDocumentation(constructor),
					it, context);
		}
	}
141888
@Override
    public Tokenizer create(String toTokenize) {
        if (toTokenize.isEmpty()) {
            throw new IllegalArgumentException("Unable to proceed; no sentence to tokenize");
        }

        Tokenizer t = new JapaneseTokenizer(kuromoji, toTokenize, useBaseForm);

        if (preProcessor != null) {
            t.setTokenPreProcessor(preProcessor);
        }

        return t;
    }
777632
public final void mGREATER() throws RecognitionException {
		try {
			int _type = GREATER;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:226:5: ( '>' )
			// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:226:7: '>'
			{
			match('>'); if (state.failed) return;
			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
379251
@FactoryMethod
    public static OgnlExpectation create( String expected )
    {

        if (!OgnlExpectation.conditionalExpression( expected ) &&
            !OgnlExpectation.extractExpression( expected )) return null;
        return new OgnlExpectation( expected );
    }
61072
@SuppressWarnings("unchecked")
    @NotNull
    public <TYPE> TYPE create(@NotNull @FileExists @IsFile final File file, @NotNull final JAXBContext jaxbContext)
            throws UnmarshalObjectException {
        Contract.requireArgNotNull("file", file);
        FileExistsValidator.requireArgValid("file", file);
        IsFileValidator.requireArgValid("file", file);
        Contract.requireArgNotNull("jaxbContext", jaxbContext);
        try {
            final FileReader fr = new FileReader(file);
            try {
                return (TYPE) create(fr, jaxbContext);
            } finally {
                fr.close();
            }
        } catch (final IOException ex) {
            throw new UnmarshalObjectException("Unable to parse XML from file: " + file, ex);
        }
    }
345843
@Override
    public Parser newDelimitedParser(final InputStream dataSourceStream, final char delimiter, final char qualifier) {
        return new DelimiterParser(dataSourceStream, delimiter, qualifier, false);
    }
1016891
public static ConstraintViolationImpl<Object> instantiate(
      final SerializationStreamReader streamReader) throws SerializationException {

    final String messageTemplate = null;
    final String interpolatedMessage = streamReader.readString();
    final Class<Object> rootBeanClass = null;
    final Object rootBean = null;
    final Object leafBeanInstance = null;
    final Object value = null;
    final Path propertyPath = (Path) streamReader.readObject();
    final ConstraintDescriptor<?> constraintDescriptor = null;
    final ElementType elementType = null;
    final Map<String, Object> messageParameters = new HashMap<>();
    final Map<String, Object> expressionVariables = new HashMap<>();
    return (ConstraintViolationImpl<Object>) ConstraintViolationImpl.forBeanValidation(
        messageTemplate, messageParameters, expressionVariables, interpolatedMessage, rootBeanClass,
        rootBean, leafBeanInstance, value, propertyPath, constraintDescriptor, elementType, null);
  }
599091
protected SpellChecker createSpellChecker()
   {
      // spell checker config
      SpellChecker spCheck = null;
      if (spellCheckerClass != null)
      {
         try
         {
            spCheck = spellCheckerClass.newInstance();
            spCheck.init(SearchIndex.this, spellCheckerMinDistance, spellCheckerMorePopular);
         }
         catch (IOException e)
         {
            log.warn("Exception initializing spell checker: " + spellCheckerClass, e);
         }
         catch (InstantiationException e)
         {
            log.warn("Exception initializing spell checker: " + spellCheckerClass, e);
         }
         catch (IllegalAccessException e)
         {
            log.warn("Exception initializing spell checker: " + spellCheckerClass, e);
         }
      }
      return spCheck;
   }
246570
public Object createInstanceQuietly() {
      try {
         return clazz.newInstance();
      } catch (InstantiationException e) {
         log.finest(e);
         return null;
      } catch (IllegalAccessException e) {
         log.finest(e);
         return null;
      }
   }
621654
private <T> Instantiator<T> getByDefaultConstructor(TypeToken<T> type) {
    try {
      final Constructor<? super T> defaultCons = type.getRawType().getDeclaredConstructor();
      defaultCons.setAccessible(true);

      return new Instantiator<T>() {
        @Override
        public T create() {
          try {
            return (T) defaultCons.newInstance();
          } catch (Exception e) {
            throw Throwables.propagate(e);
          }
        }
      };

    } catch (NoSuchMethodException e) {
      return null;
    }
  }
360187
public ApacheHttpdLogfileRecordReader createRecordReader() {
        try {
            return new ApacheHttpdLogfileRecordReader(getLogFormat(), getRequestedFields(), getTypeRemappings(), getAdditionalDissectors());
        } catch (IOException e) {
            return null;
        }
    }
822189
private static Writer writerFor( OutputStream stream)
    {
    try
      {
      return
        stream == null
        ? null
        : new OutputStreamWriter( stream, "UTF-8");
      }
    catch( Exception e)
      {
      throw new RuntimeException( "Can't create writer", e);
      }
    }