From 0c2a64d9f02ab5b94bbf4213cb2978f7b459b6f5 Mon Sep 17 00:00:00 2001 From: Michal Kordas Date: Tue, 22 Sep 2015 00:02:53 +0200 Subject: [PATCH] Issue #2080: Fix typos in code --- .../puppycrawl/tools/checkstyle/api/TextBlock.java | 10 +++++----- .../puppycrawl/tools/checkstyle/api/TokenTypes.java | 12 ++++++------ .../checkstyle/checks/SuppressWarningsHolder.java | 4 ++-- .../tools/checkstyle/checks/TranslationCheck.java | 4 ++-- .../checkstyle/checks/UncommentedMainCheck.java | 4 ++-- .../tools/checkstyle/api/LocalizedMessageTest.java | 12 ++++++------ .../tools/checkstyle/checks/ClassResolverTest.java | 4 ++-- .../checks/NewlineAtEndOfFileCheckTest.java | 4 ++-- .../checkstyle/checks/UniquePropertiesCheckTest.java | 2 +- .../tools/checkstyle/checks/UpperEllCheckTest.java | 2 +- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/TextBlock.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/TextBlock.java index 56344955ad2..4b594a55f71 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/TextBlock.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/TextBlock.java @@ -20,7 +20,7 @@ package com.puppycrawl.tools.checkstyle.api; /** - * A block of text from an inputfile that does not necessarily + * A block of text from an input file that does not necessarily * have any grammatical structure. * * @author lkuehne @@ -36,28 +36,28 @@ public interface TextBlock { String[] getText(); /** - * The line in the inputfile where the text block starts. + * The line in the input file where the text block starts. * Counting starts from 1. * @return first line of the text block */ int getStartLineNo(); /** - * The last line of the text block in the inputfile. + * The last line of the text block in the input file. * Counting starts from 1. * @return last line of the text block */ int getEndLineNo(); /** - * The column in the inputfile where the text block starts. + * The column in the input file where the text block starts. * Counting starts from 0. * @return first line of the text block */ int getStartColNo(); /** - * The column in the inputfile where the text block ends. + * The column in the input file where the text block ends. * Counting starts from 0. * @return last line of the text block */ diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/TokenTypes.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/TokenTypes.java index 8d76b0363f4..2238bab0335 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/TokenTypes.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/TokenTypes.java @@ -2798,7 +2798,7 @@ public final class TokenTypes { *
      * SOME_CONSTANT(1)
      * {
-     *     public void someMethodOverridenFromMainBody()
+     *     public void someMethodOverriddenFromMainBody()
      *     {
      *     }
      * }
