Is there something special to the @Deprecated
annotation that I cannot reproduce?
I need to create an annotation similar to @Deprecated
to produce warnings in Eclipse and also at build time. When I mark a method as @Deprecated
I get nice warnings. For example, if I have an old method (that I may still keep for compatibility reasons):
@Deprecated
public List<Account> getClientAccounts(final int clientId) {
// Implement search...
}
Then, if I try to use it in Eclipse I can see it strikethrough, and a yellow icon in the left bar:
Also when building I can see the:
[WARNING] app1/src/test/java/com/app1/MyApp.java: app1/src/test/java/com/app1/MyApp.java uses or overrides a deprecated API.
Now, depending on external factors I cannot control (e.g. absence of database indexes) some methods are not optimal, and I would like to clearly mark them as such... with my brand new @NonOptimal
annotation. I need to add visibility to the problem. So far I have:
@Retention(RUNTIME)
@Target(METHOD)
// What else here?
public @interface NonOptimal {
}
How can I create this annotation?