SI-4788/SI-5948 Respect RetentionPolicy of Java annotations

I'm gone with the `.flatten.getOrElse(AnnotationRetentionPolicyClassValue)` for you.