use of com.sun.tools.javac.processing.JavacProcessingEnvironment in project antlr4 by antlr.
the class CommentHasStringValueProcessor method init.
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
super.init(processingEnv);
// Messager messager = processingEnv.getMessager();
// messager.printMessage(Diagnostic.Kind.NOTE, "WOW INIT--------------------");
JavacProcessingEnvironment javacProcessingEnv = (JavacProcessingEnvironment) processingEnv;
utilities = javacProcessingEnv.getElementUtils();
treeMaker = TreeMaker.instance(javacProcessingEnv.getContext());
}
use of com.sun.tools.javac.processing.JavacProcessingEnvironment in project ceylon-compiler by ceylon.
the class T7021650 method process.
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
round++;
Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
// verify items in context as expected
check("Demo", Demo.instance(context), Demo.class);
check("Attr", Attr.instance(context), MyAttr.class);
// values in the context are correctly handled in subsequent processing rounds
if (round <= MAX_ROUNDS) {
String pkg = "p";
String currClass = "Gen" + round;
String curr = pkg + "." + currClass;
String next = (pkg + ".Gen" + (round + 1));
StringBuilder text = new StringBuilder();
text.append("package ").append(pkg).append(";\n");
text.append("public class ").append(currClass).append(" {\n");
if (round < MAX_ROUNDS)
text.append(" ").append(next).append(" x;\n");
text.append("}\n");
try {
JavaFileObject fo = filer.createSourceFile(curr);
Writer out = fo.openWriter();
try {
out.write(text.toString());
} finally {
out.close();
}
} catch (IOException e) {
throw new Error(e);
}
}
return true;
}
use of com.sun.tools.javac.processing.JavacProcessingEnvironment in project ceylon-compiler by ceylon.
the class T6597678 method process.
//---------------
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
Locale locale = context.get(Locale.class);
JavacMessages messages = context.get(JavacMessages.messagesKey);
round++;
if (round == 1) {
initialLocale = locale;
initialMessages = messages;
} else {
checkEqual("locale", locale, initialLocale);
checkEqual("messages", messages, initialMessages);
}
return true;
}
use of com.sun.tools.javac.processing.JavacProcessingEnvironment in project ceylon-compiler by ceylon.
the class T7018098 method process.
//---------------
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
FSInfo fsInfo = context.get(FSInfo.class);
round++;
if (round == 1) {
boolean expect = Boolean.valueOf(options.get("expect"));
checkEqual("cache result", fsInfo.isDirectory(testDir), expect);
initialFSInfo = fsInfo;
} else {
checkEqual("fsInfo", fsInfo, initialFSInfo);
}
return true;
}
use of com.sun.tools.javac.processing.JavacProcessingEnvironment in project ceylon-compiler by ceylon.
the class TestContext method process.
@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;
}
Aggregations