本文整理汇总了Java中com.sun.tools.javac.processing.JavacProcessingEnvironment.getContext方法的典型用法代码示例。如果您正苦于以下问题:Java JavacProcessingEnvironment.getContext方法的具体用法?Java JavacProcessingEnvironment.getContext怎么用?Java JavacProcessingEnvironment.getContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.processing.JavacProcessingEnvironment
的用法示例。
在下文中一共展示了JavacProcessingEnvironment.getContext方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import com.sun.tools.javac.processing.JavacProcessingEnvironment; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
round++;
JavacProcessingEnvironment jpe = (JavacProcessingEnvironment) processingEnv;
Context c = jpe.getContext();
check(c.get(JavacElements.class), eltUtils);
check(c.get(JavacTypes.class), typeUtils);
check(c.get(JavacTrees.class), treeUtils);
final int MAXROUNDS = 3;
if (round < MAXROUNDS)
generateSource("Gen" + round);
return true;
}
示例2: Javac
import com.sun.tools.javac.processing.JavacProcessingEnvironment; //导入方法依赖的package包/类
public Javac(ProcessingEnvironment env) {
if (env == null) {
throw new IllegalArgumentException("Must provide a "
+ ProcessingEnvironment.class.getSimpleName()
+ " instance!");
}
options = env.getOptions();
JavacProcessingEnvironment javacEnv = (JavacProcessingEnvironment) env;
context = javacEnv.getContext();
make = TreeMaker.instance(context);
elements = JavacElements.instance(context);
}
示例3: provideJavacUtilContext
import com.sun.tools.javac.processing.JavacProcessingEnvironment; //导入方法依赖的package包/类
@Provides @Singleton
static Context provideJavacUtilContext(final JavacProcessingEnvironment env) {
return env.getContext();
}
示例4: JavacLogger
import com.sun.tools.javac.processing.JavacProcessingEnvironment; //导入方法依赖的package包/类
public JavacLogger(JavacProcessingEnvironment env) {
Context ctx = env.getContext();
jcutils = new JavacUtilsImpl(ctx);
trees = JavacTrees.instance(ctx);
log = Log.instance(ctx);
}