Bug 124346

Summary: [1.5][compiler] Unexpected deprecation warning when @deprecated tag and @Deprecated annotation are mixed
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.2 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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)