本文整理汇总了Java中groovy.transform.CompileStatic类的典型用法代码示例。如果您正苦于以下问题:Java CompileStatic类的具体用法?Java CompileStatic怎么用?Java CompileStatic使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompileStatic类属于groovy.transform包,在下文中一共展示了CompileStatic类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import groovy.transform.CompileStatic; //导入依赖的package包/类
@Override
public CompilationCustomizer create() {
final Map<String, Object> annotationParams = new HashMap<>();
if (extensions != null && !extensions.isEmpty()) {
if (extensions.contains(","))
annotationParams.put("extensions", Stream.of(extensions.split(",")).collect(Collectors.toList()));
else
annotationParams.put("extensions", Collections.singletonList(extensions));
}
return new ASTTransformationCustomizer(annotationParams, CompileStatic.class);
}
示例2: createStaticConfiguration
import groovy.transform.CompileStatic; //导入依赖的package包/类
protected static CompilerConfiguration createStaticConfiguration() {
CompilerConfiguration compilerConfiguration = new CompilerConfiguration();
ASTTransformationCustomizer astTransformationCustomizer = new ASTTransformationCustomizer(
Collections.singletonMap("extensions", Collections.singletonList("EngineVariablesExtension.groovy")),
CompileStatic.class, "org.codehaus.groovy.transform.sc.StaticCompileTransformation");
compilerConfiguration.addCompilationCustomizers(astTransformationCustomizer);
return compilerConfiguration;
}
示例3: MarkupTemplateEngine
import groovy.transform.CompileStatic; //导入依赖的package包/类
public MarkupTemplateEngine(final ClassLoader parentLoader, final TemplateConfiguration tplConfig, final TemplateResolver resolver) {
compilerConfiguration = new CompilerConfiguration();
templateConfiguration = tplConfig;
compilerConfiguration.addCompilationCustomizers(new TemplateASTTransformer(tplConfig));
compilerConfiguration.addCompilationCustomizers(
new ASTTransformationCustomizer(Collections.singletonMap("extensions", "groovy.text.markup.MarkupTemplateTypeCheckingExtension"), CompileStatic.class));
if (templateConfiguration.isAutoNewLine()) {
compilerConfiguration.addCompilationCustomizers(
new CompilationCustomizer(CompilePhase.CONVERSION) {
@Override
public void call(final SourceUnit source, final GeneratorContext context, final ClassNode classNode) throws CompilationFailedException {
new AutoNewLineTransformer(source).visitClass(classNode);
}
}
);
}
groovyClassLoader = AccessController.doPrivileged(new PrivilegedAction<TemplateGroovyClassLoader>() {
public TemplateGroovyClassLoader run() {
return new TemplateGroovyClassLoader(parentLoader, compilerConfiguration);
}
});
if (DEBUG_BYTECODE) {
compilerConfiguration.setBytecodePostprocessor(BytecodeDumper.STANDARD_ERR);
}
templateResolver = resolver == null ? new DefaultTemplateResolver() : resolver;
templateResolver.configure(groovyClassLoader, templateConfiguration);
}
示例4: createASTTransformationCustomizer
import groovy.transform.CompileStatic; //导入依赖的package包/类
private ASTTransformationCustomizer createASTTransformationCustomizer() {
return new ASTTransformationCustomizer(singletonMap("extensions",
singletonList("com.ge.predix.acs.commons.policy.condition.groovy.GroovySecureExtension")),
CompileStatic.class);
}