Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

How can I make a class deprecated

Thread view: 
Rahul - 02 Apr 2007 08:15 GMT
Hi

I want to make a class deprecated in my own API.

Please help me out.
Rahul
squirrel - 02 Apr 2007 08:37 GMT
> Hi
>
> I want to make a class deprecated in my own API.
>
> Please help me out.
> Rahul

Try use @deprecated,if it done notify me please.
Rahul - 02 Apr 2007 09:35 GMT
> > Hi
>
[quoted text clipped - 4 lines]
>
> Try use @deprecated,if it done notify me please.

Hi

I made two classes
1. Test.java

/**
  * my class descriptiption
  * @deprecated
  */
public class Test {

 public static void f() {
    System.out.print("I'm in deprecated Class");
 }
}

2. Test1.java

public class Test1 {
 public static void main(String[] args) {
   Test.f();
 }
}

on compiling I got the following message
C:\test>javac Test1.java
Note: Test1.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.

Thanks, for the solution
rahul
Brzezi - 02 Apr 2007 12:57 GMT
pon, 02 kwi 2007 o 10:35 GMT, Rahul napisał(a):

In java >=1.5 instead of doclet "@deprecated" you should use annotation
@Deprecated

@Deprecated
> public class Test {

Pozdrawiam
    Brzezi
Signature

[    E-mail: brzezi@enter.net.pl ][   <^demon>                                ]
[       Ekg: #3781111            ][   >>> You have been kicked off #linuxpl   ]
[ LinuxUser: #249916             ][   by Sand (BitchX BWK:  linuch)           ]

Hendrik Maryns - 02 Apr 2007 13:48 GMT
Brzezi schreef:
> pon, 02 kwi 2007 o 10:35 GMT, Rahul napisał(a):
>
[quoted text clipped - 3 lines]
> @Deprecated
>> public class Test {

Well, no: use both.  The javadoc still deserves the @deprecated tag,
with a reason to it.

H.
- --
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Adam Maass - 03 Apr 2007 17:00 GMT
> Hi
>
> I want to make a class deprecated in my own API.
>
> Please help me out.
> Rahul

Use the @deprecated tag in a javadoc comment.

Example:

/** @deprecated */
class {
  ...
Hendrik Maryns - 04 Apr 2007 08:56 GMT
Adam Maass schreef:

>> Hi
>>
[quoted text clipped - 10 lines]
> class {
>   ...

Or, as pointed out recently, in Java 1.5, use the @Deprecated
annotation.  This will create compiler warnings if the method is used.

H.
- --
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.