Breandán Dalton
Breandán Dalton

Reputation: 1639

Deprecating a method, and linking to a class in a different library

I want to deprecate a method because I want to use a method from a different class in a different library (jar) that provides more standardization.

What I'd like to write is something like this:

class MyClass {

/**
 * @deprecated use {@link com.othercompany.theirmodule.TheirClass.bar() }
 */
@Deprecated
void foo() {
...
}

However the class TheirClass belongs to another jar altogether. Must I add a dependency on their module just for the link in the javadoc 'deprecated' tag?

Upvotes: 0

Views: 1309

Answers (1)

invenit
invenit

Reputation: 424

@link is a javadoc tag. It is used to generate documentation from source code with javadoc utility. It is also used by modern IDEs, e.g. Ctrl+Q in IntelliJ IDEA to display documentation about class/method under cursor.

But this is just a comment. IDE may highlight it with red if ThierClass is not visible or does not have such method, but this is not an error for a compiler.

Upvotes: 1

Related Questions