Summary: | [compiler] missing warnings for deprecated member types | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | David Audel <david_audel> | ||||
Component: | Core | Assignee: | Maxime Daniel <maxime_daniel> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | ||||||
Version: | 3.3 | ||||||
Target Milestone: | 3.3 M3 | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
David Audel
2006-10-04 07:49:11 EDT
With these two classes the deprected references are correctly detected in N1.java package p; public class M1 { public void foo() {} /** @deprecated */ public class M2 { public void foo() {} public class M3 { public void foo() {} } } void bar() { a.N1.N2.N3 m = null; m.foo(); } } package a; public class N1 { public void foo() {} /** @deprecated */ public class N2 { public void foo() {} public class N3 { public void foo() {} } } void bar() { p.M1.M2.M3 m = null; m.foo(); } } The bug is the same if you replace the javadoc tag by the @Deprecated annotation package p; public class M1 { public void foo() {} @Deprecated public class M2 { public void foo() {} public class M3 { public void foo() {} } } void bar() { a.N1.N2.N3 m = null; m.foo(); } } package a; public class N1 { public void foo() {} @Deprecated public class N2 { public void foo() {} public class N3 { public void foo() {} } } void bar() { p.M1.M2.M3 m = null; m.foo(); } } Reproduced. Added DeprecatedTest#test015 to 018, Deprecated15Tests#test002 and DependencyTests#test0100, of which all but two are inactive. The issue came from the fact that, in case of a forward reference to a member type, the deprecation detection started with the said member type and omitted to climb up the enclosing types chain to detect potential implicit deprecation. Created attachment 51832 [details]
Fix + test cases tuning
Released for 3.3 M3. I would have written the MemberTypeBinding override as: public void initializeDeprecatedAnnotationTagBits() { if ((this.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) == 0) { super.initializeDeprecatedAnnotationTagBits(); if ((this.tagBits & TagBits.AnnotationDeprecated) == 0) { // check enclosing for propagatin ReferenceBinding enclosing = this.enclosingType(); enclosing.initializeDeprecatedAnnotationTagBits(); if ((enclosing.modifiers & (ClassFileConstants.AccDeprecated | ExtraCompilerModifiers.AccDeprecatedImplicitly)) != 0) { this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; } } } } What about local types ? Opened bug 161214 for fup items. Verified for 3.3 M3 using warm-up build I20061030-0800 |