use of com.oracle.truffle.dsl.processor.java.model.CodeAnnotationMirror in project graal by oracle.
the class FixWarningsVisitor method createUnused.
private CodeAnnotationMirror createUnused() {
CodeAnnotationMirror mirror = new CodeAnnotationMirror(suppressWarnings);
mirror.setElementValue(mirror.findExecutableElement("value"), new CodeAnnotationValue("unused"));
return mirror;
}
use of com.oracle.truffle.dsl.processor.java.model.CodeAnnotationMirror in project graal by oracle.
the class GenerateOverrideVisitor method visitExecutable.
@Override
public Void visitExecutable(CodeExecutableElement e, Void p) {
if (!e.getModifiers().contains(Modifier.STATIC) && !e.getModifiers().contains(Modifier.PRIVATE)) {
String name = e.getSimpleName().toString();
TypeMirror[] params = e.getParameterTypes();
for (AnnotationMirror mirror : e.getAnnotationMirrors()) {
if (ElementUtils.typeEquals(overrideType, mirror.getAnnotationType())) {
// already declared (may happen if method copied from super class)
return super.visitExecutable(e, p);
}
}
if (isDeclaredMethodInSuperType(e.getEnclosingClass(), name, params)) {
e.addAnnotationMirror(new CodeAnnotationMirror(overrideType));
}
}
return super.visitExecutable(e, p);
}
use of com.oracle.truffle.dsl.processor.java.model.CodeAnnotationMirror in project graal by oracle.
the class FlatNodeGenFactory method createIsValid.
private Element createIsValid(TypeMirror assumptionType) {
CodeExecutableElement isValid = new CodeExecutableElement(modifiers(PRIVATE, STATIC), getType(boolean.class), "isValid_");
CodeTreeBuilder builder = isValid.createBuilder();
if (assumptionType.getKind() == TypeKind.ARRAY) {
isValid.addAnnotationMirror(new CodeAnnotationMirror(context.getDeclaredType(ExplodeLoop.class)));
isValid.addParameter(new CodeVariableElement(getType(Assumption[].class), "assumptions"));
builder.startIf().string("assumptions == null").end().startBlock().returnFalse().end();
builder.startFor().startGroup().type(((ArrayType) assumptionType).getComponentType()).string(" assumption : assumptions").end().end();
builder.startBlock();
builder.startIf().string("assumption == null || !assumption.isValid()").end();
builder.startBlock();
builder.returnFalse();
builder.end();
builder.end();
builder.returnTrue();
} else {
isValid.addParameter(new CodeVariableElement(getType(Assumption.class), "assumption"));
builder.startReturn().string("assumption != null && assumption.isValid()").end();
}
return isValid;
}
use of com.oracle.truffle.dsl.processor.java.model.CodeAnnotationMirror in project graal by oracle.
the class NodeFactoryFactory method create.
public CodeTypeElement create() {
Modifier visibility = ElementUtils.getVisibility(node.getTemplateType().getModifiers());
TypeMirror nodeFactory = ElementUtils.getDeclaredType(ElementUtils.fromTypeMirror(context.getType(NodeFactory.class)), node.getNodeType());
CodeTypeElement clazz = GeneratorUtils.createClass(node, null, modifiers(), factoryClassName(node), null);
if (visibility != null) {
clazz.getModifiers().add(visibility);
}
clazz.getModifiers().add(Modifier.FINAL);
if (createdFactoryElement != null) {
clazz.getImplements().add(nodeFactory);
CodeAnnotationMirror supressWarnings = new CodeAnnotationMirror(context.getDeclaredType(SuppressWarnings.class));
supressWarnings.setElementValue(supressWarnings.findExecutableElement("value"), new CodeAnnotationValue(Arrays.asList(new CodeAnnotationValue("unchecked"), new CodeAnnotationValue("rawtypes"))));
clazz.getAnnotationMirrors().add(supressWarnings);
clazz.add(createNodeFactoryConstructor());
clazz.add(createCreateGetNodeClass());
clazz.add(createCreateGetExecutionSignature());
clazz.add(createCreateGetNodeSignatures());
clazz.add(createCreateNodeMethod());
clazz.add(createGetInstanceMethod(visibility));
clazz.add(createInstanceConstant(clazz.asType()));
createFactoryMethods(clazz);
}
return clazz;
}
use of com.oracle.truffle.dsl.processor.java.model.CodeAnnotationMirror in project graal by oracle.
the class FixWarningsVisitor method createIgnoreDeprecations.
private CodeAnnotationMirror createIgnoreDeprecations() {
CodeAnnotationMirror mirror = new CodeAnnotationMirror(suppressWarnings);
mirror.setElementValue(mirror.findExecutableElement("value"), new CodeAnnotationValue("deprecation"));
return mirror;
}
Aggregations