Bug 159709 - [compiler] missing warnings for deprecated member types
Summary: [compiler] missing warnings for deprecated member types
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M3   Edit
Assignee: Maxime Daniel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-04 07:49 EDT by David Audel CLA
Modified: 2006-10-30 14:13 EST (History)
0 users

See Also:


Attachments
Fix + test cases tuning (4.62 KB, patch)
2006-10-12 02:53 EDT, Maxime Daniel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2006-10-04 07:49:11 EDT
build I20061003-0800

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() {
  }
}

When i do a full build of a workspace with these two class there is no warning.
But if i edit M1 and do an incremental build then the warnings to signal deprecated references are present.
Comment 1 David Audel CLA 2006-10-04 07:50:34 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();
  }
}
Comment 2 David Audel CLA 2006-10-04 09:36:06 EDT
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();
  }
}
Comment 3 Maxime Daniel CLA 2006-10-11 11:58:11 EDT
Reproduced.
Added DeprecatedTest#test015 to 018, Deprecated15Tests#test002 and DependencyTests#test0100, of which all but two are inactive.
Comment 4 Maxime Daniel CLA 2006-10-12 02:52:35 EDT
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.
Comment 5 Maxime Daniel CLA 2006-10-12 02:53:31 EDT
Created attachment 51832 [details]
Fix + test cases tuning
Comment 6 Maxime Daniel CLA 2006-10-16 04:03:38 EDT
Released for 3.3 M3.
Comment 7 Philipe Mulet CLA 2006-10-17 07:09:08 EDT
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;
			}
		}
	}
}
Comment 8 Philipe Mulet CLA 2006-10-17 07:09:25 EDT
What about local types ?
Comment 9 Maxime Daniel CLA 2006-10-17 07:58:24 EDT
Opened bug 161214 for fup items.
Comment 10 Olivier Thomann CLA 2006-10-30 14:13:04 EST
Verified for 3.3 M3 using warm-up build I20061030-0800