Bug 21682 - marking a method deprecated doesn't eleminate deprecated warning
Summary: marking a method deprecated doesn't eleminate deprecated warning
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-18 06:11 EDT by Ilja Preuss CLA
Modified: 2002-07-18 08:12 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilja Preuss CLA 2002-07-18 06:11:56 EDT
Consider the following two classes:

public class Foo {
  /** @deprecated */
  public static String foo;
}

public class Bar {
  /** @deprecated */
  public void bar() {
    System.out.println(Foo.foo);
  }
}

The compiler shows a deprecated warning for the usage of Foo.foo in Bar.bar(), 
even though Bar.bar() itself is marked deprecated, which should eleminate the 
warning.
Comment 1 Philipe Mulet CLA 2002-07-18 08:12:08 EDT
The fact it is deprecated itself doesn't give it more permission to invoke 
deprecated members.

javac issues the same warning:

p\Bar.java:6: warning: foo in p.Foo has been deprecated
    System.out.println(Foo.foo);
                          ^
1 warning

(javac only issues deprecation warnings for files compiled separately, so you 
need to compile the 2 files in 2 steps to see it).