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

why do we get a deprecation warning here?