use of com.oracle.truffle.dsl.processor.java.model.CodeAnnotationMirror in project graal by oracle.
the class InstrumentableProcessor method generateWrapperAndFactory.
private CodeTypeElement generateWrapperAndFactory(ProcessorContext context, Element e) {
CodeTypeElement wrapper = generateWrapper(context, e, false);
if (wrapper == null) {
return null;
}
CodeTypeElement factory = generateFactory(context, e, wrapper);
// add @SuppressWarnings("deprecation")
DeclaredType suppressWarnings = context.getDeclaredType(SuppressWarnings.class);
CodeAnnotationMirror suppressWarningsAnnotation = new CodeAnnotationMirror(suppressWarnings);
suppressWarningsAnnotation.setElementValue(ElementUtils.findExecutableElement(suppressWarnings, "value"), new CodeAnnotationValue(Arrays.asList(new CodeAnnotationValue("deprecation"))));
factory.getAnnotationMirrors().add(suppressWarningsAnnotation);
wrapper.getModifiers().add(Modifier.STATIC);
factory.add(wrapper);
assertNoErrorExpected(e);
return factory;
}
use of com.oracle.truffle.dsl.processor.java.model.CodeAnnotationMirror in project graal by oracle.
the class InstrumentableProcessor method addGeneratedBy.
private static void addGeneratedBy(ProcessorContext context, CodeTypeElement generatedType, TypeElement generatedByType) {
DeclaredType generatedBy = (DeclaredType) context.getType(GeneratedBy.class);
// only do this if generatedBy is on the classpath.
if (generatedBy != null) {
CodeAnnotationMirror generatedByAnnotation = new CodeAnnotationMirror(generatedBy);
generatedByAnnotation.setElementValue(generatedByAnnotation.findExecutableElement("value"), new CodeAnnotationValue(generatedByType.asType()));
generatedType.addAnnotationMirror(generatedByAnnotation);
}
}
use of com.oracle.truffle.dsl.processor.java.model.CodeAnnotationMirror in project graal by oracle.
the class InstrumentableProcessor method createNodeChild.
private static CodeVariableElement createNodeChild(ProcessorContext context, TypeMirror type, String name) {
CodeVariableElement var = new CodeVariableElement(ElementUtils.modifiers(Modifier.PRIVATE), type, name);
var.addAnnotationMirror(new CodeAnnotationMirror((DeclaredType) context.getType(Child.class)));
return var;
}
Aggregations