1

I'm trying to generate a Javadoc for my project, but I can't seem to find how to create a link to a precise Method :

public static Html select(Buffer<String> contentBuffer, String id, String name, String classes, boolean isMultiple, String[]... attributeList)

I tried :

{@link #select(Buffer, String, String, String, boolean, String:A...) select()}
{@link #select(Buffer, String, String, String, boolean, String[]...) select()}

But there are no link created at all ... I get the error error: unexpected text on the link tag.

Am I missing something?

EDIT : I already know how to form a valid {@link}, but for some reason, it doesn't work here ...

user207421
  • 305,947
  • 44
  • 307
  • 483
Zenoo
  • 12,670
  • 4
  • 45
  • 69
  • 1
    Possible duplicate of [How to reference a method in javadoc?](https://stackoverflow.com/questions/5915992/how-to-reference-a-method-in-javadoc) – Georg Leber Jan 25 '18 at 15:01
  • @GeorgHenkel : As you can clearly see, I already followed the rules of the `{@link ...}` in my attempts to solve my problem. Why would you link me this ? ... – Zenoo Jan 25 '18 at 15:02
  • `{@link #select(Buffer, String, String, String, boolean, String[]...)}` seems good to me – Oleg Cherednik Jan 25 '18 at 15:03
  • @oleg.cherednik It seemed good to me too, but I always get the same error. – Zenoo Jan 25 '18 at 15:04
  • You may use an IDE that is capable of generating javadoc. They will suggest all possibilities with correct syntax in drop-down boxes and stuff like that. Very convenient. – Zabuzard Jan 25 '18 at 15:04
  • What IDE are you using? – cincy_anddeveloper Jan 25 '18 at 15:10
  • Ok, sorry you are right. In Eclipse your example works. – Georg Leber Jan 25 '18 at 15:11
  • I'm using Eclipse but the project isn't local, I'm using the Remote System Explorer to work. So the project isn't really considered as an Eclipse Project, just files packed together. So I can't use any functionality related to an Eclipse Project. – Zenoo Jan 25 '18 at 15:11
  • What is you JDK version? – yegodm Jan 25 '18 at 15:21
  • @yegodm I am running the v1.8.0_60 – Zenoo Jan 25 '18 at 15:25
  • 1
    It might be a bug with 1.8 - with 1.8.0_162 I sort of get invalid link too. With 9.0.1 the link is properly generated. – yegodm Jan 25 '18 at 15:27
  • @yegodm Well that's a bummer ... I guess I'll have to create the link manually then ... – Zenoo Jan 25 '18 at 15:35
  • Do you really want an array of array of `String`? Then you can try changing the `attributeList` parameter reference in the `@link` from `String[]...` to `String[][]`. Seems it works with jdk8. – yegodm Jan 25 '18 at 16:20
  • Might be a regression of https://bugs.java.com/bugdatabase/view_bug.do?bug_id=5006659 – yegodm Jan 25 '18 at 16:26
  • No, I can't, I need a vararg. But I'll try to link it as a [][] in the Javadoc, to see if it works – Zenoo Jan 25 '18 at 16:51
  • @yegodm `String[][]` works for the vararg ... You can post it as an answer, I'll accept it. – Zenoo Jan 26 '18 at 08:11

2 Answers2

1

In java-8 (possibly due to a regression of a very old javadoc bug) a @link declaration does not render link properly when the fragment part of the link URL uses ellipsis "..." to denote the varargs parameter. Instead the array syntax should be used. So your link declaration

{@link #select(Buffer, String, String, String, boolean, String[]...) select()}

should be changed this way:

{@link #select(Buffer, String, String, String, boolean, String[][]) select()}

Also note, that in java-9 the bug is not reproducable.

yegodm
  • 1,014
  • 7
  • 15
-2

Shouldn't it be {@link #select(Buffer, String, String, String, boolean, String[]...) select} ?

RoadEx
  • 543
  • 2
  • 12