use of com.thoughtworks.qdox.model.JavaTypeVariable in project maven-plugins by apache.
the class AbstractFixJavadocMojo method writeParamTag.
private void writeParamTag(final StringBuilder sb, final JavaExecutable javaExecutable, final JavaEntityTags javaEntityTags, List<String> params) {
String paramName = params.get(0);
if (!fixTag(PARAM_TAG)) {
// write original param tag if found
String originalJavadocTag = javaEntityTags.getJavadocParamTag(paramName);
if (originalJavadocTag != null) {
sb.append(originalJavadocTag);
}
return;
}
boolean found = false;
JavaParameter javaParam = javaExecutable.getParameterByName(paramName);
if (javaParam == null) {
// is generic?
List<JavaTypeVariable<JavaGenericDeclaration>> typeParams = javaExecutable.getTypeParameters();
for (JavaTypeVariable<JavaGenericDeclaration> typeParam : typeParams) {
if (typeParam.getGenericValue().equals(paramName)) {
found = true;
}
}
} else {
found = true;
}
if (!found) {
if (getLog().isWarnEnabled()) {
getLog().warn("Fixed unknown param '" + paramName + "' defined in " + getJavaMethodAsString(javaExecutable));
}
if (sb.toString().endsWith(EOL)) {
sb.delete(sb.toString().lastIndexOf(EOL), sb.toString().length());
}
} else {
String originalJavadocTag = javaEntityTags.getJavadocParamTag(paramName);
if (originalJavadocTag != null) {
sb.append(originalJavadocTag);
String s = "@" + PARAM_TAG + " " + paramName;
if (StringUtils.removeDuplicateWhitespace(originalJavadocTag).trim().endsWith(s)) {
sb.append(" ");
sb.append(getDefaultJavadocForType(javaParam.getJavaClass()));
}
}
}
}
Aggregations