in src/main/java/com/amazon/checkerframework/checker/data_classification/ClassificationPolymorphism.java [40:62]
protected void replace(
final AnnotatedTypeMirror type,
final AnnotationMirrorMap<AnnotationMirrorSet> replacements) {
if (type.hasAnnotation(atypeFactory.getPolyAnnotation())) {
AnnotationMirrorSet quals = replacements.get(atypeFactory.getPolyAnnotation());
type.replaceAnnotations(quals);
} else if (type.hasAnnotation(atypeFactory.getPolyUseAnnotation())) {
AnnotationMirrorSet quals = replacements.get(atypeFactory.getPolyAnnotation());
if (!quals.contains(atypeFactory.getPolyAnnotation())) {
type.replaceAnnotations(quals);
}
} else {
for (Map.Entry<AnnotationMirror, AnnotationMirrorSet> pqentry :
replacements.entrySet()) {
AnnotationMirror poly = pqentry.getKey();
if (type.hasAnnotation(poly)) {
type.removeAnnotation(poly);
AnnotationMirrorSet quals = pqentry.getValue();
type.replaceAnnotations(quals);
}
}
}
}