How can I make a class deprecated

R

Rahul

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
 
B

Brzezi

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
 
H

Hendrik Maryns

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brzezi schreef:
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

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFGEPu7e+7xMGD3itQRAsacAJ9YdU7bJJKmdxukeTqCcdbZch0sAgCfbp0m
/1jnd0/bolI2nxmuhgr4Px4=
=5cPg
-----END PGP SIGNATURE-----
 
A

Adam Maass

Rahul said:
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 {
...
 
H

Hendrik Maryns

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Adam Maass schreef:
Use the @deprecated tag in a javadoc comment.


Example:

/** @deprecated */
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFGE1pDe+7xMGD3itQRApt0AJ0ctPIjyWeZubphhiROTPkHu+nkqQCeKz65
2LOLMa8ifc/VeLUlnXPyIxg=
=d1Vn
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top