Issue #1566: Fix for SingleLineJavadoc's violations

This commit is contained in:
Baratali Izmailov 2015-08-31 11:48:56 -04:00
parent d410b2a21c
commit cf85a72f3d
26 changed files with 278 additions and 95 deletions

View File

@ -343,15 +343,14 @@
<property name="excludedClasses" value="boolean, byte, char, double, float, int, long, short, void, Boolean, Byte, Character, Double, Float, Integer, Long, Short, Void, Object, Class, String, StringBuffer, StringBuilder, ArrayIndexOutOfBoundsException, Exception, RuntimeException, IllegalArgumentException, IllegalStateException, IndexOutOfBoundsException, NullPointerException, Throwable, SecurityException, UnsupportedOperationException, List, ArrayList, Deque, Queue, LinkedList, Set, HashSet, SortedSet, TreeSet, Map, HashMap, SortedMap, TreeMap, DetailsAST, CheckstyleException, UnsupportedEncodingException, BuildException, ConversionException, FileNotFoundException, TestException, Log, Sets, Multimap, TokenStreamRecognitionException, RecognitionException, TokenStreamException, IOException"/>
</module>
<module name="SingleLineJavadoc"/>
<!--
All Checks bellow are our futute plan to enforce over our code.
All of them are activated for integration testing over our code.
All of them have ignore severity to avoid build failure for now.
As all violations are resolved Check need to got default severity as all other.
-->
<module name="SingleLineJavadoc">
<property name="severity" value="ignore"/>
</module>
<module name="SummaryJavadoc">
<property name="severity" value="ignore"/>
</module>

View File

@ -292,7 +292,9 @@ public class Checker extends AutomaticBean implements MessageDispatcher {
return errorCount;
}
/** @param basedir the base directory to strip off in filenames */
/**
* @param basedir the base directory to strip off in filenames
*/
public void setBasedir(String basedir) {
this.basedir = basedir;
}
@ -395,12 +397,16 @@ public class Checker extends AutomaticBean implements MessageDispatcher {
this.moduleFactory = moduleFactory;
}
/** @param localeCountry the country to report messages **/
/**
* @param localeCountry the country to report messages
*/
public void setLocaleCountry(String localeCountry) {
this.localeCountry = localeCountry;
}
/** @param localeLanguage the language to report messages **/
/**
* @param localeLanguage the language to report messages
*/
public void setLocaleLanguage(String localeLanguage) {
this.localeLanguage = localeLanguage;
}

View File

@ -123,7 +123,9 @@ public final class TreeWalker
setFileExtensions("java");
}
/** @param tabWidth the distance between tab stops */
/**
* @param tabWidth the distance between tab stops
*/
public void setTabWidth(int tabWidth) {
this.tabWidth = tabWidth;
}
@ -138,7 +140,9 @@ public final class TreeWalker
cache.load();
}
/** @param classLoader class loader to resolve classes with. */
/**
* @param classLoader class loader to resolve classes with.
*/
public void setClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}

View File

