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

Bug 346529

Summary: Don't show "The method * from the type * is never used locally" warning for private methods annotated with standard annotations like @PostConstruct
Product: [Eclipse Project] JDT Reporter: ivan.vergiliev
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: ivan.vergiliev, Olivier_Thomann, pwebster, remy.suen, srikanth_sankaran, stephan.herrmann
Version: 3.7Flags: srikanth_sankaran: review+
Target Milestone: 3.8 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed fix none

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.