From c977c274a7de782889fc83531a3f58ec0fadfad8 Mon Sep 17 00:00:00 2001 From: Oleg Sukhodolsky Date: Fri, 17 Jun 2005 12:04:08 +0000 Subject: [PATCH] fix for 1220726 --- .../tools/checkstyle/checks/ClassResolver.java | 6 +++--- .../indentation/InputValidClassDefIndent.java | 6 ++---- .../checks/coding/RedundantThrowsCheckTest.java | 12 ++++++++---- src/xdocs/releasenotes.xml | 4 ++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/ClassResolver.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/ClassResolver.java index d36f8a0bb..3656dc7ae 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/ClassResolver.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/ClassResolver.java @@ -71,7 +71,7 @@ public class ClassResolver if (isLoadable(aName)) { return safeLoad(aName); } - //Perhaps it's fullyqualified inner class + //Perhaps it's fully-qualified inner class int dotIdx = aName.lastIndexOf("."); if (dotIdx != -1) { final String cn = aName.substring(0, dotIdx) + "$" @@ -107,7 +107,7 @@ public class ClassResolver } // See if in the package - if (mPkg != null) { + if (!"".equals(mPkg)) { final String fqn = mPkg + "." + aName; if (isLoadable(fqn)) { return safeLoad(fqn); @@ -116,7 +116,7 @@ public class ClassResolver //inner class of this class??? if (!"".equals(aCurrentClass)) { - final String innerClass = ((mPkg != null) ? (mPkg + ".") : "") + final String innerClass = (!"".equals(mPkg) ? (mPkg + ".") : "") + aCurrentClass + "$" + aName; if (isLoadable(innerClass)) { return safeLoad(innerClass); diff --git a/src/testinputs/com/puppycrawl/tools/checkstyle/indentation/InputValidClassDefIndent.java b/src/testinputs/com/puppycrawl/tools/checkstyle/indentation/InputValidClassDefIndent.java index 3b0e2fc91..09e7fec8d 100644 --- a/src/testinputs/com/puppycrawl/tools/checkstyle/indentation/InputValidClassDefIndent.java +++ b/src/testinputs/com/puppycrawl/tools/checkstyle/indentation/InputValidClassDefIndent.java @@ -116,13 +116,11 @@ final class InputValidClassDefIndent6 extends java.awt.event.MouseAdapter implem 11, 11), 10, 10, 10); - - } - + private void myfunc2(int a, int b, int c, int d, int e, int f, int g) { } - + private int myfunc3(int a, int b, int c, int d) { return 1; } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/RedundantThrowsCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/RedundantThrowsCheckTest.java index 42631c361..4b6de5823 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/RedundantThrowsCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/RedundantThrowsCheckTest.java @@ -14,8 +14,6 @@ public class RedundantThrowsCheckTest "7:37: Redundant throws: 'java.io.FileNotFoundException' is subclass of 'java.io.IOException'.", "13:16: Redundant throws: 'RuntimeException' is unchecked exception.", "19:29: Redundant throws: 'java.io.IOException' listed more then one time.", -// "25:16: Unable to get class information for WrongException.", -// "35:27: Unable to get class information for WrongException.", "39:27: Redundant throws: 'NullPointerException' is subclass of 'RuntimeException'.", "39:27: Redundant throws: 'NullPointerException' is unchecked exception.", "39:49: Redundant throws: 'RuntimeException' is unchecked exception.", @@ -45,8 +43,6 @@ public class RedundantThrowsCheckTest final String[] expected = { "13:16: Redundant throws: 'RuntimeException' is unchecked exception.", "19:29: Redundant throws: 'java.io.IOException' listed more then one time.", -// "25:16: Unable to get class information for WrongException.", -// "35:27: Unable to get class information for WrongException.", "39:27: Redundant throws: 'NullPointerException' is unchecked exception.", "39:49: Redundant throws: 'RuntimeException' is unchecked exception.", }; @@ -88,4 +84,12 @@ public class RedundantThrowsCheckTest final String[] expected = {}; verify(checkConfig, getPath("javadoc/Test3.java"), expected); } + + public void test_1220726() throws Exception + { + final DefaultConfiguration checkConfig = + createCheckConfig(RedundantThrowsCheck.class); + final String[] expected = {}; + verify(checkConfig, getPath("javadoc/BadCls.java"), expected); + } } diff --git a/src/xdocs/releasenotes.xml b/src/xdocs/releasenotes.xml index 99b24c21f..5f5d3ab0e 100755 --- a/src/xdocs/releasenotes.xml +++ b/src/xdocs/releasenotes.xml @@ -20,8 +20,8 @@
  • Applied patch 1079192 (thanks to Dave Brosius)
  • -
  • One more bug fixed in type aware checks (RedundantThrows - and JavadocMethod checks) (bug 1168408)
  • +
  • Two more bugs fixed in type aware checks (RedundantThrows + and JavadocMethod checks) (bug 1168408 and 1220726)
  • Applied patch 1045127 (thanks to Paul Constantinides)