Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347786 - [1.7][quick fix] Quick fixes for new warnings/errors corresponding to @SafeVarargs annotation
Summary: [1.7][quick fix] Quick fixes for new warnings/errors corresponding to @SafeVa...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.7.1   Edit
Assignee: Deepak Azad CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-31 10:03 EDT by Deepak Azad CLA
Modified: 2011-08-02 05:45 EDT (History)
3 users (show)

See Also:


Attachments
fix + tests (27.88 KB, patch)
2011-05-31 10:03 EDT, Deepak Azad CLA
no flags Details | Diff
rtstubs17.jar - zipped and compressed (deleted)
2011-05-31 10:12 EDT, Deepak Azad CLA
no flags Details
fix + tests (36.26 KB, patch)
2011-06-02 10:44 EDT, Deepak Azad CLA
no flags Details | Diff
final fix + tests (40.42 KB, patch)
2011-06-09 00:03 EDT, Deepak Azad CLA
no flags Details | Diff
additional fixes (7.06 KB, patch)
2011-06-16 11:40 EDT, Markus Keller CLA
no flags Details | Diff
Additional tests (4.32 KB, patch)
2011-06-17 00:48 EDT, Deepak Azad CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Deepak Azad CLA 2011-05-31 10:03:40 EDT
Created attachment 196983 [details]
fix + tests

The patch includes the following 3 quick fixes and tests
- Add @SafeVarargs
- Add @SafeVarargs to method declaration
- Remove @Safevargs

Currently the second quick fix only works when the declaration is in the same file. Not sure if a quick fix should modify another file (when it is invoked from the editor). If yes, should the other file be opened in an editor ?

Changes to test with 1.7 compliance level
- Use rtstubs17.jar in ProjectTestSetup. (ProjectTestSetup still sets the compiler compliance level as 1.5)
- Add helper methods in JavaProjectHelper to set compiler compliance level to 1.7. (These helper methods are then used from individual tests which need 1.7 compiler compliance)
Comment 1 Deepak Azad CLA 2011-05-31 10:12:41 EDT
Created attachment 196985 [details]
rtstubs17.jar - zipped and compressed
Comment 2 Markus Keller CLA 2011-06-01 10:08:58 EDT
> Not sure if a quick fix should modify another file (when it is invoked
> from the editor). If yes, should the other file be opened in an editor ?

Yes, it should open and modify the other file. See other quick fixes that do the same and reuse their implementation (try with e.g. a wrong field type or method return type, modifiers, etc.).
Comment 3 Deepak Azad CLA 2011-06-02 10:44:32 EDT
Created attachment 197232 [details]
fix + tests

(In reply to comment #2)
> Yes, it should open and modify the other file. See other quick fixes that do
> the same and reuse their implementation (try with e.g. a wrong field type or
> method return type, modifiers, etc.).
Thanks! 'Add @SafeVarargs to method declaration' quick assist now works even when the declaration is in a different file.

Markus, if you are ok with the following changes I will release the patch.
> Changes to test with 1.7 compliance level
> - Use rtstubs17.jar in ProjectTestSetup. (ProjectTestSetup still sets the
> compiler compliance level as 1.5)
> - Add helper methods in JavaProjectHelper to set compiler compliance level to
> 1.7. (These helper methods are then used from individual tests which need 1.7
> compiler compliance)
Comment 4 Eclipse Webmaster CLA 2011-06-07 09:05:39 EDT
The content of attachment 196985 [details] has been deleted by
    Eclipse Webmaster <webmaster@eclipse.org>
who provided the following reason:

Request to Webmaster.

The token used to delete this attachment was generated at 2011-06-07 09:05:23 EDT.
Comment 5 Deepak Azad CLA 2011-06-09 00:03:32 EDT
Created attachment 197663 [details]
final fix + tests
Comment 6 Deepak Azad CLA 2011-06-09 00:04:12 EDT
Fixed in BETA_JAVA7
Comment 7 Markus Keller CLA 2011-06-16 11:40:44 EDT
Created attachment 198124 [details]
additional fixes

- added null checks to resolved bindings and calls to ASTResolving.find(..)
- changed quick fix name to "Add @SafeVarargs to ''{0}(..)''". We always mention the other method when the quick fix changes remote methods.

Released to BETA_JAVA7.
Comment 8 Deepak Azad CLA 2011-06-17 00:48:59 EDT
Created attachment 198157 [details]
Additional tests

(In reply to comment #7)
> - added null checks to resolved bindings and calls to ASTResolving.find(..)
> - changed quick fix name to "Add @SafeVarargs to ''{0}(..)''". We always
> mention the other method when the quick fix changes remote methods.

Thanks Markus! I have updated the tests for the change in the quick fix label and also added a couple of new tests.

Released to BETA_JAVA7.
Comment 9 Jay Arthanareeswaran CLA 2011-07-20 04:49:49 EDT
Verified