Skip to content

Allow @return statements to begin with an acronym #468

@sbrannen

Description

@sbrannen

SpringJavadocCheck currently rejects any @return statement that begins with a capital letter.

private void checkTagCase(DetailAST ast, TextBlock javadoc) {
String[] text = javadoc.getText();
for (int i = 0; i < text.length; i++) {
for (Pattern pattern : CASE_CHECKED_TAG_PATTERNS) {
Matcher matcher = pattern.matcher(text[i]);
if (matcher.find()) {
String description = matcher.group(1).trim();
if (startsWithUppercase(description)) {
log(javadoc.getStartLineNo() + i, text[i].length() - description.length(), "javadoc.badCase");
}
}
}
}
}

However, it is sometimes useful to be able to begin the statement with an acronym such as "HTML", "URL", "JNDI", "JNI", etc.

In Spring Framework, I recently changed Javadoc from@return jni hints to @return JNI hints, and that caused the build to fail.

To address that, I had to suppress SpringJavadocCheck for the entire affected class.

Thus, it would be nice if checkTagCase() allowed the first "word" to be all-caps (i.e., and acronym).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions