J
jothi.padmanabhan
If I am using a deprecated class inside another class and use
SuppressWarnings("deprecation"), javac is working fine and does not
complain. However, if I have a method in my class that takes a
deprecated
class as a parameter, javac seems to ignore the suppression and
continues to
print the warning. Any ideas on how this could be solved?
$ cat A.java
@SuppressWarnings("deprecation")
public class A {
public void f1 () {
B b = new B("abc");
b.fun();
}
public void f2(B b) {
b.fun();
}
}
$ cat B.java
@Deprecated
public class B {
private String s;
public B(String str) { s = str;}
public void fun() { System.out.println(s);}
}
$ javac -g -verbose -Xlint A.java B.java
..
..
A.java:8: warning: [deprecation] B in unnamed package has been
deprecated
public void f2(B b) {
^
Is there a way to Suppress warnings when deprecated classes are used
as arguments as well?
Thanks,
Jothi
SuppressWarnings("deprecation"), javac is working fine and does not
complain. However, if I have a method in my class that takes a
deprecated
class as a parameter, javac seems to ignore the suppression and
continues to
print the warning. Any ideas on how this could be solved?
$ cat A.java
@SuppressWarnings("deprecation")
public class A {
public void f1 () {
B b = new B("abc");
b.fun();
}
public void f2(B b) {
b.fun();
}
}
$ cat B.java
@Deprecated
public class B {
private String s;
public B(String str) { s = str;}
public void fun() { System.out.println(s);}
}
$ javac -g -verbose -Xlint A.java B.java
..
..
A.java:8: warning: [deprecation] B in unnamed package has been
deprecated
public void f2(B b) {
^
Is there a way to Suppress warnings when deprecated classes are used
as arguments as well?
Thanks,
Jothi