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 @@- 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.
-+ 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. +
+| METHOD_DEF, VARIABLE_DEF + href="api/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">VARIABLE_DEF, + ANNOTATION_FIELD_DEF |
To configure the check to check only methods and not variables:
diff --git a/src/xdocs/stylesheets/project.xml b/src/xdocs/stylesheets/project.xml index 5f807bd03..9dcae93c1 100644 --- a/src/xdocs/stylesheets/project.xml +++ b/src/xdocs/stylesheets/project.xml @@ -32,7 +32,7 @@