Bug 346529 - Don't show "The method * from the type * is never used locally" warning for private methods annotated with standard annotations like @PostConstruct
Summary: Don't show "The method * from the type * is never used locally" warning for p...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: 3.8 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-19 15:11 EDT by ivan.vergiliev CLA
Modified: 2011-09-13 04:34 EDT (History)
6 users (show)

See Also:
srikanth_sankaran: review+


Attachments
Proposed fix (17.58 KB, patch)
2011-08-25 09:59 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ivan.vergiliev CLA 2011-05-19 15:11:51 EDT
Build Identifier: Build ID: 20110124_1224

The annotation @PostConstruct allows any visibility for the marked method. However, if set to private, Eclipse emits a "never used locally" warning, although the method will be invoked because of the annotation. I think this warning should be disabled for standard annotations.

Reproducible: Always
Comment 1 Olivier Thomann CLA 2011-05-19 15:17:25 EDT
Could be a nice addition indeed.
Comment 2 Olivier Thomann CLA 2011-08-24 12:13:21 EDT
What other annotations beside PostConstruct would you like to see supported ?
Comment 3 Remy Suen CLA 2011-08-24 13:01:58 EDT
Would also be nice to support @PreDestroy.
Comment 4 Olivier Thomann CLA 2011-08-25 09:49:19 EDT
Ok, these are the two annotations part of the JDK that I also found on my side.
Comment 5 Olivier Thomann CLA 2011-08-25 09:59:14 EDT
Created attachment 202153 [details]
Proposed fix

I'll add regression test once this is reviewed.
Comment 6 Olivier Thomann CLA 2011-08-25 09:59:56 EDT
Srikanth, please review to make sure I didn't forget any location where standard annotations must be handled.
Comment 7 Olivier Thomann CLA 2011-08-31 16:19:20 EDT
Released for 3.8M2.
Regression tests will be added once the code is reviewed.
Comment 8 Srikanth Sankaran CLA 2011-09-13 04:34:13 EDT
Verified for 3.8M2 using build id: I20110912-0800.