From 9bb2ad91c98b3d590579f34abff774c4375581fc Mon Sep 17 00:00:00 2001 From: Rick Giles Date: Thu, 22 May 2003 23:25:22 +0000 Subject: [PATCH] renamed DesignForInheritanceCheck to DesignForExtensionCheck --- contrib/examples/conf/BlochEffectiveJava.xml | 2 +- docs/config_design.html | 8 ++++---- docs/releasenotes.html | 2 +- ...InheritanceCheck.java => DesignForExtensionCheck.java} | 6 +++--- .../tools/checkstyle/checks/messages.properties | 2 +- .../tools/checkstyle/checks/messages_de.properties | 2 +- .../tools/checkstyle/checks/messages_fi.properties | 2 +- .../tools/checkstyle/checks/messages_fr.properties | 2 +- .../tools/checkstyle/checks/messages_pt.properties | 2 +- ...gnForInheritance.java => InputDesignForExtension.java} | 2 +- src/tests/com/puppycrawl/tools/checkstyle/AllTests.java | 4 ++-- ...nceCheckTest.java => DesignForExtensionCheckTest.java} | 8 ++++---- .../checks/HideUtilityClassConstructorCheckTest.java | 2 +- 13 files changed, 22 insertions(+), 22 deletions(-) rename src/checkstyle/com/puppycrawl/tools/checkstyle/checks/{DesignForInheritanceCheck.java => DesignForExtensionCheck.java} (97%) rename src/testinputs/com/puppycrawl/tools/checkstyle/{InputDesignForInheritance.java => InputDesignForExtension.java} (96%) rename src/tests/com/puppycrawl/tools/checkstyle/checks/{DesignForInheritanceCheckTest.java => DesignForExtensionCheckTest.java} (54%) diff --git a/contrib/examples/conf/BlochEffectiveJava.xml b/contrib/examples/conf/BlochEffectiveJava.xml index 109bbad79..938b75299 100644 --- a/contrib/examples/conf/BlochEffectiveJava.xml +++ b/contrib/examples/conf/BlochEffectiveJava.xml @@ -47,7 +47,7 @@ i.e. if you get error messages from this check you should be able to name a good reason to implement your code the way you do it, especially if you are designing a library and not an application. --> - + diff --git a/docs/config_design.html b/docs/config_design.html index c930f0367..60dad7ae9 100644 --- a/docs/config_design.html +++ b/docs/config_design.html @@ -35,7 +35,7 @@ HideUtilityClassConstructor
  • - DesignForInheritance + DesignForExtension
  • @@ -239,9 +239,9 @@ public class StringUtils // not final to allow subclassing TreeWalker

    -

    DesignForInheritance

    Description

    +

    DesignForExtension

    Description

    - Checks that classes are designed for inheritance. + Checks that classes are designed for extension. More specifically, it enforces a programming style where superclasses provide empty "hooks" that can be implemented by subclasses. @@ -273,7 +273,7 @@ public class StringUtils // not final to allow subclassing To configure the check:

    -<module name="DesignForInheritance"/>
    +<module name="DesignForExtension"/>
           

    Package

    diff --git a/docs/releasenotes.html b/docs/releasenotes.html index 6fadf73bb..2397fa8be 100644 --- a/docs/releasenotes.html +++ b/docs/releasenotes.html @@ -69,7 +69,7 @@

  • Added check to enforce an API design that shields classes against bugs in derived classes (module - DesignForInheritance, request 659715).
  • + DesignForExtension, request 659715).
  • Added check to enforce that Interfaces do not contain only constants (module InterfaceIsType, request 659717, see diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/DesignForInheritanceCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/DesignForExtensionCheck.java similarity index 97% rename from src/checkstyle/com/puppycrawl/tools/checkstyle/checks/DesignForInheritanceCheck.java rename to src/checkstyle/com/puppycrawl/tools/checkstyle/checks/DesignForExtensionCheck.java index 92a553fab..36bc988af 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/DesignForInheritanceCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/DesignForExtensionCheck.java @@ -53,9 +53,9 @@ import com.puppycrawl.tools.checkstyle.api.ScopeUtils; *

    * * @author lkuehne - * @version $Revision: 1.5 $ + * @version $Revision: 1.1 $ */ -public class DesignForInheritanceCheck extends Check +public class DesignForExtensionCheck extends Check { /** @see Check */ public int[] getDefaultTokens() @@ -119,7 +119,7 @@ public class DesignForInheritanceCheck extends Check if (hasDefaultConstructor || hasExplNonPrivateCtor) { String name = aAST.findFirstToken(TokenTypes.IDENT).getText(); log(aAST.getLineNo(), aAST.getColumnNo(), - "design.forInheritance", name); + "design.forExtension", name); } diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages.properties index 9bbd2364b..abe0052bc 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages.properties +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages.properties @@ -77,7 +77,7 @@ simplify.boolreturn=Conditional logic can be removed. doublechecked.locking.avoid=The double-checked locking idiom is broken and should be avoided. -design.forInheritance=Method ''{0}'' is not designed for inheritance - needs to be abstract, final or empty. +design.forExtension=Method ''{0}'' is not designed for extension - needs to be abstract, final or empty. final.class=Class {0} should be declared as final. missing.switch.default=switch without \"default\" clause. diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_de.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_de.properties index 92c5fb3d9..f2120f48e 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_de.properties +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_de.properties @@ -78,7 +78,7 @@ simplify.boolreturn=Die Verzweigung sollte entfernt werden. doublechecked.locking.avoid=Das ''double-checked locking'' Idiom sollte vermieden werden. -design.forInheritance=Die Methode ''{0}'' ist nicht für Vererbung entworfen - muss abstract, final oder leer sein. +design.forExtension=Die Methode ''{0}'' ist nicht für Vererbung entworfen - muss abstract, final oder leer sein. final.class=Die Klasse {0} sollte als final deklariert sein, da alle ihre Konstruktoren private sind. missing.switch.default=switch ohne \"default\". diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_fi.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_fi.properties index a714992a7..ba49b3571 100755 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_fi.properties +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_fi.properties @@ -77,7 +77,7 @@ simplify.boolreturn=Konditionaalilogiikan voisi poistaa. doublechecked.locking.avoid=The double-checked locking idiom is broken and should be avoided. -design.forInheritance=Method ''{0}'' is not designed for inheritance - needs to be abstract, final or empty. +design.forExtension=Method ''{0}'' is not designed for extension - needs to be abstract, final or empty. final.class=Class {0} should be declared as final missing.switch.default=switch without \"default\" clause diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_fr.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_fr.properties index e99d426fe..4e53eae36 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_fr.properties +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_fr.properties @@ -77,7 +77,7 @@ simplify.boolreturn=Supprimez la logique conditionnelle. doublechecked.locking.avoid=The double-checked locking idiom is broken and should be avoided. -design.forInheritance=Method ''{0}'' is not designed for inheritance - needs to be abstract, final or empty. +design.forExtension=Method ''{0}'' is not designed for extension - needs to be abstract, final or empty. final.class=Class {0} should be declared as final missing.switch.default=switch without \"default\" clause diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_pt.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_pt.properties index 8203c901b..6264e2e6b 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_pt.properties +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_pt.properties @@ -77,7 +77,7 @@ simplify.boolreturn=A l doublechecked.locking.avoid=The double-checked locking idiom is broken and should be avoided. -design.forInheritance=Method ''{0}'' is not designed for inheritance - needs to be abstract, final or empty. +design.forExtension=Method ''{0}'' is not designed for inheritance - needs to be abstract, final or empty. final.class=Class {0} should be declared as final missing.switch.default=switch without \"default\" clause diff --git a/src/testinputs/com/puppycrawl/tools/checkstyle/InputDesignForInheritance.java b/src/testinputs/com/puppycrawl/tools/checkstyle/InputDesignForExtension.java similarity index 96% rename from src/testinputs/com/puppycrawl/tools/checkstyle/InputDesignForInheritance.java rename to src/testinputs/com/puppycrawl/tools/checkstyle/InputDesignForExtension.java index 23a6d50b0..313d561c6 100644 --- a/src/testinputs/com/puppycrawl/tools/checkstyle/InputDesignForInheritance.java +++ b/src/testinputs/com/puppycrawl/tools/checkstyle/InputDesignForExtension.java @@ -8,7 +8,7 @@ package com.puppycrawl.tools.checkstyle; * Test case for the "design for inheritance" check. * @author Lars Kühne **/ -public class InputDesignForInheritance +public class InputDesignForExtension { // some methods that are OK diff --git a/src/tests/com/puppycrawl/tools/checkstyle/AllTests.java b/src/tests/com/puppycrawl/tools/checkstyle/AllTests.java index 59fc71cde..fe5e2766b 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/AllTests.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/AllTests.java @@ -5,7 +5,7 @@ import com.puppycrawl.tools.checkstyle.api.DetailASTTest; import com.puppycrawl.tools.checkstyle.checks.AvoidInlineConditionalsCheckTest; import com.puppycrawl.tools.checkstyle.checks.AvoidStarImportTest; import com.puppycrawl.tools.checkstyle.checks.ConstantNameCheckTest; -import com.puppycrawl.tools.checkstyle.checks.DesignForInheritanceCheckTest; +import com.puppycrawl.tools.checkstyle.checks.DesignForExtensionCheckTest; import com.puppycrawl.tools.checkstyle.checks.DoubleCheckedLockingCheckTest; import com.puppycrawl.tools.checkstyle.checks.EmptyBlockCheckTest; import com.puppycrawl.tools.checkstyle.checks.EmptyForIteratorPadCheckTest; @@ -91,7 +91,7 @@ public class AllTests { suite.addTest(new TestSuite(AvoidStarImportTest.class)); suite.addTest(new TestSuite(ConfigurationLoaderTest.class)); suite.addTest(new TestSuite(ConstantNameCheckTest.class)); - suite.addTest(new TestSuite(DesignForInheritanceCheckTest.class)); + suite.addTest(new TestSuite(DesignForExtensionCheckTest.class)); suite.addTest(new TestSuite(DoubleCheckedLockingCheckTest.class)); suite.addTest(new TestSuite(EmptyBlockCheckTest.class)); suite.addTest(new TestSuite(EmptyForIteratorPadCheckTest.class)); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/DesignForInheritanceCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/DesignForExtensionCheckTest.java similarity index 54% rename from src/tests/com/puppycrawl/tools/checkstyle/checks/DesignForInheritanceCheckTest.java rename to src/tests/com/puppycrawl/tools/checkstyle/checks/DesignForExtensionCheckTest.java index 9ef526fc8..bed0a391b 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/DesignForInheritanceCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/DesignForExtensionCheckTest.java @@ -3,17 +3,17 @@ package com.puppycrawl.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; -public class DesignForInheritanceCheckTest +public class DesignForExtensionCheckTest extends BaseCheckTestCase { public void testIt() throws Exception { final DefaultConfiguration checkConfig = - createCheckConfig(DesignForInheritanceCheck.class); + createCheckConfig(DesignForExtensionCheck.class); final String[] expected = { - "46:5: Method 'doh' is not designed for inheritance - needs to be abstract, final or empty.", + "46:5: Method 'doh' is not designed for extension - needs to be abstract, final or empty.", }; - verify(checkConfig, getPath("InputDesignForInheritance.java"), expected); + verify(checkConfig, getPath("InputDesignForExtension.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/HideUtilityClassConstructorCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/HideUtilityClassConstructorCheckTest.java index fd18155e0..7ec4bedc0 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/HideUtilityClassConstructorCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/HideUtilityClassConstructorCheckTest.java @@ -24,7 +24,7 @@ public class HideUtilityClassConstructorCheckTest createCheckConfig(HideUtilityClassConstructorCheck.class); final String[] expected = { }; - verify(checkConfig, getPath("InputDesignForInheritance.java"), expected); + verify(checkConfig, getPath("InputDesignForExtension.java"), expected); } }