Java – why can’t @ safevarags be applied to instance methods in the final class?
According to the document of safevarargs, the @ safevarargs annotation can only be applied to static or final constructors or variable arity methods This is I have read, which is used to eliminate the problem of annotation inheritance; That is, methods are only allowed to be annotated if they cannot be overridden Obviously, constructors, static methods, and final methods cannot be overridden However, none of the private methods or methods in the final class can Someone has complicated about @ safevarargs private method cannot be specified, but neither of these issues has been addressed Generally speaking, no one really sees to care What did I miss? Do I complain that there is no practical application? Or?
Solution
This is planned to be fixed in Java 9; See http://openjdk.java.net/jeps/213.