use of com.google.auto.common.Visibility in project auto by google.
the class ExtensionClassTypeSpecBuilder method annotationVisibleFrom.
// TODO(b/122509249): Move code copied from com.google.auto.value.processor to auto-common.
private boolean annotationVisibleFrom(AnnotationMirror annotation, Element from) {
Element annotationElement = annotation.getAnnotationType().asElement();
Visibility visibility = Visibility.effectiveVisibilityOfElement(annotationElement);
switch(visibility) {
case PUBLIC:
return true;
case PROTECTED:
// subclass of anything.
return getPackage(annotationElement).equals(getPackage(from)) || types.isSubtype(from.asType(), annotationElement.getEnclosingElement().asType());
case DEFAULT:
return getPackage(annotationElement).equals(getPackage(from));
default:
return false;
}
}
use of com.google.auto.common.Visibility in project auto by google.
the class AutoValueishProcessor method annotationVisibleFrom.
private boolean annotationVisibleFrom(AnnotationMirror annotation, Element from) {
Element annotationElement = annotation.getAnnotationType().asElement();
Visibility visibility = Visibility.effectiveVisibilityOfElement(annotationElement);
switch(visibility) {
case PUBLIC:
return true;
case PROTECTED:
// subclass of anything.
return getPackage(annotationElement).equals(getPackage(from)) || typeUtils().isSubtype(from.asType(), annotationElement.getEnclosingElement().asType());
case DEFAULT:
return getPackage(annotationElement).equals(getPackage(from));
default:
return false;
}
}
Aggregations