From bc66e150c2654deb6dcf1806b02e8f816e533d83 Mon Sep 17 00:00:00 2001
From: Oliver Burn
Date: Wed, 23 Mar 2005 12:15:08 +0000
Subject: [PATCH] All these changes are because I wanted to fix a small
documentation bug. Ended up having to move the RedundantModifierCheck around.
---
.../checkstyle/checks/messages.properties | 2 -
.../checkstyle/checks/messages_de.properties | 2 -
.../checkstyle/checks/messages_fi.properties | 2 -
.../checkstyle/checks/messages_fr.properties | 2 -
.../checkstyle/checks/messages_ja.properties | 2 -
.../checkstyle/checks/messages_pt.properties | 1 -
.../RedundantModifierCheck.java | 26 +------
.../checks/modifier/messages.properties | 1 +
.../checks/modifier/messages_de.properties | 1 +
.../checks/modifier/messages_fi.properties | 1 +
.../checks/modifier/messages_fr.properties | 2 +
.../checks/modifier/messages_ja.properties | 3 +
.../checks/modifier/messages_pt.properties | 3 +
.../checkstyle/checks/modifier/package.html | 10 +++
.../tools/checkstyle/checkstyle_packages.xml | 1 +
.../checkstyle/PackageNamesLoaderTest.java | 1 +
.../tools/checkstyle/checks/AllTests.java | 2 +
.../{ => modifier}/RedundantModifierTest.java | 3 +-
...nfig_modifiers.xml => config_modifier.xml} | 68 ++++++++++---------
src/xdocs/stylesheets/project.xml | 2 +-
src/xdocs/stylesheets/site.vsl | 4 ++
suppressions.xml | 2 +-
22 files changed, 71 insertions(+), 70 deletions(-)
rename src/checkstyle/com/puppycrawl/tools/checkstyle/checks/{ => modifier}/RedundantModifierCheck.java (84%)
mode change 100644 => 100755
create mode 100755 src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages.properties
create mode 100755 src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_de.properties
create mode 100755 src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_fi.properties
create mode 100755 src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_fr.properties
create mode 100755 src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_ja.properties
create mode 100755 src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_pt.properties
create mode 100755 src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/package.html
rename src/tests/com/puppycrawl/tools/checkstyle/checks/{ => modifier}/RedundantModifierTest.java (88%)
rename src/xdocs/{config_modifiers.xml => config_modifier.xml} (70%)
diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages.properties
index d7fd359ee..9f4566b4f 100644
--- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages.properties
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages.properties
@@ -1,7 +1,5 @@
noNewlineAtEOF=File does not end with a newline.
-redundantModifier=Redundant ''{0}'' modifier.
-
todo.match=Comment matches to-do format ''{0}''.
upperEll=Should use uppercase ''L''.
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 62410b9e5..a2283f3b3 100644
--- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_de.properties
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_de.properties
@@ -1,8 +1,6 @@
noNewlineAtEOF=Datei endet nicht mit einem Zeilenumbruch.
-redundantModifier=Überflüssiger Modifier ''{0}''.
-
todo.match=Kommentar entspricht to-do-Format ''{0}''.
upperEll=Zur besseren Lesbarkeit sollte ein großes ''L'' verwendet werden.
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 6d988e0bf..68a440b70 100755
--- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_fi.properties
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_fi.properties
@@ -1,7 +1,5 @@
noNewlineAtEOF=Tiedosto ei pääty rivinvaihtoon.
-redundantModifier=Tarpeeton määrite: ''{0}''
-
todo.match=Kommentti on to-do formaatin ''{0}'' mukainen.
upperEll=Pitää olla iso ''L''.
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 2ccc0bf2e..1d1bb1642 100644
--- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_fr.properties
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_fr.properties
@@ -1,7 +1,5 @@
noNewlineAtEOF=Il manque un caractère NewLine à la fin du fichier
-redundantModifier=Mot-clef ''{0}'' redondant.
-
todo.match=Le commentaire correspond au format TODO ''{0}''.
upperEll=Utilisez un ''L'' majuscule pour une meilleure lisibilité.
diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_ja.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_ja.properties
index c482ee95f..7e9b57498 100755
--- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_ja.properties
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_ja.properties
@@ -1,7 +1,5 @@
noNewlineAtEOF=¥Õ¥¡¥¤¥ë¤¬¿·¤·¤¤¹Ô¤Ç½ªÎ»¤·¤Æ¤¤¤Þ¤»¤ó¡£
-redundantModifier=¾éĹ¤Ê ''{0}'' ½¤¾þ»Ò¤Ç¤¹¡£
-
todo.match=¥³¥á¥ó¥È¤¬ to-do ¤Î·Á¼° ''{0}'' ¤Ë¹çÃפ·¤Æ¤¤¤Þ¤¹¡£
upperEll=Âçʸ»ú¤Î ''L'' ¤ò»ÈÍѤ¹¤Ù¤¤Ç¤¹¡£
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 5a6282e94..7869403ff 100644
--- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_pt.properties
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/messages_pt.properties
@@ -4,7 +4,6 @@ illegal.regexp=A linha condiz com o padr
missing.switch.default=switch sem o ramo \"default\".
mod.order=Modificador ''{0}'' fora da orderm sugerida pela JLS.
noNewlineAtEOF=File does not end with a newline.
-redundantModifier=Modificador ''{0}'' é redundante.
todo.match=O comentário condiz com o padrão de tarefa pendente ''{0}''.
translation.missingKey=Falta a chave ''{0}''.
uncommented.main=Método main não comentado encontrado.
diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/RedundantModifierCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java
old mode 100644
new mode 100755
similarity index 84%
rename from src/checkstyle/com/puppycrawl/tools/checkstyle/checks/RedundantModifierCheck.java
rename to src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java
index a3c71027b..3569f8903
--- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/RedundantModifierCheck.java
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java
@@ -16,7 +16,7 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////
-package com.puppycrawl.tools.checkstyle.checks;
+package com.puppycrawl.tools.checkstyle.checks.modifier;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
@@ -27,30 +27,6 @@ import com.puppycrawl.tools.checkstyle.api.ScopeUtils;
* Checks for redundant modifiers in interface and annotation definitions.
* Also checks for redundant final modifiers on methods of final classes.
*
- *
- * Rationale: The Java Language Specification strongly discourages the usage
- * of "public" and "abstract" for method declarations in interface definitions
- * as a matter of style.
- *
- *
- * Variables in interfaces and annotations are automatically public, static and
- * final, so these modifiers are redundant as well.
- *
- *
- * As annotations are a form of interface, their fields are also automatically
- * public, static and final just as their annotation fields are automatically
- * public and abstract.
- *
- *
- * Final classes by definition can not be extended so the final modifier on the
- * method of a final class is redundant.
- *
- *
- * An example of how to configure the check is:
- *
- *
- * <module name="RedundantModifier"/>
- *
* @author lkuehne
*/
public class RedundantModifierCheck
diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages.properties
new file mode 100755
index 000000000..e75988f6b
--- /dev/null
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages.properties
@@ -0,0 +1 @@
+redundantModifier=Redundant ''{0}'' modifier.
diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_de.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_de.properties
new file mode 100755
index 000000000..245fceccf
--- /dev/null
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_de.properties
@@ -0,0 +1 @@
+redundantModifier=Überflüssiger Modifier ''{0}''.
diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_fi.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_fi.properties
new file mode 100755
index 000000000..903adbb42
--- /dev/null
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_fi.properties
@@ -0,0 +1 @@
+redundantModifier=Tarpeeton määrite: ''{0}''
diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_fr.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_fr.properties
new file mode 100755
index 000000000..8a2da29dd
--- /dev/null
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_fr.properties
@@ -0,0 +1,2 @@
+redundantModifier=Mot-clef ''{0}'' redondant.
+
diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_ja.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_ja.properties
new file mode 100755
index 000000000..31fa30a30
--- /dev/null
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_ja.properties
@@ -0,0 +1,3 @@
+
+redundantModifier=¾éĹ¤Ê ''{0}'' ½¤¾þ»Ò¤Ç¤¹¡£
+
diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_pt.properties b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_pt.properties
new file mode 100755
index 000000000..b28a3ffef
--- /dev/null
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/messages_pt.properties
@@ -0,0 +1,3 @@
+
+redundantModifier=Modificador ''{0}'' é redundante.
+
diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/package.html b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/package.html
new file mode 100755
index 000000000..cc9469f88
--- /dev/null
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/modifier/package.html
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
Contains the modifier checks that are bundled with the main distribution.
+
+
+
diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checkstyle_packages.xml b/src/checkstyle/com/puppycrawl/tools/checkstyle/checkstyle_packages.xml
index 887b67235..76944cf23 100644
--- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checkstyle_packages.xml
+++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checkstyle_packages.xml
@@ -16,6 +16,7 @@
+
diff --git a/src/tests/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java b/src/tests/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java
index b987b4247..5070090ca 100644
--- a/src/tests/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java
+++ b/src/tests/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java
@@ -60,6 +60,7 @@ public class PackageNamesLoaderTest extends TestCase
"com.puppycrawl.tools.checkstyle.checks.indentation.",
"com.puppycrawl.tools.checkstyle.checks.javadoc.",
"com.puppycrawl.tools.checkstyle.checks.metrics.",
+ "com.puppycrawl.tools.checkstyle.checks.modifier.",
"com.puppycrawl.tools.checkstyle.checks.naming.",
"com.puppycrawl.tools.checkstyle.checks.sizes.",
"com.puppycrawl.tools.checkstyle.checks.whitespace.",
diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/AllTests.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/AllTests.java
index 9814fdd22..14c3d073b 100644
--- a/src/tests/com/puppycrawl/tools/checkstyle/checks/AllTests.java
+++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/AllTests.java
@@ -1,5 +1,7 @@
package com.puppycrawl.tools.checkstyle.checks;
+import com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierTest;
+
import junit.framework.Test;
import junit.framework.TestSuite;
diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/RedundantModifierTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierTest.java
similarity index 88%
rename from src/tests/com/puppycrawl/tools/checkstyle/checks/RedundantModifierTest.java
rename to src/tests/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierTest.java
index 3dd45aaf8..a7c0f22c9 100644
--- a/src/tests/com/puppycrawl/tools/checkstyle/checks/RedundantModifierTest.java
+++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierTest.java
@@ -1,7 +1,8 @@
-package com.puppycrawl.tools.checkstyle.checks;
+package com.puppycrawl.tools.checkstyle.checks.modifier;
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
+import com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierCheck;
public class RedundantModifierTest
extends BaseCheckTestCase
diff --git a/src/xdocs/config_modifiers.xml b/src/xdocs/config_modifier.xml
similarity index 70%
rename from src/xdocs/config_modifiers.xml
rename to src/xdocs/config_modifier.xml
index ff818ab18..72e524a20 100755
--- a/src/xdocs/config_modifiers.xml
+++ b/src/xdocs/config_modifier.xml
@@ -71,39 +71,41 @@
TreeWalker
+
-
+
+
+
- Checks that:
+ Checks for redundant modifiers in interface and annotation
+ definitions. Also checks for redundant final modifiers on
+ methods of final classes.
+
+
+
+ Rationale: The Java Language Specification strongly
+ discourages the usage of "public" and "abstract" for method
+ declarations in interface definitions as a matter of style.
+
+
+
+ Variables in interfaces and annotations are automatically
+ public, static and final, so these modifiers are redundant as
+ well.
- variable declarations in interfaces include none of the following
- modifiers: public, static, final
- (variables in interface definitions are constants and have these
- modifiers implicitly, see the Java
- Language specification, section 9.3).
-
-
-
+
+ As annotations are a form of interface, their fields are also
+ automatically public, static and final just as their
+ annotation fields are automatically public and abstract.
+
+
+ Final classes by definition can not be extended so the final
+ modifier on the method of a final class is redundant.
+