use of japicmp.model.JApiAnnotationElement in project japicmp-gradle-plugin by melix.
the class Violation method describe.
public static String describe(JApiCompatibility member) {
if (member instanceof JApiAnnotation) {
return "Annotation " + ((JApiAnnotation) member).getFullyQualifiedName();
}
if (member instanceof JApiAnnotationElement) {
return "Annotation element " + ((JApiAnnotationElement) member).getName();
}
if (member instanceof JApiConstructor) {
JApiConstructor method = (JApiConstructor) member;
Optional<CtConstructor> changedMethod = method.getNewConstructor();
if (!changedMethod.isPresent()) {
changedMethod = method.getOldConstructor();
}
return "Constructor " + (changedMethod.isPresent() ? changedMethod.get().getLongName() : method.getName());
}
if (member instanceof JApiMethod) {
JApiMethod method = (JApiMethod) member;
Optional<CtMethod> changedMethod = method.getNewMethod();
if (!changedMethod.isPresent()) {
changedMethod = method.getOldMethod();
}
return "Method " + (changedMethod.isPresent() ? changedMethod.get().getLongName() : method.getName());
}
if (member instanceof JApiField) {
return "Field " + ((JApiField) member).getName();
}
if (member instanceof JApiClass) {
return "Class " + ((JApiClass) member).getFullyQualifiedName();
}
if (member instanceof JApiSuperclass) {
Optional<JApiClass> jApiClass = ((JApiSuperclass) member).getJApiClass();
return "Superclass " + (jApiClass.isPresent() ? jApiClass.get() : "[removed]");
}
if (member instanceof JApiImplementedInterface) {
return "Implemented interface " + ((JApiImplementedInterface) member).getFullyQualifiedName();
}
return member.toString();
}
Aggregations