@@ -2828,7 +2828,7 @@ public final class TokenTypes {
      *             +--TYPE
      *                 |
      *                 +--LITERAL_void (void)
-     *             +--IDENT (someMethodOverridenFromMainBody)
+     *             +--IDENT (someMethodOverriddenFromMainBody)
      *             +--LPAREN (()
      *             +--PARAMETERS
      *             +--RPAREN ())
@@ -3323,10 +3323,10 @@ public final class TokenTypes {
     public static final int LAMBDA = GeneratedJavaTokenTypes.LAMBDA;
 
     /**
-     * Begining of single line comment: '//'.
+     * Beginning of single line comment: '//'.
      *
      * 
-     * +--SINLE_LINE_COMMENT
+     * +--SINGLE_LINE_COMMENT
      *         |
      *         +--COMMENT_CONTENT
      * 
@@ -3335,7 +3335,7 @@ public final class TokenTypes { GeneratedJavaTokenTypes.SINGLE_LINE_COMMENT; /** - * Begining of block comment: '/*'. + * Beginning of block comment: '/*'. * *
      * +--BLOCK_COMMENT_BEGIN
@@ -3364,7 +3364,7 @@ public final class TokenTypes {
      * Text of single-line or block comment.
      *
      *
-     * +--SINLE_LINE_COMMENT
+     * +--SINGLE_LINE_COMMENT
      *         |
      *         +--COMMENT_CONTENT
      * 
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java index 16df4e8b3e9..8b51b173425 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java @@ -229,7 +229,7 @@ public void visitToken(DetailAST ast) { for (String value : values) { String checkName = value; // strip off the checkstyle-only prefix if present - checkName = removeChecktylePrefixIfExests(checkName); + checkName = removeCheckstylePrefixIfExists(checkName); entries.add(new Entry(checkName, firstLine, firstColumn, lastLine, lastColumn)); } @@ -244,7 +244,7 @@ public void visitToken(DetailAST ast) { * - name of the check * @return check name without prefix */ - private static String removeChecktylePrefixIfExests(String checkName) { + private static String removeCheckstylePrefixIfExists(String checkName) { String result = checkName; if (checkName.startsWith(CHECKSTYLE_PREFIX)) { result = checkName.substring(CHECKSTYLE_PREFIX.length()); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java index a722e084c79..8b142723a8d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java @@ -213,7 +213,7 @@ private Set loadKeys(File file) { /** * Helper method to log an io exception. - * @param ex the exception that occured + * @param ex the exception that occurred * @param file the file that could not be processed */ private void logIOException(IOException ex, File file) { @@ -234,7 +234,7 @@ private void logIOException(IOException ex, File file) { final SortedSet messages = Sets.newTreeSet(); messages.add(message); getMessageDispatcher().fireErrors(file.getPath(), messages); - LOG.debug("IOException occured.", ex); + LOG.debug("IOException occurred.", ex); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java index 768ce617089..31758a74e37 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java @@ -222,8 +222,8 @@ private static boolean checkParams(DetailAST method) { final DetailAST params = method.findFirstToken(TokenTypes.PARAMETERS); if (params.getChildCount() == 1) { - final DetailAST paratype = params.getFirstChild().findFirstToken(TokenTypes.TYPE); - final DetailAST arrayDecl = paratype.findFirstToken(TokenTypes.ARRAY_DECLARATOR); + final DetailAST parameterType = params.getFirstChild().findFirstToken(TokenTypes.TYPE); + final DetailAST arrayDecl = parameterType.findFirstToken(TokenTypes.ARRAY_DECLARATOR); if (arrayDecl != null) { final DetailAST arrayType = arrayDecl.getFirstChild(); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessageTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessageTest.java index 53982ff2931..007f6c8053c 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessageTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessageTest.java @@ -64,8 +64,8 @@ public void testMessageInEnglish() { @Test public void testBundleReloadUrlNull() throws IOException { - LocalizedMessage.UTF8Control cntrl = new LocalizedMessage.UTF8Control(); - cntrl.newBundle("com.puppycrawl.tools.checkstyle.checks.coding.messages", + LocalizedMessage.UTF8Control control = new LocalizedMessage.UTF8Control(); + control.newBundle("com.puppycrawl.tools.checkstyle.checks.coding.messages", Locale.ENGLISH, "java.class", Thread.currentThread().getContextClassLoader(), true); } @@ -82,8 +82,8 @@ public void testBundleReloadUrlNotNull() throws IOException { String resource = "com/puppycrawl/tools/checkstyle/checks/coding/messages_en.properties"; when(classloader.getResource(resource)).thenReturn(url); - LocalizedMessage.UTF8Control cntrl = new LocalizedMessage.UTF8Control(); - cntrl.newBundle("com.puppycrawl.tools.checkstyle.checks.coding.messages", + LocalizedMessage.UTF8Control control = new LocalizedMessage.UTF8Control(); + control.newBundle("com.puppycrawl.tools.checkstyle.checks.coding.messages", Locale.ENGLISH, "java.class", classloader, true); } @@ -97,8 +97,8 @@ public void testBundleReloadUrlNotNullStreamNull() throws IOException { URL url = getMockUrl(null); when(classloader.getResource(resource)).thenReturn(url); - LocalizedMessage.UTF8Control cntrl = new LocalizedMessage.UTF8Control(); - cntrl.newBundle("com.puppycrawl.tools.checkstyle.checks.coding.messages", + LocalizedMessage.UTF8Control control = new LocalizedMessage.UTF8Control(); + control.newBundle("com.puppycrawl.tools.checkstyle.checks.coding.messages", Locale.ENGLISH, "java.class", classloader, true); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/ClassResolverTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/ClassResolverTest.java index 993a131e0bf..dfb196a33dd 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/ClassResolverTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/ClassResolverTest.java @@ -136,7 +136,7 @@ public void testResolveQualifiedNameFails() throws Exception { ClassResolver classResolver = PowerMockito.spy(new ClassResolver(Thread .currentThread().getContextClassLoader(), "", imports)); - PowerMockito.doThrow(new ClassNotFoundException("excpected exception")) + PowerMockito.doThrow(new ClassNotFoundException("expected exception")) .when(classResolver, "safeLoad", anyObject()); PowerMockito.doReturn(true).when(classResolver, "isLoadable", anyObject()); @@ -147,7 +147,7 @@ public void testResolveQualifiedNameFails() throws Exception { catch (IllegalStateException e) { // expected assertTrue(e.getCause() instanceof ClassNotFoundException); - assertTrue(e.getMessage().endsWith("excpected exception")); + assertTrue(e.getMessage().endsWith("expected exception")); } } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java index 4a379740488..914fffb0f5e 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java @@ -169,8 +169,8 @@ public void testWrongFile() throws Exception { File impossibleFile = new File(""); Set messages = check.process(impossibleFile, Lists.newArrayList("txt")); assertEquals(1, messages.size()); - Iterator iter = messages.iterator(); - assertEquals("Unable to open ''.", iter.next().getMessage()); + Iterator iterator = messages.iterator(); + assertEquals("Unable to open ''.", iterator.next().getMessage()); } @Test diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheckTest.java index e74a6796641..10cc58af1b2 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheckTest.java @@ -99,7 +99,7 @@ public void testNotFoundKey() throws Exception { } /** - * Tests IO exception, that can orrur during reading of properties file. + * Tests IO exception, that can occur during reading of properties file. */ @Test public void testIOException() throws Exception { diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/UpperEllCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/UpperEllCheckTest.java index d31fe4f86ed..c1d083ff2bf 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/UpperEllCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/UpperEllCheckTest.java @@ -51,7 +51,7 @@ public void testWithChecker() } @Test - public void testAcceptableTockens() { + public void testAcceptableTokens() { int[] expected = {TokenTypes.NUM_LONG }; UpperEllCheck check = new UpperEllCheck(); int[] actual = check.getAcceptableTokens();