Permalink
Browse files

spelling: fix some typos in code/javadoc/comments

  • Loading branch information...
Vladlis authored and romani committed Mar 30, 2017
1 parent 5b16c53 commit 3bd3a52280388520c64ec813dd1e4ffb3a0063a2
Showing with 53 additions and 53 deletions.
  1. +4 −4 src/main/java/com/puppycrawl/tools/checkstyle/AstTreeStringPrinter.java
  2. +1 −1 src/main/java/com/puppycrawl/tools/checkstyle/AuditEventDefaultFormatter.java
  3. +1 −1 src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java
  4. +3 −3 src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java
  5. +2 −2 src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java
  6. +3 −3 src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java
  7. +2 −2 src/main/java/com/puppycrawl/tools/checkstyle/api/AutomaticBean.java
  8. +2 −2 src/main/java/com/puppycrawl/tools/checkstyle/api/ExternalResourceHolder.java
  9. +5 −5 src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java
  10. +1 −1 src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheck.java
  11. +1 −1 src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.java
  12. +1 −1 src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java
  13. +1 −1 src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java
  14. +2 −2 src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheck.java
  15. +2 −2 src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java
  16. +12 −12 src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java
  17. +1 −1 src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java
  18. +1 −1 src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpOnFilenameCheck.java
  19. +1 −1 src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheck.java
  20. +3 −3 src/main/java/com/puppycrawl/tools/checkstyle/utils/JavadocUtils.java
  21. +1 −1 src/test/java/com/puppycrawl/tools/checkstyle/PackageObjectFactoryTest.java
  22. +3 −3 src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheckTest.java
