/** {@inheritDoc} */ public int compareTo(AnnotationDirectoryItem o) { Preconditions.checkNotNull(o); TypeIdItem parentType = getParentType(); TypeIdItem otherParentType = o.getParentType(); if (parentType != null) { if (otherParentType != null) { return parentType.compareTo(otherParentType); } return 1; } if (otherParentType != null) { return -1; } if (classAnnotations != null) { if (o.classAnnotations != null) { return classAnnotations.compareTo(o.classAnnotations); } return 1; } return -1; }