Mark as deprecated third-party class

I have a third-party Foo library with the FooBar class. I think the FooBar class is poorly designed. I want to write my own MyBar as an adapter template. Is it possible to mark the source FooBar as @Deprecatedwithout changing its code?

+5
source share
4 answers

@deprecatedshould be added to the source so that the class / method flag is obsolete. Therefore, you cannot judge the code of another.

However, if you have a better alternative that you prefer to use as your standard in your project, then you can apply this standard in other ways, usually in checkstyle , for example.

+2

,

+3

Alternatively, use the IDE feature to search for links to find all the places where your code uses the intruder class. Or use "grep".

+2
source

Of course, you can modify the class file by adding deprecated annotation to the class. (But I do not own the tools necessary for this.)

+1
source

All Articles