Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

@SuppressWarnings("deprecation") is not working as described in the Tutoria

807599Jan 22 2007 — edited Jan 22 2007
@SuppressWarnings("deprecation") is not suppressing warnings when I compile the below code on SDK 1.6.0. This code is copied straight from the Java Tutorial page at http://java.sun.com/docs/books/tutorial/java/javaOO/QandE/annotations-answers.html

Any hints would be appreciated.

Thank you,

Andrew Bloss
public class MyHouse implements House { 
    @SuppressWarnings("deprecation")
    public void open() {} 
    public void openFrontDoor() {}
    public void openBackDoor() {}
}
I get the message
"MyHouse.java uses or overrides a deprecated API."

I copied both the interface and the code from the tutorial page. The message does appear if I replace
@SuppressWarnings("deprecation")
with
@Deprecated
.
The interfac is
public interface House { 
    /**
     * @deprecated use of open is discouraged, use
     * openFrontDoor or openBackDoor instead.
     */
    @Deprecated
    public void open(); 
    public void openFrontDoor();
    public void openBackDoor();
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 19 2007
Added on Jan 22 2007
14 comments
1,247 views