From 7feaf606e8826f4a857ce10a044f2c464164ea8f Mon Sep 17 00:00:00 2001 From: Rick Giles Date: Thu, 19 Dec 2002 09:46:36 +0000 Subject: [PATCH] Prevent user from changing tokens in the configuration. --- .../checks/IllegalInstantiationCheck.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/IllegalInstantiationCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/IllegalInstantiationCheck.java index 9c33275c4..ce325d34c 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/IllegalInstantiationCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/IllegalInstantiationCheck.java @@ -81,7 +81,26 @@ public class IllegalInstantiationCheck TokenTypes.PACKAGE_DEF }; } - + + /** + * Prevent user from changing tokens in the configuration. + * @see com.puppycrawl.tools.checkstyle.api.Check + */ + public int[] getAcceptableTokens() + { + return new int[] {}; + } + + /** @see com.puppycrawl.tools.checkstyle.api.Check */ + public int[] getRequiredTokens() + { + return new int[] { + TokenTypes.IMPORT, + TokenTypes.LITERAL_NEW, + TokenTypes.PACKAGE_DEF + }; + } + /** @see com.puppycrawl.tools.checkstyle.api.Check */ public void beginTree() {