@@ -160,7 +160,7 @@ private static String printTree(DetailAST ast) {
*/
private static String getNodeInfo(DetailAST node) {
return TokenUtils.getTokenName(node.getType())
+ " -> " + excapeAllControlChars(node.getText())
+ " -> " + escapeAllControlChars(node.getText())
+ " [" + node.getLineNo() + ':' + node.getColumnNo() + ']';
}
@@ -198,11 +198,11 @@ private static String getIndentation(DetailAST ast) {
}
/**
* Replace all control chars with excaped symbols.
* Replace all control chars with escaped symbols.
* @param text the String to process.
* @return the processed String with all control chars excaped.
* @return the processed String with all control chars escaped.
*/
private static String excapeAllControlChars(String text) {
private static String escapeAllControlChars(String text) {
final String textWithoutNewlines = NEWLINE.matcher(text).replaceAll("\\\\n");
final String textWithoutReturns = RETURN.matcher(textWithoutNewlines).replaceAll("\\\\r");
return TAB.matcher(textWithoutReturns).replaceAll("\\\\t");
@@ -85,7 +85,7 @@ private static int calculateBufferLength(AuditEvent event, int severityLevelName
/**
* Returns check name without 'Check' suffix.
* @param event audit ivent.
* @param event audit event.
* @return check name without 'Check' suffix.
*/
private static String getCheckShortName(AuditEvent event) {
@@ -119,7 +119,7 @@ public static String printTree(DetailNode ast, String rootPrefix, String prefix)
}
messageBuilder.append(getIndentation(node))
.append(JavadocUtils.getTokenName(node.getType())).append(" -> ")
.append(JavadocUtils.excapeAllControlChars(node.getText())).append(" [")
.append(JavadocUtils.escapeAllControlChars(node.getText())).append(" [")
.append(node.getLineNumber()).append(':').append(node.getColumnNumber())
.append(']').append(LINE_SEPARATOR)
.append(printTree(JavadocUtils.getFirstChild(node), rootPrefix, prefix));
@@ -231,7 +231,7 @@ private Object createObject(String className) throws CheckstyleException {
instance = declaredConstructor.newInstance();
}
catch (final ReflectiveOperationException ex) {
throw new CheckstyleException("Unable to instatiate " + className, ex);
throw new CheckstyleException("Unable to instantiate " + className, ex);
}
}
@@ -245,7 +245,7 @@ private static void fillShortToFullModuleNamesMap() {
fillChecksFromAnnotationPackage();
fillChecksFromBlocksPackage();
fillChecksFromCodingPackage();
fillChecksFromDesingPackage();
fillChecksFromDesignPackage();
fillChecksFromHeaderPackage();
fillChecksFromImportsPackage();
fillChecksFromIndentationPackage();
@@ -394,7 +394,7 @@ private static void fillChecksFromCodingPackage() {
/**
* Fill short-to-full module names map with Checks from design package.
*/
private static void fillChecksFromDesingPackage() {
private static void fillChecksFromDesignPackage() {
NAME_TO_FULL_MODULE_NAME.put("DesignForExtensionCheck",
BASE_PACKAGE + ".checks.design.DesignForExtensionCheck");
NAME_TO_FULL_MODULE_NAME.put("FinalClassCheck",
@@ -267,7 +267,7 @@ public void putExternalResources(Set<String> locations) {
}
catch (CheckstyleException ex) {
// if exception happened (configuration resource was not found, connection is not
// available, resouce is broken, etc), we need to calculate hash sum based on
// available, resource is broken, etc), we need to calculate hash sum based on
// exception object content in order to check whether problem is resolved later
// and/or the configuration is changed.
contentHashSum = getHashCodeBasedOnObjectContent(ex);
@@ -282,7 +282,7 @@ public void putExternalResources(Set<String> locations) {
/**
* Loads the content of external resource.
* @param location external resource location.
* @return array of bytes which respresents the content of external resource in binary form.
* @return array of bytes which represents the content of external resource in binary form.
* @throws CheckstyleException if error while loading occurs.
*/
private static byte[] loadExternalResource(String location) throws CheckstyleException {
@@ -462,11 +462,11 @@ public void destroy() {
@Override
public Set<String> getExternalResourceLocations() {
final Set<String> orinaryChecksResources = getExternalResourceLocations(ordinaryChecks);
final Set<String> ordinaryChecksResources = getExternalResourceLocations(ordinaryChecks);
final Set<String> commentChecksResources = getExternalResourceLocations(commentChecks);
final int resultListSize = orinaryChecksResources.size() + commentChecksResources.size();
final int resultListSize = ordinaryChecksResources.size() + commentChecksResources.size();
final Set<String> resourceLocations = new HashSet<>(resultListSize);
resourceLocations.addAll(orinaryChecksResources);
resourceLocations.addAll(ordinaryChecksResources);
resourceLocations.addAll(commentChecksResources);
return resourceLocations;
}
@@ -132,7 +132,7 @@ private static void registerIntegralTypes(ConvertUtilsBean cub) {
*/
private static void registerCustomTypes(ConvertUtilsBean cub) {
cub.register(new PatternConverter(), Pattern.class);
cub.register(new ServerityLevelConverter(), SeverityLevel.class);
cub.register(new SeverityLevelConverter(), SeverityLevel.class);
cub.register(new ScopeConverter(), Scope.class);
cub.register(new UriConverter(), URI.class);
cub.register(new RelaxedAccessModifierArrayConverter(), AccessModifier[].class);
@@ -285,7 +285,7 @@ public Object convert(Class type, Object value) {
}
/** A converter that converts strings to severity level. */
private static class ServerityLevelConverter implements Converter {
private static class SeverityLevelConverter implements Converter {
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public Object convert(Class type, Object value) {
@@ -40,8 +40,8 @@
* ATTENTION!
* If 'getExternalResourceLocations()' return null, there will be
* {@link NullPointerException} in {@link Checker}.
* Such behaviour will signal that your module (check or filter) is designed incorrectrly.
* It make sence to return an empty set from 'getExternalResourceLocations()'
* Such behaviour will signal that your module (check or filter) is designed incorrectly.
* It make sense to return an empty set from 'getExternalResourceLocations()'
* only for composite modules like {@link com.puppycrawl.tools.checkstyle.TreeWalker}.
* @return a set of external configuration resource locations which are used by the module.
*/
@@ -130,7 +130,7 @@
private static final Log LOG = LogFactory.getLog(TranslationCheck.class);
/**
* Regexp string for default tranlsation files.
* Regexp string for default translation files.
* For example, messages.properties.
*/
private static final String DEFAULT_TRANSLATION_REGEXP = "^.+\\..+$";
@@ -159,10 +159,10 @@
/** File name format with language code. */
private static final String FILE_NAME_WITH_LANGUAGE_CODE_FORMATTER = "%s_%s.%s";
/** Formatting string to form regexp to validate required tranlsations file names. */
/** Formatting string to form regexp to validate required translations file names. */
private static final String REGEXP_FORMAT_TO_CHECK_REQUIRED_TRANSLATIONS =
"^%1$s\\_%2$s(\\_[A-Z]{2})?\\.%3$s$|^%1$s\\_%2$s\\_[A-Z]{2}\\_[A-Za-z]+\\.%3$s$";
/** Formatting string to form regexp to validate default tranlsations file names. */
/** Formatting string to form regexp to validate default translations file names. */
private static final String REGEXP_FORMAT_TO_CHECK_DEFAULT_TRANSLATIONS = "^%s\\.%s$";
/** The files to process. */
@@ -202,7 +202,7 @@ public void setRequiredTranslations(String... translationCodes) {
}
/**
* Validates the correctness of user specififed language codes for the check.
* Validates the correctness of user specified language codes for the check.
* @param languageCodes user specified language codes for the check.
*/
private void validateUserSpecifiedLanguageCodes(Set<String> languageCodes) {
@@ -411,7 +411,7 @@ else if (languageMatcher.matches()) {
else {
regexp = DEFAULT_TRANSLATION_REGEXP;
}
// We use substring(...) insead of replace(...), so that the regular expression does
// We use substring(...) instead of replace(...), so that the regular expression does
// not have to be compiled each time it is used inside 'replace' method.
final String removePattern = regexp.substring("^.+".length(), regexp.length());
return fileName.replaceAll(removePattern, "");
@@ -217,7 +217,7 @@ public void visitToken(DetailAST ast) {
/**
* Checks if ast is default in annotation
* @param ast ast to test.
* @return true if current ast is default and it is part of annatation.
* @return true if current ast is default and it is part of annotation.
*/
private boolean isDefaultInAnnotation(DetailAST ast) {
boolean isDefaultInAnnotation = false;
@@ -291,7 +291,7 @@ else if (state.currentScopeState == STATE_STATIC_VARIABLE_DEF) {
* state({@code Scope}), if it is it updates substate or else it
* logs violation.
* @param modifiersAst modifiers to process
* @param state curent state
* @param state current state
* @param isStateValid is main state for given modifiers is valid
*/
private void processModifiersSubState(DetailAST modifiersAst, ScopeState state,
@@ -534,7 +534,7 @@ private static boolean shouldRemoveFinalVariableCandidate(ScopeData scopeData, D
* }
* </p>
* @param variable variable.
* @return true if a variable which is declared ouside loop is used inside loop.
* @return true if a variable which is declared outside loop is used inside loop.
*/
private static boolean isUseOfExternalVariableInsideLoop(DetailAST variable) {
DetailAST loop2 = variable.getParent();
@@ -255,7 +255,7 @@ private String getIllegalInstantiation(String className) {
* Check import statements.
* @param className name of the class
* @return value of illegal instantiated type
* @noinspection StringContatenationInLoop
* @noinspection StringConcatenationInLoop
*/
private String checkImportStatements(String className) {
String illegalType = null;
@@ -105,9 +105,9 @@ private static String convertToString(DetailAST ast) {
case TokenTypes.LABELED_STAT:
tokenText = ast.getFirstChild().getText() + ast.getText();
break;
// multyline tokens need to become singlelined
// multiline tokens need to become singlelined
case TokenTypes.COMMENT_CONTENT:
tokenText = JavadocUtils.excapeAllControlChars(ast.getText());
tokenText = JavadocUtils.escapeAllControlChars(ast.getText());
break;
default:
tokenText = ast.getText();
@@ -204,7 +204,7 @@ private String getQualifiedClassName(DetailAST classAst) {
* outer class.
* @param packageName package name, empty string on default package
* @param outerClassQualifiedName qualified name(package + class) of outer class,
* null if doesnt exist
* null if doesn't exist
* @param className class name
* @return qualified class name(package + class name)
*/
@@ -242,7 +242,7 @@ private static String getSuperClassName(DetailAST classAst) {
/**
* Checks if given super class name in extend clause match super class qualified name.
* @param superClassQualifiedName super class quaflieid name(with package)
* @param superClassQualifiedName super class qualified name (with package)
* @param superClassInExtendClause name in extend clause
* @return true if given super class name in extend clause match super class qualified name,
* false otherwise
@@ -139,7 +139,7 @@ private void visitComment(DetailAST comment) {
handleCommentInEmptyCaseBlock(prevStmt, comment, nextStmt);
}
else if (isFallThroughComment(prevStmt, nextStmt)) {
handleFallThroughtComment(prevStmt, comment, nextStmt);
handleFallThroughComment(prevStmt, comment, nextStmt);
}
else if (isInEmptyCodeBlock(prevStmt, nextStmt)) {
handleCommentInEmptyCodeBlock(comment, nextStmt);
@@ -199,7 +199,7 @@ private boolean isDistributedPreviousStatement(DetailAST comment) {
/**
* Checks whether the previous statement of a comment is a method call chain or
* string concatenation statemen distributed over two ore more lines.
* string concatenation statement distributed over two ore more lines.
* @param comment comment to check.
* @return true if the previous statement is a distributed expression.
*/
@@ -262,9 +262,9 @@ private static boolean isDefinition(DetailAST previousSibling) {
}
/**
* Checks whether the previous statement of a comment is a destributed return statement.
* Checks whether the previous statement of a comment is a distributed return statement.
* @param commentPreviousSibling previous sibling of the comment.
* @return true if the previous statement of a comment is a destributed return statement.
* @return true if the previous statement of a comment is a distributed return statement.
*/
private static boolean isDistributedReturnStatement(DetailAST commentPreviousSibling) {
boolean isDistributed = false;
@@ -280,9 +280,9 @@ private static boolean isDistributedReturnStatement(DetailAST commentPreviousSib
}
/**
* Checks whether the previous statement of a comment is a destributed throw statement.
* Checks whether the previous statement of a comment is a distributed throw statement.
* @param commentPreviousSibling previous sibling of the comment.
* @return true if the previous statement of a comment is a destributed throw statement.
* @return true if the previous statement of a comment is a distributed throw statement.
*/
private static boolean isDistributedThrowStatement(DetailAST commentPreviousSibling) {
boolean isDistributed = false;
@@ -298,9 +298,9 @@ private static boolean isDistributedThrowStatement(DetailAST commentPreviousSibl
}
/**
* Returns the first token of the destributed previous statement of comment.
* Returns the first token of the distributed previous statement of comment.
* @param comment comment to check.
* @return the first token of the destributed previous statement of comment.
* @return the first token of the distributed previous statement of comment.
*/
private static DetailAST getDistributedPreviousStatement(DetailAST comment) {
DetailAST currentToken = comment.getPreviousSibling();
@@ -399,7 +399,7 @@ private static boolean isInEmptyCodeBlock(DetailAST prevStmt, DetailAST nextStmt
}
/**
* Handles a comment which is plased within empty case block.
* Handles a comment which is placed within empty case block.
* Note, if comment is placed at the end of the empty case block, we have Checkstyle's
* limitations to clearly detect user intention of explanation target - above or below. The
* only case we can assume as a violation is when a single line comment within the empty case
@@ -460,8 +460,8 @@ private void handleCommentInEmptyCaseBlock(DetailAST prevStmt, DetailAST comment
* @param comment single line comment.
* @param nextStmt next statement.
*/
private void handleFallThroughtComment(DetailAST prevStmt, DetailAST comment,
DetailAST nextStmt) {
private void handleFallThroughComment(DetailAST prevStmt, DetailAST comment,
DetailAST nextStmt) {
if (!areSameLevelIndented(comment, prevStmt, nextStmt)) {
logMultilineIndentation(prevStmt, comment, nextStmt);
@@ -470,7 +470,7 @@ private void handleFallThroughtComment(DetailAST prevStmt, DetailAST comment,
/**
* Handles a comment which is placed at the end of non empty code block.
* Note, if single line comment is plcaed at the end of non empty block the comment should have
* Note, if single line comment is placed at the end of non empty block the comment should have
* the same indentation level as the previous statement. For example:
* <p>
* {@code
@@ -32,7 +32,7 @@
*
* <p>
* The basic idea behind this is that while
* pretty printers are sometimes convenient for reformats of
* pretty printers are sometimes convenient for reformatting of
* legacy code, they often either aren't configurable enough or
* just can't anticipate how format should be done. Sometimes this is
* personal preference, other times it is practical experience. In any
@@ -40,7 +40,7 @@
* When customizing the check, the properties are applied in a specific order.
* The fileExtensions property first picks only files that match any of the
* specific extensions supplied. Once files are matched against the
* fileExtensions, the match property is then used in conjuction with the
* fileExtensions, the match property is then used in conjunction with the
* patterns to determine if the check is looking for a match or mis-match on
* those files. If the fileNamePattern is supplied, the matching is only applied
* to the fileNamePattern and not the folderPattern. If no fileNamePattern is
@@ -433,7 +433,7 @@ private boolean isNotRelevantSituation(DetailAST ast, int currentType) {
* This function is needed to recognise double brace initialization as valid,
* unfortunately its not possible to implement this functionality
* in isNotRelevantSituation method, because in this method when we return
* true(is not relevant) ast is later doesnt check at all. For example:
* true(is not relevant) ast is later doesn't check at all. For example:
* new Properties() {{setProperty("double curly braces", "are not a style error");
* }};
* For second left curly brace in first line when we would return true from
@@ -458,11 +458,11 @@ public static String getTagName(DetailNode javadocTagSection) {
}
/**
* Replace all control chars with excaped symbols.
* Replace all control chars with escaped symbols.
* @param text the String to process.
* @return the processed String with all control chars excaped.
* @return the processed String with all control chars escaped.
*/
public static String excapeAllControlChars(String text) {
public static String escapeAllControlChars(String text) {
final String textWithoutNewlines = NEWLINE.matcher(text).replaceAll("\\\\n");
final String textWithoutReturns = RETURN.matcher(textWithoutNewlines).replaceAll("\\\\r");
return TAB.matcher(textWithoutReturns).replaceAll("\\\\t");
Oops, something went wrong.

0 comments on commit 3bd3a52

Please sign in to comment.