当前位置: 首页>>代码示例>>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;未经允许,请勿转载。