Javadoc bug: @link can't handle Generics “<>”

狂风中的少年 提交于 2019-11-29 02:51:37

The parameterized types are NOT part of the method's signature.

Java implements Generics with Type Erasure. The concept of Type Erasure is that the generic types are only available at compile time, at which point they are "erased"; meaning they are stripped from the class's bytecode. Thus they are not accessible at runtime and are not part of method's signature.

So, there's no real reason for them to be part of the Javadoc link's signature, because you cannot overload two methods with generic types that resolve to the same raw types: there cannot be an ambiguity on the generic types in your source's signature.

Additionally, Javadoc supports HTML tags and I assume this could be another reason why it bites the dust here, but I really doubt the Javadoc processing tool was this badly implemented.

Similar to David Conrad solution, you can use the full signature as a link description, using syntax:

{@link class#method(signature) text-to-display}

Remember to escape < and >. For example:

 {@link #parse(Map, String, String) parse(Map&lt;String, String&gt;, String, String)}

It may not be what you're looking for, but I have learnt to live with something like * @return {@link List} of {@link RfRequestSummaryDto}

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!