con*_*ile 4 java generics javadoc
我有一个javadoc代码块,我想编写一个包含这样的泛型的代码示例:
public interface SomeInterface <T> { }
public interface SomeInterface extends SomeOtherInterface<T> { }
Run Code Online (Sandbox Code Playgroud)
这是我的javadoc块:
/**
* Get the Generic Type T of a Type (Class/Interface) or extended/inherited Subtype:
* <pre>
* {@code
* public interface SomeInterface <T> { }
* public interface SomeInterface extends SomeOtherInterface<T> { }
* }
* </pre>
* @param implType
* @param parentType
* @return
*/
public static JClassType findGenericType(JClassType implType, JClassType parentType) { ... }
Run Code Online (Sandbox Code Playgroud)
javadoc输出是:
Get the Generic Type T of a Type (Class/Interface) or extended/inherited Subtype:
public interface SomeInterface { }
public interface SomeInterface extends SomeOtherInterface { }
}
Parameters:
implType
parentType
Returns:
Run Code Online (Sandbox Code Playgroud)
输出中缺少Generic.
如何让javadoc正确显示泛型?
Java doc呈现为HTML,因此angular bracket(<>)之间的任何内容都将被解释为HTML标记,并且不会作为文本打印.您可以使用<,并>以呈现HTML <和>分别为:
/**
* Get the Generic Type T of a Type (Class/Interface) or extended/inherited Subtype:
* <pre>
* {@code
* public interface SomeInterface <T> { }
* public interface SomeInterface extends SomeOtherInterface<T> { }
* }
* </pre>
* @param implType
* @param parentType
* @return
*/
Run Code Online (Sandbox Code Playgroud)