@ -123,7 +123,9 @@ public class CheckstyleAntTask extends Task {
failureProperty = propertyName;
}
/** @param fail whether to fail if a violation is found */
/**
* @param fail whether to fail if a violation is found
*/
public void setFailOnViolation(boolean fail) {
failOnViolation = fail;
}
@ -190,7 +192,9 @@ public class CheckstyleAntTask extends Task {
createClasspath().setRefid(classpathRef);
}
/** @return a created path for locating classes */
/**
* @return a created path for locating classes
*/
public Path createClasspath() {
if (classpath == null) {
classpath = new Path(getProject());
@ -198,17 +202,23 @@ public class CheckstyleAntTask extends Task {
return classpath.createPath();
}
/** @param file the file to be checked */
/**
* @param file the file to be checked
*/
public void setFile(File file) {
fileName = file.getAbsolutePath();
}
/** @param file the configuration file to use */
/**
* @param file the configuration file to use
*/
public void setConfig(File file) {
setConfigLocation(file.getAbsolutePath());
}
/** @param url the URL of the configuration to use */
/**
* @param url the URL of the configuration to use
*/
public void setConfigURL(URL url) {
setConfigLocation(url.toExternalForm());
}
@ -225,7 +235,9 @@ public class CheckstyleAntTask extends Task {
configLocation = location;
}
/** @param omit whether to omit ignored modules */
/**
* @param omit whether to omit ignored modules
*/
public void setOmitIgnoredModules(boolean omit) {
omitIgnoredModules = omit;
}
@ -598,27 +610,37 @@ public class CheckstyleAntTask extends Task {
/** The property value */
private String value;
/** @return the property key */
/**
* @return the property key
*/
public String getKey() {
return key;
}
/** @param key sets the property key */
/**
* @param key sets the property key
*/
public void setKey(String key) {
this.key = key;
}
/** @return the property value */
/**
* @return the property value
*/
public String getValue() {
return value;
}
/** @param value set the property value */
/**
* @param value set the property value
*/
public void setValue(String value) {
this.value = value;
}
/** @param file set the property value from a File */
/**
* @param file set the property value from a File
*/
public void setFile(File file) {
value = file.getAbsolutePath();
}
@ -629,12 +651,16 @@ public class CheckstyleAntTask extends Task {
/** Class name of the listener class */
private String className;
/** @return the class name */
/**
* @return the class name
*/
public String getClassname() {
return className;
}
/** @param name set the class name */
/**
* @param name set the class name
*/
public void setClassname(String name) {
className = name;
}

View File

@ -102,12 +102,16 @@ public final class AuditEvent
return localizedMessage.getMessage();
}
/** @return the column associated with the message **/
/**
* @return the column associated with the message
*/
public int getColumn() {
return localizedMessage.getColumnNo();
}
/** @return the audit event severity level **/
/**
* @return the audit event severity level
*/
public SeverityLevel getSeverityLevel() {
if (localizedMessage == null) {
return SeverityLevel.INFO;
@ -125,12 +129,16 @@ public final class AuditEvent
return localizedMessage.getModuleId();
}
/** @return the name of the source for the message **/
/**
* @return the name of the source for the message
*/
public String getSourceName() {
return localizedMessage.getSourceName();
}
/** @return the localized message **/
/**
* @return the localized message
*/
public LocalizedMessage getLocalizedMessage() {
return localizedMessage;
}

View File

@ -218,7 +218,9 @@ public abstract class Check extends AbstractViolationReporter {
return classLoader;
}
/** @return the tab width to report errors with */
/**
* @return the tab width to report errors with
*/
protected final int getTabWidth() {
return tabWidth;
}

View File

@ -210,7 +210,9 @@ public final class DetailAST extends CommonASTWithHiddenTokens {
return parent;
}
/** @return the line number **/
/**
* @return the line number
*/
public int getLineNo() {
int resultNo = -1;
@ -238,7 +240,9 @@ public final class DetailAST extends CommonASTWithHiddenTokens {
this.lineNo = lineNo;
}
/** @return the column number **/
/**
* @return the column number
*/
public int getColumnNo() {
int resultNo = -1;
@ -266,7 +270,9 @@ public final class DetailAST extends CommonASTWithHiddenTokens {
this.columnNo = columnNo;
}
/** @return the last child node */
/**
* @return the last child node
*/
public DetailAST getLastChild() {
DetailAST ast = getFirstChild();
while (ast != null && ast.getNextSibling() != null) {

View File

@ -231,7 +231,9 @@ public final class FileContents implements CommentListener {
return new FileText(text);
}
/** @return the lines in the file */
/**
* @return the lines in the file
*/
public String[] getLines() {
return text.toLinesArray();
}
@ -245,7 +247,9 @@ public final class FileContents implements CommentListener {
return text.get(index);
}
/** @return the name of the file */
/**
* @return the name of the file
*/
public String getFileName() {
return fileName;
}

View File

@ -51,17 +51,23 @@ public final class FullIdent {
private FullIdent() {
}
/** @return the text **/
/**
* @return the text
*/
public String getText() {
return StringUtils.join(elements, "");
}
/** @return the line number **/
/**
* @return the line number
*/
public int getLineNo() {
return lineNo;
}
/** @return the column number **/
/**
* @return the column number
*/
public int getColumnNo() {
return columnNo;
}

View File

@ -44,12 +44,16 @@ public class LineColumn implements Comparable<LineColumn> {
this.column = column;
}
/** @return the one-based line number */
/**
* @return the one-based line number
*/
public int getLine() {
return line;
}
/** @return the zero-based column number */
/**
* @return the zero-based column number
*/
public int getColumn() {
return column;
}

View File

@ -241,7 +241,9 @@ public final class LocalizedMessage
}
}
/** @return the translated message **/
/**
* @return the translated message
*/
public String getMessage() {
String message = getCustomMessage();
@ -299,22 +301,30 @@ public final class LocalizedMessage
}
}
/** @return the line number **/
/**
* @return the line number
*/
public int getLineNo() {
return lineNo;
}
/** @return the column number **/
/**
* @return the column number
*/
public int getColumnNo() {
return columnNo;
}
/** @return the severity level **/
/**
* @return the severity level
*/
public SeverityLevel getSeverityLevel() {
return severityLevel;
}
/** @return the module identifier. */
/**
* @return the module identifier.
*/
public String getModuleId() {
return moduleId;
}
@ -329,12 +339,16 @@ public final class LocalizedMessage
return key;
}
/** @return the name of the source for this LocalizedMessage */
/**
* @return the name of the source for this LocalizedMessage
*/
public String getSourceName() {
return sourceClass.getName();
}
/** @param locale the locale to use for localization **/
/**
* @param locale the locale to use for localization
*/
public static void setLocale(Locale locale) {
if (Locale.ENGLISH.getLanguage().equals(locale.getLanguage())) {
sLocale = Locale.ROOT;

View File

@ -32,7 +32,9 @@ public final class LocalizedMessages {
/** Contains the messages logged **/
private final Set<LocalizedMessage> messages = Sets.newTreeSet();
/** @return the logged messages **/
/**
* @return the logged messages
*/
public SortedSet<LocalizedMessage> getMessages() {
return Sets.newTreeSet(messages);
}
@ -50,7 +52,9 @@ public final class LocalizedMessages {
messages.add(aMsg);
}
/** @return the number of messages */
/**
* @return the number of messages
*/
public int size() {
return messages.size();
}

View File

@ -81,12 +81,16 @@ public abstract class AbstractFormatCheck
updateRegexp(format, compileFlags);
}
/** @return the regexp to match against */
/**
* @return the regexp to match against
*/
public final Pattern getRegexp() {
return regexp;
}
/** @return the regexp format */
/**
* @return the regexp format
*/
public final String getFormat() {
return format;
}

View File

@ -200,7 +200,9 @@ public abstract class AbstractTypeAwareCheck extends Check {
&& parent.isAssignableFrom(child);
}
/** @return {@code ClassResolver} for current tree. */
/**
* @return {@code ClassResolver} for current tree.
*/
private ClassResolver getClassResolver() {
if (classResolver == null) {
classResolver =
@ -403,12 +405,16 @@ public abstract class AbstractTypeAwareCheck extends Check {
name = className;
}
/** @return class name */
/**
* @return class name
*/
public final Token getName() {
return name;
}
/** @return {@code Class} associated with an object. */
/**
* @return {@code Class} associated with an object.
*/
public abstract Class<?> getClazz();
}
@ -522,17 +528,23 @@ public abstract class AbstractTypeAwareCheck extends Check {
columnNo = fullIdent.getColumnNo();
}
/** @return line number of the token */
/**
* @return line number of the token
*/
public int getLineNo() {
return lineNo;
}
/** @return column number of the token */
/**
* @return column number of the token
*/
public int getColumnNo() {
return columnNo;
}
/** @return text of the token */
/**
* @return text of the token
*/
public String getText() {
return text;
}

View File

@ -37,7 +37,9 @@ public class FileContentsHolder
/** The current file contents. */
private static final ThreadLocal<FileContents> FILE_CONTENTS = new ThreadLocal<>();
/** @return the current file contents. */
/**
* @return the current file contents.
*/
public static FileContents getContents() {
return FILE_CONTENTS.get();
}

View File

@ -471,27 +471,37 @@ public class SuppressWarningsHolder
this.lastColumn = lastColumn;
}
/** @return the source name of the suppressed check */
/**
* @return the source name of the suppressed check
*/
public String getCheckName() {
return checkName;
}
/** @return the first line of the suppression region */
/**
* @return the first line of the suppression region
*/
public int getFirstLine() {
return firstLine;
}
/** @return the first column of the suppression region */
/**
* @return the first column of the suppression region
*/
public int getFirstColumn() {
return firstColumn;
}
/** @return the last line of the suppression region */
/**
* @return the last line of the suppression region
*/
public int getLastLine() {
return lastLine;
}
/** @return the last column of the suppression region */
/**
* @return the last column of the suppression region
*/
public int getLastColumn() {
return lastColumn;
}

View File

@ -165,14 +165,20 @@ public final class AnnotationUseStyleCheck extends Check {
//not extending AbstractOptionCheck because check
//has more than one option type.
/** @see #setElementStyle(String) */
/**
* @see #setElementStyle(String)
*/
private ElementStyle elementStyle = ElementStyle.COMPACT_NO_ARRAY;
//defaulting to NEVER because of the strange compiler behavior
/** @see #setTrailingArrayComma(String) */
/**
* @see #setTrailingArrayComma(String)
*/
private TrailingArrayComma trailingArrayComma = TrailingArrayComma.NEVER;
/** @see #setClosingParens(String) */
/**
* @see #setClosingParens(String)
*/
private ClosingParens closingParens = ClosingParens.NEVER;
/**

View File

@ -99,7 +99,9 @@ public final class MissingOverrideCheck extends Check {
private static final Pattern MATCH_INHERIT_DOC =
CommonUtils.createPattern("\\{\\s*@(inheritDoc)\\s*\\}");
/** @see #setJavaFiveCompatibility(boolean) */
/**
* @see #setJavaFiveCompatibility(boolean)
*/
private boolean javaFiveCompatibility;
/**

View File

@ -973,17 +973,23 @@ public class JavadocMethodCheck extends AbstractTypeAwareCheck {
found = true;
}
/** @return whether the exception has throws tag associated with */
/**
* @return whether the exception has throws tag associated with
*/
final boolean isFound() {
return found;
}
/** @return exception's name */
/**
* @return exception's name
*/
final Token getName() {
return classInfo.getName();
}
/** @return class for this exception */
/**
* @return class for this exception
*/
final Class<?> getClazz() {
return classInfo.getClazz();
}

View File

@ -57,22 +57,30 @@ public class JavadocTag {
this(line, column, tag, null);
}
/** @return the tag string **/
/**
* @return the tag string
*/
public String getTagName() {
return tagInfo.getName();
}
/** @return the first argument. null if not set. **/
/**
* @return the first argument. null if not set.
*/
public String getFirstArg() {
return firstArg;
}
/** @return the line number **/
/**
* @return the line number
*/
public int getLineNo() {
return lineNo;
}
/** @return the column number */
/**
* @return the column number
*/
public int getColumnNo() {
return columnNo;
}
@ -83,33 +91,45 @@ public class JavadocTag {
+ ", firstArg='" + firstArg + "'}";
}
/** @return whether the tag is an 'return' tag **/
/**
* @return whether the tag is an 'return' tag
*/
public boolean isReturnTag() {
return tagInfo == JavadocTagInfo.RETURN;
}
/** @return whether the tag is an 'param' tag **/
/**
* @return whether the tag is an 'param' tag
*/
public boolean isParamTag() {
return tagInfo == JavadocTagInfo.PARAM;
}
/** @return whether the tag is an 'throws' or 'exception' tag **/
/**
* @return whether the tag is an 'throws' or 'exception' tag
*/
public boolean isThrowsTag() {
return tagInfo == JavadocTagInfo.THROWS
|| tagInfo == JavadocTagInfo.EXCEPTION;
}
/** @return whether the tag is a 'see' or 'inheritDoc' tag **/
/**
* @return whether the tag is a 'see' or 'inheritDoc' tag
*/
public boolean isSeeOrInheritDocTag() {
return tagInfo == JavadocTagInfo.SEE || isInheritDocTag();
}
/** @return whether the tag is a 'inheritDoc' tag **/
/**
* @return whether the tag is a 'inheritDoc' tag
*/
public boolean isInheritDocTag() {
return tagInfo == JavadocTagInfo.INHERIT_DOC;
}
/** @return whether the tag can contain references to imported classes **/
/**
* @return whether the tag can contain references to imported classes
*/
public boolean canReferenceImports() {
return tagInfo == JavadocTagInfo.SEE
|| tagInfo == JavadocTagInfo.LINK

View File

@ -86,7 +86,9 @@ public abstract class AbstractClassCouplingCheck extends Check {
return getRequiredTokens();
}
/** @return allowed complexity. */
/**
* @return allowed complexity.
*/
public final int getMax() {
return max;
}
@ -112,7 +114,9 @@ public abstract class AbstractClassCouplingCheck extends Check {
packageName = "";
}
/** @return message key we use for log violations. */
/**
* @return message key we use for log violations.
*/
protected abstract String getLogMessageId();
@Override

View File

@ -259,7 +259,9 @@ public final class MethodCountCheck extends Check {
}
}
/** @return the total number of methods. */
/**
* @return the total number of methods.
*/
int getTotal() {
return total;
}

View File

@ -139,7 +139,9 @@ public class SuppressWithNearbyCommentFilter
commentRegexp = CommonUtils.createPattern(format);
}
/** @return the FileContents for this filter. */
/**
* @return the FileContents for this filter.
*/
public FileContents getFileContents() {
return fileContentsReference.get();
}

View File

@ -134,7 +134,9 @@ public class SuppressionCommentFilter
onRegexp = CommonUtils.createPattern(format);
}
/** @return the FileContents for this filter. */
/**
* @return the FileContents for this filter.
*/
public FileContents getFileContents() {
return fileContentsReference.get();
}
@ -371,7 +373,9 @@ public class SuppressionCommentFilter
}
}
/** @return the line number of the tag in the source file. */
/**
* @return the line number of the tag in the source file.
*/
public int getLine() {
return line;
}

View File

@ -44,43 +44,57 @@ public abstract class AbstractCellEditor implements CellEditor {
*/
private final EventListenerList listenerList = new EventListenerList();
/** @see CellEditor */
/**
* @see CellEditor
*/
@Override
public Object getCellEditorValue() {
return null;
}
/** @see CellEditor */
/**
* @see CellEditor
*/
@Override
public boolean isCellEditable(EventObject e) {
return true;
}
/** @see CellEditor */
/**
* @see CellEditor
*/
@Override
public boolean shouldSelectCell(EventObject anEvent) {
return false;
}
/** @see CellEditor */
/**
* @see CellEditor
*/
@Override
public boolean stopCellEditing() {
return true;
}
/** @see CellEditor */
/**
* @see CellEditor
*/
@Override
public void cancelCellEditing() {
// No code, tree is read-only
}
/** @see CellEditor */
/**
* @see CellEditor
*/
@Override
public void addCellEditorListener(CellEditorListener listener) {
listenerList.add(CellEditorListener.class, listener);
}
/** @see CellEditor */
/**
* @see CellEditor
*/
@Override
public void removeCellEditorListener(CellEditorListener listener) {
listenerList.remove(CellEditorListener.class, listener);

View File

@ -20,37 +20,49 @@ class DebugAuditAdapter implements AuditListener {
called = false;
}
/** @see AuditListener */
/**
* @see AuditListener
*/
@Override
public void addError(AuditEvent evt) {
called = true;
}
/** @see AuditListener */
/**
* @see AuditListener
*/
@Override
public void addException(AuditEvent evt, Throwable throwable) {
called = true;
}
/** @see AuditListener */
/**
* @see AuditListener
*/
@Override
public void auditStarted(AuditEvent evt) {
called = true;
}
/** @see AuditListener */
/**
* @see AuditListener
*/
@Override
public void fileStarted(AuditEvent evt) {
called = true;
}
/** @see AuditListener */
/**
* @see AuditListener
*/
@Override
public void auditFinished(AuditEvent evt) {
called = true;
}
/** @see AuditListener */
/**
* @see AuditListener
*/
@Override
public void fileFinished(AuditEvent evt) {
called = true;