Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 350128

Summary: [1.7] [clean up] to add @SafeVarargs annotation to method declarations where necessary
Product: [Eclipse Project] JDT Reporter: Deepak Azad <deepakazad>
Component: UIAssignee: Deepak Azad <deepakazad>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P5 CC: deepakazad, markus.kell.r
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Deepak Azad CLA 2011-06-23 06:44:33 EDT
This clean up can go in 'Clean up > Missing Code > Add missing Annotations'.
Comment 1 Markus Keller CLA 2011-06-23 07:08:43 EDT
We should not add this.

The @SafeVarargs annotation is used very rarely (only 4 times in the whole rt.jar).

Furthermore, the annotation is only valid on methods where "the body of the annotated method or constructor does not perform potentially unsafe operations on its varargs parameter". This analysis is not trivial, and it's not worth spending time on the implementation for such a rarely used feature.

Moreover, the effects of cleanup changes should be safe enough that they can usually be applied without review from the user. But an @SafeVarargs declaration has an effect on every call site of the method, so this is not a small change.
Comment 2 Deepak Azad CLA 2011-06-23 07:20:38 EDT
(In reply to comment #1)
> Furthermore, the annotation is only valid on methods where "the body of the
> annotated method or constructor does not perform potentially unsafe operations
> on its varargs parameter". This analysis is not trivial, and it's not worth
> spending time on the implementation for such a rarely used feature.
hmm.. agree.