aspose file tools*
The moose likes Java in General and the fly likes Deprecated Methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Deprecated Methods" Watch "Deprecated Methods" New topic
Author

Deprecated Methods

prasad Venkat
Ranch Hand

Joined: Oct 17, 2006
Posts: 32
how to identify deprecated methods at run time for java 1.4.2
[ November 09, 2006: Message edited by: prasad Venkat ]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14269
    
  21

Hello prasad,

Please change your display name first, as Henry asks you for the fourth time already. Click on the "My Profile" link at the top of the page, then click on "View/Update Profile" and change your name in the field "Publicly Displayed Name" to a name that conforms to the policy.

Done?

About your question: If you have deprecated methods that are deprecated using the @Deprecated annotation, then you can identify them at runtime by using reflection. The @Deprecated annotation has runtime retention. Example:

NOTE: Unfortunately this does not work if the method is deprecated by using the old style Javadoc @deprecated tag.
[ November 09, 2006: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
prasad Venkat
Ranch Hand

Joined: Oct 17, 2006
Posts: 32
what about previous version of java
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14269
    
  21

It's a lot harder for previous versions of Java, in which javadoc @deprecated tags are used. You could write a doclet and run the Javadoc tool on the source code to find the deprecated methods. If you don't have the source code, then I believe it is not possible to detect if a method is deprecated at runtime.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
Libraries like BCEL or ASM can tell you whether a method is deprecated.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Deprecated Methods