Tagir Valeev has proposed the following sensible treatment:
1. Do not allow annotating record type with SafeVarargs
2. If the record type has explicit canonical/compact constructor, the
heap pollution warning should be issued on the constructor, rather
than on record header declaration
3. If explicit canonical/compact constructor is annotated with
SafeVarargs, no warning should be issued.
So if one has a record declaration with potential heap pollution, and
want to declare that varargs are safe, they must explicitly add an
empty compact constructor and annotate it with SafeVarargs. Given that
this case should be extremely rare in practice, such an amount of
boilerplate doesn't look too big to me. On the other hand, such
solution requires less changes in Java (e.g. no need to allow
SafeVarargs on types).