A DESCRIPTION OF THE PROBLEM :
Currently there exist restrictions on which methods @SafeVarargs can be used, namely final, static or private methods. This makes usage of varargs generic parameters for public non-static interface methods extremely annoying:
- The compiler issues a warning for the method declaration itself
- The compiler issues a warning for every usage of the method
Therefore it would be good to remove these @SafeVarargs restrictions and allow placing it on any varargs method. To provide additional safety, it could be enforced that every method overriding a method annotated with @SafeVarargs has to be annotated with @SafeVarargs itself as well (this is possible because the retention of @SafeVarags is RUNTIME).
The annotation already acts as a "I know what I am doing" indicator, but even with the current implementation it can be used incorrectly (Javadoc of SafeVarargs has an example for this). Therefore there is (most likely) no big difference in allowing its usage on all methods.