Bug 124346 - [1.5][compiler] Unexpected deprecation warning when @deprecated tag and @Deprecated annotation are mixed
Summary: [1.5][compiler] Unexpected deprecation warning when @deprecated tag and @Depr...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-18 13:41 EST by Frederic Fusier CLA
Modified: 2006-02-15 06:43 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Fusier CLA 2006-01-18 13:41:51 EST
Here's the test case:

p2/I.java
  package p2;
  /** @deprecated */
  interface I {}

p1/X.java
  package p1;
  public class X {
        @Deprecated
        class Y implements p2.I {}
  }

I expected not to have any warning but got one in X.java saying that p2.I is
deprecated...

Note that replacing @Deprecated annotation by /** @deprecated */ javadoc tag
fixes the problem:
p2/I.java
  /** @deprecated */
  interface I {}

p1/X.java
  package p1;
  public class X {
        /** deprecated */
        class Y implements p2.I {}
  }
Comment 1 Philipe Mulet CLA 2006-01-19 09:33:02 EST
Added AnnotationTest#test186 (disabled).
Problem comes from the fact that the deprecation warning is reported while connecting member type hierarchy, which is a stage at which @Deprecated hasn't yet been resolved; thus warning cannot be silenced.

Could be addressed by ensuring #resolveSuperType never does perform any deprecation check, and deferring it to later point.
Comment 2 Philipe Mulet CLA 2006-01-19 17:20:42 EST
Also see AnnotationTest#test187 for a variation on same topic using import references.
Comment 3 Philipe Mulet CLA 2006-01-20 03:30:53 EST
Tuned Scope#isInsideDeprecatedCode() to lazily request init of @Deprecated annotation before checking deprecated flag.

Fixed, enabled AnnotationTest#test186-187
Comment 4 Jerome Lanneluc CLA 2006-02-15 06:43:26 EST
Verified for 3.2 M5 using build I20060215-0010
(note that interface I has to be public for the original test case to compiler without error)