Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't @SafeVarags be applied to instance methods in a final class?

According to the documentation of SafeVarargs, the @SafeVarargs annotation can be applied only to constructors or variable arity methods that are either static or final. This is, I have read, to eliminate issues with annotation inheritance; that is to say, annotations on methods are only allowed if the method cannot be overridden. Clearly, constructors, static methods, and final methods cannot be overridden. However, neither can private methods or methods in a final class. Someone has complained about the inability to designate @SafeVarargs private methods, but neither of these issues has been addressed. In general, no one really seems to care. Am I missing something? Am I complaining about something that doesn't have any practical applications? Or... ?

like image 880
Radon Rosborough Avatar asked Nov 30 '14 00:11

Radon Rosborough


1 Answers

This is scheduled to be fixed in Java 9; see http://openjdk.java.net/jeps/213 .

like image 54
Louis Wasserman Avatar answered Sep 18 '22 08:09

Louis Wasserman