use of org.eclipse.jdt.core.dom.MarkerAnnotation in project lombok by rzwitserloot.
the class PatchValEclipse method createValAnnotation.
public static MarkerAnnotation createValAnnotation(AST ast, Annotation original, int start, int end) {
MarkerAnnotation out = null;
try {
out = Reflection.markerAnnotationConstructor.newInstance(ast);
} catch (InstantiationException e) {
throw Lombok.sneakyThrow(e);
} catch (IllegalAccessException e) {
throw Lombok.sneakyThrow(e);
} catch (InvocationTargetException e) {
throw Lombok.sneakyThrow(e);
}
if (out != null) {
SimpleName valName = ast.newSimpleName("val");
valName.setSourceRange(start, end - start + 1);
if (original.type instanceof SingleTypeReference) {
out.setTypeName(valName);
setIndex(valName, 1);
} else {
SimpleName lombokName = ast.newSimpleName("lombok");
lombokName.setSourceRange(start, end - start + 1);
setIndex(lombokName, 1);
setIndex(valName, 2);
QualifiedName fullName = ast.newQualifiedName(lombokName, valName);
setIndex(fullName, 1);
fullName.setSourceRange(start, end - start + 1);
out.setTypeName(fullName);
}
out.setSourceRange(start, end - start + 1);
}
return out;
}
Aggregations