當前位置: 首頁>>代碼示例>>Java>>正文


Java CompilerConfiguration.DEFAULT屬性代碼示例

本文整理匯總了Java中org.codehaus.groovy.control.CompilerConfiguration.DEFAULT屬性的典型用法代碼示例。如果您正苦於以下問題:Java CompilerConfiguration.DEFAULT屬性的具體用法?Java CompilerConfiguration.DEFAULT怎麽用?Java CompilerConfiguration.DEFAULT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.codehaus.groovy.control.CompilerConfiguration的用法示例。


在下文中一共展示了CompilerConfiguration.DEFAULT屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: GroovyCodeBlockCompiler

private GroovyCodeBlockCompiler() {

        CompilerConfiguration conf = new CompilerConfiguration(CompilerConfiguration.DEFAULT);

        ImportCustomizer imports = new ImportCustomizer();
        imports.addStarImports("org.voltdb");
        imports.addImports(
                "org.voltdb.groovy.TableBuilder",
                "org.voltdb.groovy.Tuplerator",
                "org.voltdb.VoltProcedure.VoltAbortException"
                 );
        imports.addStaticStars("org.voltdb.VoltProcedure","org.voltdb.VoltType");

        conf.addCompilationCustomizers(imports);
        // conf.getOptimizationOptions().put("int", false);
        // conf.getOptimizationOptions().put("indy", true);
        conf.setScriptBaseClass(DelegatingScript.class.getName());

        File groovyOut = createGroovyOutDirectory();

        List<String> classPath = conf.getClasspath();
        classPath.add(groovyOut.getAbsolutePath());
        conf.setClasspathList(classPath);

        conf.setTargetDirectory(groovyOut);

        gcl = new GroovyClassLoader(Thread.currentThread().getContextClassLoader(), conf);
    }
 
開發者ID:anhnv-3991,項目名稱:VoltDB,代碼行數:28,代碼來源:GroovyCodeBlockCompiler.java

示例2: getCompilerConfiguration

@Override
protected CompilerConfiguration getCompilerConfiguration() {
    CompilerConfiguration configuration = new CompilerConfiguration(CompilerConfiguration.DEFAULT);
    configuration.setPluginFactory(new Antlr4PluginFactory());

    return configuration;
}
 
開發者ID:apache,項目名稱:groovy,代碼行數:7,代碼來源:Antlr4Parser.java

示例3: GroovyClassLoader

/**
 * creates a GroovyClassLoader.
 *
 * @param parent                    the parent class loader
 * @param config                    the compiler configuration
 * @param useConfigurationClasspath determines if the configurations classpath should be added
 */
public GroovyClassLoader(ClassLoader parent, CompilerConfiguration config, boolean useConfigurationClasspath) {
    super(EMPTY_URL_ARRAY, parent);
    if (config == null) config = CompilerConfiguration.DEFAULT;
    this.config = config;
    if (useConfigurationClasspath) {
        for (String path : config.getClasspath()) {
            this.addClasspath(path);
        }
    }

    initSourceEncoding(config);
}
 
開發者ID:apache,項目名稱:groovy,代碼行數:19,代碼來源:GroovyClassLoader.java

示例4: doParseClass

private Class doParseClass(GroovyCodeSource codeSource) {
	validate(codeSource);
	Class answer; // Was neither already loaded nor compiling, so compile and add to cache.
	CompilerConfiguration config = CompilerConfiguration.DEFAULT;
	
	CompilationUnit unit = createCompilationUnit(config, codeSource.getCodeSource());
	
	SourceUnit su = null;
	if (codeSource.getFile() == null) {
		su = unit.addSource(codeSource.getName(), codeSource.getScriptText());
	}
	else {
		su = unit.addSource(codeSource.getFile());
	}
	
	MyClassCollector collector = createMyCollector(unit, su);
	
	unit.setClassgenCallback(collector);
	int goalPhase = Phases.CLASS_GENERATION;
	if (config != null && config.getTargetDirectory() != null)
		goalPhase = Phases.OUTPUT;
	unit.compile(goalPhase);
	@SuppressWarnings("unchecked")
	List<Class<?>> classList = (List<Class<?>>) collector.getLoadedClasses();
	answer = classList.get(0);
	String mainClass = su.getAST().getMainClassName();
	for (Object o : collector.getLoadedClasses()) {
		Class clazz = (Class) o;
		String clazzName = clazz.getName();
		definePackage(clazzName);
		setClassCacheEntry(clazz);
		if (clazzName.equals(mainClass))
			answer = clazz;
	}
	synchronized (classBytes) {
		this.classBytes.put(resolveName(answer.getName()) + ".class", collector.code);
	}
	return answer;
}
 
開發者ID:niaoge,項目名稱:spring-dynamic,代碼行數:39,代碼來源:HiGroovyClassLoader.java

示例5: createClassLoader

private synchronized void createClassLoader() {
    final CompilerConfiguration conf = new CompilerConfiguration(CompilerConfiguration.DEFAULT);
    conf.addCompilationCustomizers(this.importGroovyCustomizer.create());

    // ConfigurationCustomizerProvider is treated separately
    groovyCustomizers.stream().filter(cp -> !(cp instanceof ConfigurationGroovyCustomizer))
            .forEach(p -> conf.addCompilationCustomizers(p.create()));

    groovyCustomizers.stream().filter(cp -> cp instanceof ConfigurationGroovyCustomizer).findFirst()
            .ifPresent(cp -> ((ConfigurationGroovyCustomizer) cp).applyCustomization(conf));

    this.loader = new GremlinGroovyClassLoader(getParentLoader(), conf);
}
 
開發者ID:apache,項目名稱:tinkerpop,代碼行數:13,代碼來源:GremlinGroovyScriptEngine.java

示例6: prepareCompilerConfiguration

protected CompilerConfiguration prepareCompilerConfiguration() {
    return new CompilerConfiguration(CompilerConfiguration.DEFAULT);
}
 
開發者ID:jenkinsci,項目名稱:ontrack-plugin,代碼行數:3,代碼來源:AbstractDSLLauncher.java

示例7: getCompilerConfiguration

@Override
protected CompilerConfiguration getCompilerConfiguration() {
    return CompilerConfiguration.DEFAULT;
}
 
開發者ID:apache,項目名稱:groovy,代碼行數:4,代碼來源:Antlr2Parser.java

示例8: GroovyShell

public GroovyShell(ClassLoader parent, Binding binding) {
    this(parent, binding, CompilerConfiguration.DEFAULT);
}
 
開發者ID:apache,項目名稱:groovy,代碼行數:3,代碼來源:GroovyShell.java


注:本文中的org.codehaus.groovy.control.CompilerConfiguration.DEFAULT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。