How to reference overloaded methods in Javadoc comments?

I have method overloads and you want to provide links in your Javadoc comments to others. But I have problems with generics and / or varargs. I was hoping I could write like this:

/**
 * @see {@link #method(Object[], Object[])}
 * @see {@link #method(Collection, Object[])}
 */
public <T> void method(T object, T... furtherObjects) {}

/**
 * @see {@link #method(Object, Object[])}
 * @see {@link #method(Collection, Object[])}
 */
public <T> void method(T[] objects, T... furtherObjects) {}

/**
 * @see {@link #method(Object[], Object[])}
 * @see {@link #method(Collection, Object[])}
 */
public <T> void method(Collection<T> objects, T... furtherObjects) {}

But each link leads to the first method. Using Eclipse.

+4
source share

Source: https://habr.com/ru/post/1669482/


All Articles