本文整理匯總了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);
}