Reputation: 9958
I have a java program like this:
public class Demo {
/**
* @deprecated use of func is discouraged.
*/
@Deprecated
static void func() {}
public static void main(String[] args){
func();
}
}
Why when I try to compile it using javac
, it does not give me any warnings.
Upvotes: 2
Views: 286
Reputation: 24855
http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/deprecation/deprecation.html
It says
Using the annotation causes the Java compiler to generate warnings when the deprecated class, method, or field is used. The compiler suppresses deprecation warnings if a deprecated compilation unit uses a deprecated class, method, or field. This enables you to build legacy APIs without generating warnings.
If you compile your class, you see that you are using a deprecated method. The issue is when you compile a class that uses a deprecated method.
Upvotes: 10