Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deprecated Methods

 
prasad Venkat
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15284
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
prasad Venkat
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what about previous version of java
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15284
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Libraries like BCEL or ASM can tell you whether a method is deprecated.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic