Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do you deprecate a class, and/or a method?

 
Jonathan Baker
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to deprecate a method, and I wasn't exactly sure how to do that. I thought it would just be some keyword like static, private, etc. but it looks as though that is not the case.
 
Julia Reynolds
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to use javadoc commenting. You add the @deprecated tag
to denote it. The compiler parses it out.
Julia
 
Jonathan Baker
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
 
rani bedi
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does the compiler knows that the depreciated method is being used (since whenever we try to compile a code using some depreciated method we recieve a warning message)
How can I do it in my code?
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The compiler reads the JavaDoc parameters.
Read this article: http://java.sun.com/j2se/1.3.0/docs/guide/misc/deprecation/deprecation.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic