001////////////////////////////////////////////////////////////////////////////////
002// checkstyle: Checks Java source code for adherence to a set of rules.
003// Copyright (C) 2001-2021 the original author or authors.
004//
005// This library is free software; you can redistribute it and/or
006// modify it under the terms of the GNU Lesser General Public
007// License as published by the Free Software Foundation; either
008// version 2.1 of the License, or (at your option) any later version.
009//
010// This library is distributed in the hope that it will be useful,
011// but WITHOUT ANY WARRANTY; without even the implied warranty of
012// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013// Lesser General Public License for more details.
014//
015// You should have received a copy of the GNU Lesser General Public
016// License along with this library; if not, write to the Free Software
017// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
018////////////////////////////////////////////////////////////////////////////////
019
020package com.puppycrawl.tools.checkstyle;
021
022import java.io.IOException;
023import java.util.Collections;
024import java.util.HashMap;
025import java.util.LinkedHashSet;
026import java.util.List;
027import java.util.Map;
028import java.util.Map.Entry;
029import java.util.Set;
030import java.util.stream.Collectors;
031import java.util.stream.Stream;
032
033import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
034import com.puppycrawl.tools.checkstyle.api.Violation;
035import com.puppycrawl.tools.checkstyle.utils.ModuleReflectionUtil;
036
037/**
038 * A factory for creating objects from package names and names.
039 * Consider the below example for better understanding.
040 * <ul>
041 *     <li>module name - name of java class that represents module;</li>
042 *     <li>module full name - fully qualifies name of java class that represents module;</li>
043 *     <li>check module short name - name of Check without 'Check' suffix;</li>
044 *     <li>check module name - name of java class that represents Check (with 'Check' suffix);</li>
045 *     <li>
046 *         check module full name - fully qualifies name of java class
047 *         that represents Check (with 'Check' suffix).
048 *     </li>
049 * </ul>
050 */
051public class PackageObjectFactory implements ModuleFactory {
052
053    /**
054     * Enum class to define loading options.
055     */
056    public enum ModuleLoadOption {
057
058        /**
059         * Searching from registered checkstyle modules and from packages given in constructor.
060         **/
061        SEARCH_REGISTERED_PACKAGES,
062        /**
063         * As SEARCH_REGISTERED_PACKAGES and also try to load class from all of packages given in
064         * constructor.
065         * Required for eclipse-cs plugin.
066         **/
067        TRY_IN_ALL_REGISTERED_PACKAGES,
068
069    }
070
071    /** Base package of checkstyle modules checks. */
072    public static final String BASE_PACKAGE = "com.puppycrawl.tools.checkstyle";
073
074    /** Exception message when it is unable to create a class instance. */
075    public static final String UNABLE_TO_INSTANTIATE_EXCEPTION_MESSAGE =
076            "PackageObjectFactory.unableToInstantiateExceptionMessage";
077
078    /** Exception message when there is ambiguous module name in config file. */
079    public static final String AMBIGUOUS_MODULE_NAME_EXCEPTION_MESSAGE =
080            "PackageObjectFactory.ambiguousModuleNameExceptionMessage";
081
082    /** Suffix of checks. */
083    public static final String CHECK_SUFFIX = "Check";
084
085    /** Character separate package names in qualified name of java class. */
086    public static final String PACKAGE_SEPARATOR = ".";
087
088    /** Exception message when null class loader is given. */
089    public static final String NULL_LOADER_MESSAGE = "moduleClassLoader must not be null";
090
091    /** Exception message when null package name is given. */
092    public static final String NULL_PACKAGE_MESSAGE = "package name must not be null";
093
094    /** Separator to use in strings. */
095    public static final String STRING_SEPARATOR = ", ";
096
097    /** Map of Checkstyle module names to their fully qualified names. */
098    private static final Map<String, String> NAME_TO_FULL_MODULE_NAME = new HashMap<>();
099
100    /** A list of package names to prepend to class names. */
101    private final Set<String> packages;
102
103    /** The class loader used to load Checkstyle core and custom modules. */
104    private final ClassLoader moduleClassLoader;
105
106    /** Map of third party Checkstyle module names to the set of their fully qualified names. */
107    private Map<String, Set<String>> thirdPartyNameToFullModuleNames;
108
109    /** Module load option which defines class search type. */
110    private ModuleLoadOption moduleLoadOption;
111
112    static {
113        fillShortToFullModuleNamesMap();
114    }
115
116    /**
117     * Creates a new {@code PackageObjectFactory} instance.
118     *
119     * @param packageNames the list of package names to use
120     * @param moduleClassLoader class loader used to load Checkstyle
121     *          core and custom modules
122     */
123    public PackageObjectFactory(Set<String> packageNames, ClassLoader moduleClassLoader) {
124        this(packageNames, moduleClassLoader, ModuleLoadOption.SEARCH_REGISTERED_PACKAGES);
125    }
126
127    /**
128     * Creates a new {@code PackageObjectFactory} instance.
129     *
130     * @param packageNames the list of package names to use
131     * @param moduleClassLoader class loader used to load Checkstyle
132     *          core and custom modules
133     * @param moduleLoadOption loading option
134     * @throws IllegalArgumentException if moduleClassLoader is null or packageNames contains null
135     */
136    public PackageObjectFactory(Set<String> packageNames, ClassLoader moduleClassLoader,
137            ModuleLoadOption moduleLoadOption) {
138        if (moduleClassLoader == null) {
139            throw new IllegalArgumentException(NULL_LOADER_MESSAGE);
140        }
141        if (packageNames.contains(null)) {
142            throw new IllegalArgumentException(NULL_PACKAGE_MESSAGE);
143        }
144
145        // create a copy of the given set, but retain ordering
146        packages = new LinkedHashSet<>(packageNames);
147        this.moduleClassLoader = moduleClassLoader;
148        this.moduleLoadOption = moduleLoadOption;
149    }
150
151    /**
152     * Creates a new {@code PackageObjectFactory} instance.
153     *
154     * @param packageName The package name to use
155     * @param moduleClassLoader class loader used to load Checkstyle
156     *          core and custom modules
157     * @throws IllegalArgumentException if moduleClassLoader is null or packageNames is null
158     */
159    public PackageObjectFactory(String packageName, ClassLoader moduleClassLoader) {
160        if (moduleClassLoader == null) {
161            throw new IllegalArgumentException(NULL_LOADER_MESSAGE);
162        }
163        if (packageName == null) {
164            throw new IllegalArgumentException(NULL_PACKAGE_MESSAGE);
165        }
166
167        packages = Collections.singleton(packageName);
168        this.moduleClassLoader = moduleClassLoader;
169    }
170
171    /**
172     * Creates a new instance of a class from a given name, or that name
173     * concatenated with &quot;Check&quot;. If the name is
174     * a class name, creates an instance of the named class. Otherwise, creates
175     * an instance of a class name obtained by concatenating the given name
176     * to a package name from a given list of package names.
177     *
178     * @param name the name of a class.
179     * @return the {@code Object} created by loader.
180     * @throws CheckstyleException if an error occurs.
181     */
182    @Override
183    public Object createModule(String name) throws CheckstyleException {
184        Object instance = null;
185        // if the name is a simple class name, try to find it in maps at first
186        if (!name.contains(PACKAGE_SEPARATOR)) {
187            instance = createFromStandardCheckSet(name);
188            // find the name in third party map
189            if (instance == null) {
190                if (thirdPartyNameToFullModuleNames == null) {
191                    thirdPartyNameToFullModuleNames =
192                            generateThirdPartyNameToFullModuleName(moduleClassLoader);
193                }
194                instance = createObjectFromMap(name, thirdPartyNameToFullModuleNames);
195            }
196        }
197        if (instance == null) {
198            instance = createObject(name);
199        }
200        if (instance == null
201                && moduleLoadOption == ModuleLoadOption.TRY_IN_ALL_REGISTERED_PACKAGES) {
202            instance = createModuleByTryInEachPackage(name);
203        }
204        if (instance == null) {
205            String attemptedNames = null;
206            if (!name.contains(PACKAGE_SEPARATOR)) {
207                final String nameCheck = name + CHECK_SUFFIX;
208                attemptedNames = joinPackageNamesWithClassName(name, packages)
209                        + STRING_SEPARATOR + nameCheck + STRING_SEPARATOR
210                        + joinPackageNamesWithClassName(nameCheck, packages);
211            }
212            final Violation exceptionMessage = new Violation(1,
213                Definitions.CHECKSTYLE_BUNDLE, UNABLE_TO_INSTANTIATE_EXCEPTION_MESSAGE,
214                new String[] {name, attemptedNames}, null, getClass(), null);
215            throw new CheckstyleException(exceptionMessage.getViolation());
216        }
217        return instance;
218    }
219
220    /**
221     * Create object from one of Checkstyle module names.
222     *
223     * @param name name of module.
224     * @return instance of module.
225     * @throws CheckstyleException if the class fails to instantiate or there are ambiguous classes.
226     */
227    private Object createFromStandardCheckSet(String name) throws CheckstyleException {
228        final String fullModuleName = NAME_TO_FULL_MODULE_NAME.get(name);
229        Object instance = null;
230        if (fullModuleName == null) {
231            final String fullCheckModuleName =
232                    NAME_TO_FULL_MODULE_NAME.get(name + CHECK_SUFFIX);
233            if (fullCheckModuleName != null) {
234                instance = createObject(fullCheckModuleName);
235            }
236        }
237        else {
238            instance = createObject(fullModuleName);
239        }
240        return instance;
241    }
242
243    /**
244     * Create object with the help of the supplied map.
245     *
246     * @param name name of module.
247     * @param map the supplied map.
248     * @return instance of module if it is found in modules map and no ambiguous classes exist.
249     * @throws CheckstyleException if the class fails to instantiate or there are ambiguous classes.
250     */
251    private Object createObjectFromMap(String name, Map<String, Set<String>> map)
252            throws CheckstyleException {
253        final Set<String> fullModuleNames = map.get(name);
254        Object instance = null;
255        if (fullModuleNames == null) {
256            final Set<String> fullCheckModuleNames = map.get(name + CHECK_SUFFIX);
257            if (fullCheckModuleNames != null) {
258                instance = createObjectFromFullModuleNames(name, fullCheckModuleNames);
259            }
260        }
261        else {
262            instance = createObjectFromFullModuleNames(name, fullModuleNames);
263        }
264        return instance;
265    }
266
267    /**
268     * Create Object from optional full module names.
269     * In most case, there should be only one element in {@code fullModuleName}, otherwise
270     * an exception would be thrown.
271     *
272     * @param name name of module
273     * @param fullModuleNames the supplied full module names set
274     * @return instance of module if there is only one element in {@code fullModuleName}
275     * @throws CheckstyleException if the class fails to instantiate or there are more than one
276     *      element in {@code fullModuleName}
277     */
278    private Object createObjectFromFullModuleNames(String name, Set<String> fullModuleNames)
279            throws CheckstyleException {
280        final Object returnValue;
281        if (fullModuleNames.size() == 1) {
282            returnValue = createObject(fullModuleNames.iterator().next());
283        }
284        else {
285            final String optionalNames = fullModuleNames.stream()
286                    .sorted()
287                    .collect(Collectors.joining(STRING_SEPARATOR));
288            final Violation exceptionMessage = new Violation(1,
289                    Definitions.CHECKSTYLE_BUNDLE, AMBIGUOUS_MODULE_NAME_EXCEPTION_MESSAGE,
290                    new String[] {name, optionalNames}, null, getClass(), null);
291            throw new CheckstyleException(exceptionMessage.getViolation());
292        }
293        return returnValue;
294    }
295
296    /**
297     * Generate the map of third party Checkstyle module names to the set of their fully qualified
298     * names.
299     *
300     * @param loader the class loader used to load Checkstyle package names
301     * @return the map of third party Checkstyle module names to the set of their fully qualified
302     *      names
303     */
304    private Map<String, Set<String>> generateThirdPartyNameToFullModuleName(ClassLoader loader) {
305        Map<String, Set<String>> returnValue;
306        try {
307            returnValue = ModuleReflectionUtil.getCheckstyleModules(packages, loader).stream()
308                .collect(Collectors.groupingBy(Class::getSimpleName,
309                    Collectors.mapping(Class::getCanonicalName, Collectors.toSet())));
310        }
311        catch (IOException ignore) {
312            returnValue = Collections.emptyMap();
313        }
314        return returnValue;
315    }
316
317    /**
318     * Returns simple check name from full modules names map.
319     *
320     * @param fullName name of the class for joining.
321     * @return simple check name.
322     */
323    public static String getShortFromFullModuleNames(String fullName) {
324        return NAME_TO_FULL_MODULE_NAME
325                .entrySet()
326                .stream()
327                .filter(entry -> entry.getValue().equals(fullName))
328                .map(Entry::getKey)
329                .findFirst()
330                .orElse(fullName);
331    }
332
333    /**
334     * Creates a string by joining package names with a class name.
335     *
336     * @param className name of the class for joining.
337     * @param packages packages names.
338     * @return a string which is obtained by joining package names with a class name.
339     */
340    private static String joinPackageNamesWithClassName(String className, Set<String> packages) {
341        return packages.stream().collect(
342            Collectors.joining(PACKAGE_SEPARATOR + className + STRING_SEPARATOR, "",
343                    PACKAGE_SEPARATOR + className));
344    }
345
346    /**
347     * Creates a new instance of a named class.
348     *
349     * @param className the name of the class to instantiate.
350     * @return the {@code Object} created by loader or null.
351     * @throws CheckstyleException if the class fails to instantiate.
352     */
353    private Object createObject(String className) throws CheckstyleException {
354        Class<?> clazz = null;
355
356        try {
357            clazz = Class.forName(className, true, moduleClassLoader);
358        }
359        catch (final ReflectiveOperationException | NoClassDefFoundError ignored) {
360            // ignore the exception
361        }
362
363        Object instance = null;
364
365        if (clazz != null) {
366            try {
367                instance = clazz.getDeclaredConstructor().newInstance();
368            }
369            catch (final ReflectiveOperationException ex) {
370                throw new CheckstyleException("Unable to instantiate " + className, ex);
371            }
372        }
373
374        return instance;
375    }
376
377    /**
378     * Searching to class with given name (or name concatenated with &quot;Check&quot;) in existing
379     * packages. Returns instance if class found or, otherwise, null.
380     *
381     * @param name the name of a class.
382     * @return the {@code Object} created by loader.
383     * @throws CheckstyleException if an error occurs.
384     */
385    private Object createModuleByTryInEachPackage(String name) throws CheckstyleException {
386        final List<String> possibleNames = packages.stream()
387            .map(packageName -> packageName + PACKAGE_SEPARATOR + name)
388            .flatMap(className -> Stream.of(className, className + CHECK_SUFFIX))
389            .collect(Collectors.toList());
390        Object instance = null;
391        for (String possibleName : possibleNames) {
392            instance = createObject(possibleName);
393            if (instance != null) {
394                break;
395            }
396        }
397        return instance;
398    }
399
400    /**
401     * Fill short-to-full module names map.
402     */
403    private static void fillShortToFullModuleNamesMap() {
404        fillChecksFromAnnotationPackage();
405        fillChecksFromBlocksPackage();
406        fillChecksFromCodingPackage();
407        fillChecksFromDesignPackage();
408        fillChecksFromHeaderPackage();
409        fillChecksFromImportsPackage();
410        fillChecksFromIndentationPackage();
411        fillChecksFromJavadocPackage();
412        fillChecksFromMetricsPackage();
413        fillChecksFromModifierPackage();
414        fillChecksFromNamingPackage();
415        fillChecksFromRegexpPackage();
416        fillChecksFromSizesPackage();
417        fillChecksFromWhitespacePackage();
418        fillModulesFromChecksPackage();
419        fillModulesFromFilefiltersPackage();
420        fillModulesFromFiltersPackage();
421        fillModulesFromCheckstylePackage();
422    }
423
424    /**
425     * Fill short-to-full module names map with Checks from annotation package.
426     */
427    private static void fillChecksFromAnnotationPackage() {
428        NAME_TO_FULL_MODULE_NAME.put("AnnotationLocationCheck",
429                BASE_PACKAGE + ".checks.annotation.AnnotationLocationCheck");
430        NAME_TO_FULL_MODULE_NAME.put("AnnotationOnSameLineCheck",
431                BASE_PACKAGE + ".checks.annotation.AnnotationOnSameLineCheck");
432        NAME_TO_FULL_MODULE_NAME.put("AnnotationUseStyleCheck",
433                BASE_PACKAGE + ".checks.annotation.AnnotationUseStyleCheck");
434        NAME_TO_FULL_MODULE_NAME.put("MissingDeprecatedCheck",
435                BASE_PACKAGE + ".checks.annotation.MissingDeprecatedCheck");
436        NAME_TO_FULL_MODULE_NAME.put("MissingOverrideCheck",
437                BASE_PACKAGE + ".checks.annotation.MissingOverrideCheck");
438        NAME_TO_FULL_MODULE_NAME.put("PackageAnnotationCheck",
439                BASE_PACKAGE + ".checks.annotation.PackageAnnotationCheck");
440        NAME_TO_FULL_MODULE_NAME.put("SuppressWarningsCheck",
441                BASE_PACKAGE + ".checks.annotation.SuppressWarningsCheck");
442    }
443
444    /**
445     * Fill short-to-full module names map with Checks from blocks package.
446     */
447    private static void fillChecksFromBlocksPackage() {
448        NAME_TO_FULL_MODULE_NAME.put("AvoidNestedBlocksCheck",
449                BASE_PACKAGE + ".checks.blocks.AvoidNestedBlocksCheck");
450        NAME_TO_FULL_MODULE_NAME.put("EmptyBlockCheck",
451                BASE_PACKAGE + ".checks.blocks.EmptyBlockCheck");
452        NAME_TO_FULL_MODULE_NAME.put("EmptyCatchBlockCheck",
453                BASE_PACKAGE + ".checks.blocks.EmptyCatchBlockCheck");
454        NAME_TO_FULL_MODULE_NAME.put("LeftCurlyCheck",
455                BASE_PACKAGE + ".checks.blocks.LeftCurlyCheck");
456        NAME_TO_FULL_MODULE_NAME.put("NeedBracesCheck",
457                BASE_PACKAGE + ".checks.blocks.NeedBracesCheck");
458        NAME_TO_FULL_MODULE_NAME.put("RightCurlyCheck",
459                BASE_PACKAGE + ".checks.blocks.RightCurlyCheck");
460    }
461
462    /**
463     * Fill short-to-full module names map with Checks from coding package.
464     */
465    // -@cs[ExecutableStatementCount] splitting this method is not reasonable.
466    // -@cs[JavaNCSS] splitting this method is not reasonable.
467    private static void fillChecksFromCodingPackage() {
468        NAME_TO_FULL_MODULE_NAME.put("ArrayTrailingCommaCheck",
469                BASE_PACKAGE + ".checks.coding.ArrayTrailingCommaCheck");
470        NAME_TO_FULL_MODULE_NAME.put("AvoidDoubleBraceInitializationCheck",
471                BASE_PACKAGE + ".checks.coding.AvoidDoubleBraceInitializationCheck");
472        NAME_TO_FULL_MODULE_NAME.put("AvoidInlineConditionalsCheck",
473                BASE_PACKAGE + ".checks.coding.AvoidInlineConditionalsCheck");
474        NAME_TO_FULL_MODULE_NAME.put("AvoidNoArgumentSuperConstructorCallCheck",
475                BASE_PACKAGE + ".checks.coding.AvoidNoArgumentSuperConstructorCallCheck");
476        NAME_TO_FULL_MODULE_NAME.put("CovariantEqualsCheck",
477                BASE_PACKAGE + ".checks.coding.CovariantEqualsCheck");
478        NAME_TO_FULL_MODULE_NAME.put("DeclarationOrderCheck",
479                BASE_PACKAGE + ".checks.coding.DeclarationOrderCheck");
480        NAME_TO_FULL_MODULE_NAME.put("DefaultComesLastCheck",
481                BASE_PACKAGE + ".checks.coding.DefaultComesLastCheck");
482        NAME_TO_FULL_MODULE_NAME.put("EmptyStatementCheck",
483                BASE_PACKAGE + ".checks.coding.EmptyStatementCheck");
484        NAME_TO_FULL_MODULE_NAME.put("EqualsAvoidNullCheck",
485                BASE_PACKAGE + ".checks.coding.EqualsAvoidNullCheck");
486        NAME_TO_FULL_MODULE_NAME.put("EqualsHashCodeCheck",
487                BASE_PACKAGE + ".checks.coding.EqualsHashCodeCheck");
488        NAME_TO_FULL_MODULE_NAME.put("ExplicitInitializationCheck",
489                BASE_PACKAGE + ".checks.coding.ExplicitInitializationCheck");
490        NAME_TO_FULL_MODULE_NAME.put("FallThroughCheck",
491                BASE_PACKAGE + ".checks.coding.FallThroughCheck");
492        NAME_TO_FULL_MODULE_NAME.put("FinalLocalVariableCheck",
493                BASE_PACKAGE + ".checks.coding.FinalLocalVariableCheck");
494        NAME_TO_FULL_MODULE_NAME.put("HiddenFieldCheck",
495                BASE_PACKAGE + ".checks.coding.HiddenFieldCheck");
496        NAME_TO_FULL_MODULE_NAME.put("IllegalCatchCheck",
497                BASE_PACKAGE + ".checks.coding.IllegalCatchCheck");
498        NAME_TO_FULL_MODULE_NAME.put("IllegalInstantiationCheck",
499                BASE_PACKAGE + ".checks.coding.IllegalInstantiationCheck");
500        NAME_TO_FULL_MODULE_NAME.put("IllegalThrowsCheck",
501                BASE_PACKAGE + ".checks.coding.IllegalThrowsCheck");
502        NAME_TO_FULL_MODULE_NAME.put("IllegalTokenCheck",
503                BASE_PACKAGE + ".checks.coding.IllegalTokenCheck");
504        NAME_TO_FULL_MODULE_NAME.put("IllegalTokenTextCheck",
505                BASE_PACKAGE + ".checks.coding.IllegalTokenTextCheck");
506        NAME_TO_FULL_MODULE_NAME.put("IllegalTypeCheck",
507                BASE_PACKAGE + ".checks.coding.IllegalTypeCheck");
508        NAME_TO_FULL_MODULE_NAME.put("InnerAssignmentCheck",
509                BASE_PACKAGE + ".checks.coding.InnerAssignmentCheck");
510        NAME_TO_FULL_MODULE_NAME.put("MagicNumberCheck",
511                BASE_PACKAGE + ".checks.coding.MagicNumberCheck");
512        NAME_TO_FULL_MODULE_NAME.put("MissingCtorCheck",
513                BASE_PACKAGE + ".checks.coding.MissingCtorCheck");
514        NAME_TO_FULL_MODULE_NAME.put("MissingSwitchDefaultCheck",
515                BASE_PACKAGE + ".checks.coding.MissingSwitchDefaultCheck");
516        NAME_TO_FULL_MODULE_NAME.put("ModifiedControlVariableCheck",
517                BASE_PACKAGE + ".checks.coding.ModifiedControlVariableCheck");
518        NAME_TO_FULL_MODULE_NAME.put("MultipleStringLiteralsCheck",
519                BASE_PACKAGE + ".checks.coding.MultipleStringLiteralsCheck");
520        NAME_TO_FULL_MODULE_NAME.put("MultipleVariableDeclarationsCheck",
521                BASE_PACKAGE + ".checks.coding.MultipleVariableDeclarationsCheck");
522        NAME_TO_FULL_MODULE_NAME.put("NestedForDepthCheck",
523                BASE_PACKAGE + ".checks.coding.NestedForDepthCheck");
524        NAME_TO_FULL_MODULE_NAME.put("NestedIfDepthCheck",
525                BASE_PACKAGE + ".checks.coding.NestedIfDepthCheck");
526        NAME_TO_FULL_MODULE_NAME.put("NestedTryDepthCheck",
527                BASE_PACKAGE + ".checks.coding.NestedTryDepthCheck");
528        NAME_TO_FULL_MODULE_NAME.put("NoCloneCheck",
529                BASE_PACKAGE + ".checks.coding.NoCloneCheck");
530        NAME_TO_FULL_MODULE_NAME.put("NoEnumTrailingCommaCheck",
531                BASE_PACKAGE + ".checks.coding.NoEnumTrailingCommaCheck");
532        NAME_TO_FULL_MODULE_NAME.put("NoFinalizerCheck",
533                BASE_PACKAGE + ".checks.coding.NoFinalizerCheck");
534        NAME_TO_FULL_MODULE_NAME.put("OneStatementPerLineCheck",
535                BASE_PACKAGE + ".checks.coding.OneStatementPerLineCheck");
536        NAME_TO_FULL_MODULE_NAME.put("OverloadMethodsDeclarationOrderCheck",
537                BASE_PACKAGE + ".checks.coding.OverloadMethodsDeclarationOrderCheck");
538        NAME_TO_FULL_MODULE_NAME.put("PackageDeclarationCheck",
539                BASE_PACKAGE + ".checks.coding.PackageDeclarationCheck");
540        NAME_TO_FULL_MODULE_NAME.put("ParameterAssignmentCheck",
541                BASE_PACKAGE + ".checks.coding.ParameterAssignmentCheck");
542        NAME_TO_FULL_MODULE_NAME.put("RequireThisCheck",
543                BASE_PACKAGE + ".checks.coding.RequireThisCheck");
544        NAME_TO_FULL_MODULE_NAME.put("ReturnCountCheck",
545                BASE_PACKAGE + ".checks.coding.ReturnCountCheck");
546        NAME_TO_FULL_MODULE_NAME.put("SimplifyBooleanExpressionCheck",
547                BASE_PACKAGE + ".checks.coding.SimplifyBooleanExpressionCheck");
548        NAME_TO_FULL_MODULE_NAME.put("SimplifyBooleanReturnCheck",
549                BASE_PACKAGE + ".checks.coding.SimplifyBooleanReturnCheck");
550        NAME_TO_FULL_MODULE_NAME.put("StringLiteralEqualityCheck",
551                BASE_PACKAGE + ".checks.coding.StringLiteralEqualityCheck");
552        NAME_TO_FULL_MODULE_NAME.put("SuperCloneCheck",
553                BASE_PACKAGE + ".checks.coding.SuperCloneCheck");
554        NAME_TO_FULL_MODULE_NAME.put("SuperFinalizeCheck",
555                BASE_PACKAGE + ".checks.coding.SuperFinalizeCheck");
556        NAME_TO_FULL_MODULE_NAME.put("UnnecessaryParenthesesCheck",
557                BASE_PACKAGE + ".checks.coding.UnnecessaryParenthesesCheck");
558        NAME_TO_FULL_MODULE_NAME.put("UnnecessarySemicolonAfterOuterTypeDeclarationCheck",
559                BASE_PACKAGE
560                        + ".checks.coding.UnnecessarySemicolonAfterOuterTypeDeclarationCheck");
561        NAME_TO_FULL_MODULE_NAME.put("UnnecessarySemicolonAfterTypeMemberDeclarationCheck",
562                BASE_PACKAGE
563                    + ".checks.coding.UnnecessarySemicolonAfterTypeMemberDeclarationCheck");
564        NAME_TO_FULL_MODULE_NAME.put("UnnecessarySemicolonInEnumerationCheck",
565                BASE_PACKAGE + ".checks.coding.UnnecessarySemicolonInEnumerationCheck");
566        NAME_TO_FULL_MODULE_NAME.put("UnnecessarySemicolonInTryWithResourcesCheck",
567                BASE_PACKAGE + ".checks.coding.UnnecessarySemicolonInTryWithResourcesCheck");
568        NAME_TO_FULL_MODULE_NAME.put("VariableDeclarationUsageDistanceCheck",
569                BASE_PACKAGE + ".checks.coding.VariableDeclarationUsageDistanceCheck");
570        NAME_TO_FULL_MODULE_NAME.put("NoArrayTrailingCommaCheck",
571                BASE_PACKAGE + ".checks.coding.NoArrayTrailingCommaCheck");
572        NAME_TO_FULL_MODULE_NAME.put("MatchXpathCheck",
573                BASE_PACKAGE + ".checks.coding.MatchXpathCheck");
574    }
575
576    /**
577     * Fill short-to-full module names map with Checks from design package.
578     */
579    private static void fillChecksFromDesignPackage() {
580        NAME_TO_FULL_MODULE_NAME.put("DesignForExtensionCheck",
581                BASE_PACKAGE + ".checks.design.DesignForExtensionCheck");
582        NAME_TO_FULL_MODULE_NAME.put("FinalClassCheck",
583                BASE_PACKAGE + ".checks.design.FinalClassCheck");
584        NAME_TO_FULL_MODULE_NAME.put("HideUtilityClassConstructorCheck",
585                BASE_PACKAGE + ".checks.design.HideUtilityClassConstructorCheck");
586        NAME_TO_FULL_MODULE_NAME.put("InnerTypeLastCheck",
587                BASE_PACKAGE + ".checks.design.InnerTypeLastCheck");
588        NAME_TO_FULL_MODULE_NAME.put("InterfaceIsTypeCheck",
589                BASE_PACKAGE + ".checks.design.InterfaceIsTypeCheck");
590        NAME_TO_FULL_MODULE_NAME.put("MutableExceptionCheck",
591                BASE_PACKAGE + ".checks.design.MutableExceptionCheck");
592        NAME_TO_FULL_MODULE_NAME.put("OneTopLevelClassCheck",
593                BASE_PACKAGE + ".checks.design.OneTopLevelClassCheck");
594        NAME_TO_FULL_MODULE_NAME.put("ThrowsCountCheck",
595                BASE_PACKAGE + ".checks.design.ThrowsCountCheck");
596        NAME_TO_FULL_MODULE_NAME.put("VisibilityModifierCheck",
597                BASE_PACKAGE + ".checks.design.VisibilityModifierCheck");
598    }
599
600    /**
601     * Fill short-to-full module names map with Checks from header package.
602     */
603    private static void fillChecksFromHeaderPackage() {
604        NAME_TO_FULL_MODULE_NAME.put("HeaderCheck",
605                BASE_PACKAGE + ".checks.header.HeaderCheck");
606        NAME_TO_FULL_MODULE_NAME.put("RegexpHeaderCheck",
607                BASE_PACKAGE + ".checks.header.RegexpHeaderCheck");
608    }
609
610    /**
611     * Fill short-to-full module names map with Checks from imports package.
612     */
613    private static void fillChecksFromImportsPackage() {
614        NAME_TO_FULL_MODULE_NAME.put("AvoidStarImportCheck",
615                BASE_PACKAGE + ".checks.imports.AvoidStarImportCheck");
616        NAME_TO_FULL_MODULE_NAME.put("AvoidStaticImportCheck",
617                BASE_PACKAGE + ".checks.imports.AvoidStaticImportCheck");
618        NAME_TO_FULL_MODULE_NAME.put("CustomImportOrderCheck",
619                BASE_PACKAGE + ".checks.imports.CustomImportOrderCheck");
620        NAME_TO_FULL_MODULE_NAME.put("IllegalImportCheck",
621                BASE_PACKAGE + ".checks.imports.IllegalImportCheck");
622        NAME_TO_FULL_MODULE_NAME.put("ImportControlCheck",
623                BASE_PACKAGE + ".checks.imports.ImportControlCheck");
624        NAME_TO_FULL_MODULE_NAME.put("ImportOrderCheck",
625                BASE_PACKAGE + ".checks.imports.ImportOrderCheck");
626        NAME_TO_FULL_MODULE_NAME.put("RedundantImportCheck",
627                BASE_PACKAGE + ".checks.imports.RedundantImportCheck");
628        NAME_TO_FULL_MODULE_NAME.put("UnusedImportsCheck",
629                BASE_PACKAGE + ".checks.imports.UnusedImportsCheck");
630    }
631
632    /**
633     * Fill short-to-full module names map with Checks from indentation package.
634     */
635    private static void fillChecksFromIndentationPackage() {
636        NAME_TO_FULL_MODULE_NAME.put("CommentsIndentationCheck",
637                BASE_PACKAGE + ".checks.indentation.CommentsIndentationCheck");
638        NAME_TO_FULL_MODULE_NAME.put("IndentationCheck",
639                BASE_PACKAGE + ".checks.indentation.IndentationCheck");
640    }
641
642    /**
643     * Fill short-to-full module names map with Checks from javadoc package.
644     */
645    private static void fillChecksFromJavadocPackage() {
646        NAME_TO_FULL_MODULE_NAME.put("AtclauseOrderCheck",
647                BASE_PACKAGE + ".checks.javadoc.AtclauseOrderCheck");
648        NAME_TO_FULL_MODULE_NAME.put("InvalidJavadocPositionCheck",
649                BASE_PACKAGE + ".checks.javadoc.InvalidJavadocPositionCheck");
650        NAME_TO_FULL_MODULE_NAME.put("JavadocBlockTagLocationCheck",
651                BASE_PACKAGE + ".checks.javadoc.JavadocBlockTagLocationCheck");
652        NAME_TO_FULL_MODULE_NAME.put("JavadocContentLocationCheck",
653                BASE_PACKAGE + ".checks.javadoc.JavadocContentLocationCheck");
654        NAME_TO_FULL_MODULE_NAME.put("JavadocMethodCheck",
655                BASE_PACKAGE + ".checks.javadoc.JavadocMethodCheck");
656        NAME_TO_FULL_MODULE_NAME.put("JavadocMissingLeadingAsteriskCheck",
657                BASE_PACKAGE + ".checks.javadoc.JavadocMissingLeadingAsteriskCheck");
658        NAME_TO_FULL_MODULE_NAME.put("JavadocMissingWhitespaceAfterAsteriskCheck",
659                BASE_PACKAGE + ".checks.javadoc.JavadocMissingWhitespaceAfterAsteriskCheck");
660        NAME_TO_FULL_MODULE_NAME.put("JavadocPackageCheck",
661                BASE_PACKAGE + ".checks.javadoc.JavadocPackageCheck");
662        NAME_TO_FULL_MODULE_NAME.put("JavadocParagraphCheck",
663                BASE_PACKAGE + ".checks.javadoc.JavadocParagraphCheck");
664        NAME_TO_FULL_MODULE_NAME.put("JavadocStyleCheck",
665                BASE_PACKAGE + ".checks.javadoc.JavadocStyleCheck");
666        NAME_TO_FULL_MODULE_NAME.put("JavadocTagContinuationIndentationCheck",
667                BASE_PACKAGE + ".checks.javadoc.JavadocTagContinuationIndentationCheck");
668        NAME_TO_FULL_MODULE_NAME.put("JavadocTypeCheck",
669                BASE_PACKAGE + ".checks.javadoc.JavadocTypeCheck");
670        NAME_TO_FULL_MODULE_NAME.put("JavadocVariableCheck",
671                BASE_PACKAGE + ".checks.javadoc.JavadocVariableCheck");
672        NAME_TO_FULL_MODULE_NAME.put("MissingJavadocMethodCheck",
673                BASE_PACKAGE + ".checks.javadoc.MissingJavadocMethodCheck");
674        NAME_TO_FULL_MODULE_NAME.put("MissingJavadocPackageCheck",
675                BASE_PACKAGE + ".checks.javadoc.MissingJavadocPackageCheck");
676        NAME_TO_FULL_MODULE_NAME.put("MissingJavadocTypeCheck",
677                BASE_PACKAGE + ".checks.javadoc.MissingJavadocTypeCheck");
678        NAME_TO_FULL_MODULE_NAME.put("NonEmptyAtclauseDescriptionCheck",
679                BASE_PACKAGE + ".checks.javadoc.NonEmptyAtclauseDescriptionCheck");
680        NAME_TO_FULL_MODULE_NAME.put("RequireEmptyLineBeforeBlockTagGroupCheck",
681                BASE_PACKAGE + ".checks.javadoc.RequireEmptyLineBeforeBlockTagGroupCheck");
682        NAME_TO_FULL_MODULE_NAME.put("SingleLineJavadocCheck",
683                BASE_PACKAGE + ".checks.javadoc.SingleLineJavadocCheck");
684        NAME_TO_FULL_MODULE_NAME.put("SummaryJavadocCheck",
685                BASE_PACKAGE + ".checks.javadoc.SummaryJavadocCheck");
686        NAME_TO_FULL_MODULE_NAME.put("WriteTagCheck",
687                BASE_PACKAGE + ".checks.javadoc.WriteTagCheck");
688    }
689
690    /**
691     * Fill short-to-full module names map with Checks from metrics package.
692     */
693    private static void fillChecksFromMetricsPackage() {
694        NAME_TO_FULL_MODULE_NAME.put("BooleanExpressionComplexityCheck",
695                BASE_PACKAGE + ".checks.metrics.BooleanExpressionComplexityCheck");
696        NAME_TO_FULL_MODULE_NAME.put("ClassDataAbstractionCouplingCheck",
697                BASE_PACKAGE + ".checks.metrics.ClassDataAbstractionCouplingCheck");
698        NAME_TO_FULL_MODULE_NAME.put("ClassFanOutComplexityCheck",
699                BASE_PACKAGE + ".checks.metrics.ClassFanOutComplexityCheck");
700        NAME_TO_FULL_MODULE_NAME.put("CyclomaticComplexityCheck",
701                BASE_PACKAGE + ".checks.metrics.CyclomaticComplexityCheck");
702        NAME_TO_FULL_MODULE_NAME.put("JavaNCSSCheck",
703                BASE_PACKAGE + ".checks.metrics.JavaNCSSCheck");
704        NAME_TO_FULL_MODULE_NAME.put("NPathComplexityCheck",
705                BASE_PACKAGE + ".checks.metrics.NPathComplexityCheck");
706    }
707
708    /**
709     * Fill short-to-full module names map with Checks from modifier package.
710     */
711    private static void fillChecksFromModifierPackage() {
712        NAME_TO_FULL_MODULE_NAME.put("ClassMemberImpliedModifierCheck",
713            BASE_PACKAGE + ".checks.modifier.ClassMemberImpliedModifierCheck");
714        NAME_TO_FULL_MODULE_NAME.put("InterfaceMemberImpliedModifierCheck",
715            BASE_PACKAGE + ".checks.modifier.InterfaceMemberImpliedModifierCheck");
716        NAME_TO_FULL_MODULE_NAME.put("ModifierOrderCheck",
717                BASE_PACKAGE + ".checks.modifier.ModifierOrderCheck");
718        NAME_TO_FULL_MODULE_NAME.put("RedundantModifierCheck",
719                BASE_PACKAGE + ".checks.modifier.RedundantModifierCheck");
720    }
721
722    /**
723     * Fill short-to-full module names map with Checks from naming package.
724     */
725    private static void fillChecksFromNamingPackage() {
726        NAME_TO_FULL_MODULE_NAME.put("AbbreviationAsWordInNameCheck",
727                BASE_PACKAGE + ".checks.naming.AbbreviationAsWordInNameCheck");
728        NAME_TO_FULL_MODULE_NAME.put("AbstractClassNameCheck",
729                BASE_PACKAGE + ".checks.naming.AbstractClassNameCheck");
730        NAME_TO_FULL_MODULE_NAME.put("CatchParameterNameCheck",
731                BASE_PACKAGE + ".checks.naming.CatchParameterNameCheck");
732        NAME_TO_FULL_MODULE_NAME.put("ClassTypeParameterNameCheck",
733                BASE_PACKAGE + ".checks.naming.ClassTypeParameterNameCheck");
734        NAME_TO_FULL_MODULE_NAME.put("ConstantNameCheck",
735                BASE_PACKAGE + ".checks.naming.ConstantNameCheck");
736        NAME_TO_FULL_MODULE_NAME.put("InterfaceTypeParameterNameCheck",
737                BASE_PACKAGE + ".checks.naming.InterfaceTypeParameterNameCheck");
738        NAME_TO_FULL_MODULE_NAME.put("LambdaParameterNameCheck",
739                BASE_PACKAGE + ".checks.naming.LambdaParameterNameCheck");
740        NAME_TO_FULL_MODULE_NAME.put("LocalFinalVariableNameCheck",
741                BASE_PACKAGE + ".checks.naming.LocalFinalVariableNameCheck");
742        NAME_TO_FULL_MODULE_NAME.put("LocalVariableNameCheck",
743                BASE_PACKAGE + ".checks.naming.LocalVariableNameCheck");
744        NAME_TO_FULL_MODULE_NAME.put("MemberNameCheck",
745                BASE_PACKAGE + ".checks.naming.MemberNameCheck");
746        NAME_TO_FULL_MODULE_NAME.put("MethodNameCheck",
747                BASE_PACKAGE + ".checks.naming.MethodNameCheck");
748        NAME_TO_FULL_MODULE_NAME.put("MethodTypeParameterNameCheck",
749                BASE_PACKAGE + ".checks.naming.MethodTypeParameterNameCheck");
750        NAME_TO_FULL_MODULE_NAME.put("PackageNameCheck",
751                BASE_PACKAGE + ".checks.naming.PackageNameCheck");
752        NAME_TO_FULL_MODULE_NAME.put("ParameterNameCheck",
753                BASE_PACKAGE + ".checks.naming.ParameterNameCheck");
754        NAME_TO_FULL_MODULE_NAME.put("RecordComponentNameCheck",
755                BASE_PACKAGE + ".checks.naming.RecordComponentNameCheck");
756        NAME_TO_FULL_MODULE_NAME.put("RecordTypeParameterNameCheck",
757                BASE_PACKAGE + ".checks.naming.RecordTypeParameterNameCheck");
758        NAME_TO_FULL_MODULE_NAME.put("StaticVariableNameCheck",
759                BASE_PACKAGE + ".checks.naming.StaticVariableNameCheck");
760        NAME_TO_FULL_MODULE_NAME.put("TypeNameCheck",
761                BASE_PACKAGE + ".checks.naming.TypeNameCheck");
762        NAME_TO_FULL_MODULE_NAME.put("PatternVariableNameCheck",
763                BASE_PACKAGE + ".checks.naming.PatternVariableNameCheck");
764        NAME_TO_FULL_MODULE_NAME.put("IllegalIdentifierNameCheck",
765            BASE_PACKAGE + ".checks.naming.IllegalIdentifierNameCheck");
766    }
767
768    /**
769     * Fill short-to-full module names map with Checks from regexp package.
770     */
771    private static void fillChecksFromRegexpPackage() {
772        NAME_TO_FULL_MODULE_NAME.put("RegexpCheck",
773                BASE_PACKAGE + ".checks.regexp.RegexpCheck");
774        NAME_TO_FULL_MODULE_NAME.put("RegexpMultilineCheck",
775                BASE_PACKAGE + ".checks.regexp.RegexpMultilineCheck");
776        NAME_TO_FULL_MODULE_NAME.put("RegexpOnFilenameCheck",
777                BASE_PACKAGE + ".checks.regexp.RegexpOnFilenameCheck");
778        NAME_TO_FULL_MODULE_NAME.put("RegexpSinglelineCheck",
779                BASE_PACKAGE + ".checks.regexp.RegexpSinglelineCheck");
780        NAME_TO_FULL_MODULE_NAME.put("RegexpSinglelineJavaCheck",
781                BASE_PACKAGE + ".checks.regexp.RegexpSinglelineJavaCheck");
782    }
783
784    /**
785     * Fill short-to-full module names map with Checks from sizes package.
786     */
787    private static void fillChecksFromSizesPackage() {
788        NAME_TO_FULL_MODULE_NAME.put("AnonInnerLengthCheck",
789                BASE_PACKAGE + ".checks.sizes.AnonInnerLengthCheck");
790        NAME_TO_FULL_MODULE_NAME.put("ExecutableStatementCountCheck",
791                BASE_PACKAGE + ".checks.sizes.ExecutableStatementCountCheck");
792        NAME_TO_FULL_MODULE_NAME.put("FileLengthCheck",
793                BASE_PACKAGE + ".checks.sizes.FileLengthCheck");
794        NAME_TO_FULL_MODULE_NAME.put("LambdaBodyLengthCheck",
795                BASE_PACKAGE + ".checks.sizes.LambdaBodyLengthCheck");
796        NAME_TO_FULL_MODULE_NAME.put("LineLengthCheck",
797                BASE_PACKAGE + ".checks.sizes.LineLengthCheck");
798        NAME_TO_FULL_MODULE_NAME.put("MethodCountCheck",
799                BASE_PACKAGE + ".checks.sizes.MethodCountCheck");
800        NAME_TO_FULL_MODULE_NAME.put("MethodLengthCheck",
801                BASE_PACKAGE + ".checks.sizes.MethodLengthCheck");
802        NAME_TO_FULL_MODULE_NAME.put("OuterTypeNumberCheck",
803                BASE_PACKAGE + ".checks.sizes.OuterTypeNumberCheck");
804        NAME_TO_FULL_MODULE_NAME.put("ParameterNumberCheck",
805                BASE_PACKAGE + ".checks.sizes.ParameterNumberCheck");
806        NAME_TO_FULL_MODULE_NAME.put("RecordComponentNumberCheck",
807                BASE_PACKAGE + ".checks.sizes.RecordComponentNumberCheck");
808    }
809
810    /**
811     * Fill short-to-full module names map with Checks from whitespace package.
812     */
813    private static void fillChecksFromWhitespacePackage() {
814        NAME_TO_FULL_MODULE_NAME.put("EmptyForInitializerPadCheck",
815                BASE_PACKAGE + ".checks.whitespace.EmptyForInitializerPadCheck");
816        NAME_TO_FULL_MODULE_NAME.put("EmptyForIteratorPadCheck",
817                BASE_PACKAGE + ".checks.whitespace.EmptyForIteratorPadCheck");
818        NAME_TO_FULL_MODULE_NAME.put("EmptyLineSeparatorCheck",
819                BASE_PACKAGE + ".checks.whitespace.EmptyLineSeparatorCheck");
820        NAME_TO_FULL_MODULE_NAME.put("FileTabCharacterCheck",
821                BASE_PACKAGE + ".checks.whitespace.FileTabCharacterCheck");
822        NAME_TO_FULL_MODULE_NAME.put("GenericWhitespaceCheck",
823                BASE_PACKAGE + ".checks.whitespace.GenericWhitespaceCheck");
824        NAME_TO_FULL_MODULE_NAME.put("MethodParamPadCheck",
825                BASE_PACKAGE + ".checks.whitespace.MethodParamPadCheck");
826        NAME_TO_FULL_MODULE_NAME.put("NoLineWrapCheck",
827                BASE_PACKAGE + ".checks.whitespace.NoLineWrapCheck");
828        NAME_TO_FULL_MODULE_NAME.put("NoWhitespaceAfterCheck",
829                BASE_PACKAGE + ".checks.whitespace.NoWhitespaceAfterCheck");
830        NAME_TO_FULL_MODULE_NAME.put("NoWhitespaceBeforeCheck",
831                BASE_PACKAGE + ".checks.whitespace.NoWhitespaceBeforeCheck");
832        NAME_TO_FULL_MODULE_NAME.put("NoWhitespaceBeforeCaseDefaultColonCheck",
833                BASE_PACKAGE + ".checks.whitespace.NoWhitespaceBeforeCaseDefaultColonCheck");
834        NAME_TO_FULL_MODULE_NAME.put("OperatorWrapCheck",
835                BASE_PACKAGE + ".checks.whitespace.OperatorWrapCheck");
836        NAME_TO_FULL_MODULE_NAME.put("ParenPadCheck",
837                BASE_PACKAGE + ".checks.whitespace.ParenPadCheck");
838        NAME_TO_FULL_MODULE_NAME.put("SeparatorWrapCheck",
839                BASE_PACKAGE + ".checks.whitespace.SeparatorWrapCheck");
840        NAME_TO_FULL_MODULE_NAME.put("SingleSpaceSeparatorCheck",
841                BASE_PACKAGE + ".checks.whitespace.SingleSpaceSeparatorCheck");
842        NAME_TO_FULL_MODULE_NAME.put("TypecastParenPadCheck",
843                BASE_PACKAGE + ".checks.whitespace.TypecastParenPadCheck");
844        NAME_TO_FULL_MODULE_NAME.put("WhitespaceAfterCheck",
845                BASE_PACKAGE + ".checks.whitespace.WhitespaceAfterCheck");
846        NAME_TO_FULL_MODULE_NAME.put("WhitespaceAroundCheck",
847                BASE_PACKAGE + ".checks.whitespace.WhitespaceAroundCheck");
848    }
849
850    /**
851     * Fill short-to-full module names map with modules from checks package.
852     */
853    private static void fillModulesFromChecksPackage() {
854        NAME_TO_FULL_MODULE_NAME.put("ArrayTypeStyleCheck",
855                BASE_PACKAGE + ".checks.ArrayTypeStyleCheck");
856        NAME_TO_FULL_MODULE_NAME.put("AvoidEscapedUnicodeCharactersCheck",
857                BASE_PACKAGE + ".checks.AvoidEscapedUnicodeCharactersCheck");
858        NAME_TO_FULL_MODULE_NAME.put("DescendantTokenCheck",
859                BASE_PACKAGE + ".checks.DescendantTokenCheck");
860        NAME_TO_FULL_MODULE_NAME.put("FinalParametersCheck",
861                BASE_PACKAGE + ".checks.FinalParametersCheck");
862        NAME_TO_FULL_MODULE_NAME.put("NewlineAtEndOfFileCheck",
863                BASE_PACKAGE + ".checks.NewlineAtEndOfFileCheck");
864        NAME_TO_FULL_MODULE_NAME.put("NoCodeInFileCheck",
865                BASE_PACKAGE + ".checks.NoCodeInFileCheck");
866        NAME_TO_FULL_MODULE_NAME.put("OuterTypeFilenameCheck",
867                BASE_PACKAGE + ".checks.OuterTypeFilenameCheck");
868        NAME_TO_FULL_MODULE_NAME.put("OrderedPropertiesCheck",
869                BASE_PACKAGE + ".checks.OrderedPropertiesCheck");
870        NAME_TO_FULL_MODULE_NAME.put("SuppressWarningsHolder",
871                BASE_PACKAGE + ".checks.SuppressWarningsHolder");
872        NAME_TO_FULL_MODULE_NAME.put("TodoCommentCheck",
873                BASE_PACKAGE + ".checks.TodoCommentCheck");
874        NAME_TO_FULL_MODULE_NAME.put("TrailingCommentCheck",
875                BASE_PACKAGE + ".checks.TrailingCommentCheck");
876        NAME_TO_FULL_MODULE_NAME.put("TranslationCheck",
877                BASE_PACKAGE + ".checks.TranslationCheck");
878        NAME_TO_FULL_MODULE_NAME.put("UncommentedMainCheck",
879                BASE_PACKAGE + ".checks.UncommentedMainCheck");
880        NAME_TO_FULL_MODULE_NAME.put("UniquePropertiesCheck",
881                BASE_PACKAGE + ".checks.UniquePropertiesCheck");
882        NAME_TO_FULL_MODULE_NAME.put("UpperEllCheck",
883                BASE_PACKAGE + ".checks.UpperEllCheck");
884    }
885
886    /**
887     * Fill short-to-full module names map with modules from filefilters package.
888     */
889    private static void fillModulesFromFilefiltersPackage() {
890        NAME_TO_FULL_MODULE_NAME.put("BeforeExecutionExclusionFileFilter",
891                BASE_PACKAGE + ".filefilters.BeforeExecutionExclusionFileFilter");
892    }
893
894    /**
895     * Fill short-to-full module names map with modules from filters package.
896     */
897    private static void fillModulesFromFiltersPackage() {
898        NAME_TO_FULL_MODULE_NAME.put("SeverityMatchFilter",
899                BASE_PACKAGE + ".filters.SeverityMatchFilter");
900        NAME_TO_FULL_MODULE_NAME.put("SuppressWithPlainTextCommentFilter",
901            BASE_PACKAGE + ".filters.SuppressWithPlainTextCommentFilter");
902        NAME_TO_FULL_MODULE_NAME.put("SuppressionCommentFilter",
903                BASE_PACKAGE + ".filters.SuppressionCommentFilter");
904        NAME_TO_FULL_MODULE_NAME.put("SuppressionFilter",
905                BASE_PACKAGE + ".filters.SuppressionFilter");
906        NAME_TO_FULL_MODULE_NAME.put("SuppressionSingleFilter",
907                BASE_PACKAGE + ".filters.SuppressionSingleFilter");
908        NAME_TO_FULL_MODULE_NAME.put("SuppressionXpathFilter",
909                BASE_PACKAGE + ".filters.SuppressionXpathFilter");
910        NAME_TO_FULL_MODULE_NAME.put("SuppressionXpathSingleFilter",
911                BASE_PACKAGE + ".filters.SuppressionXpathSingleFilter");
912        NAME_TO_FULL_MODULE_NAME.put("SuppressWarningsFilter",
913                BASE_PACKAGE + ".filters.SuppressWarningsFilter");
914        NAME_TO_FULL_MODULE_NAME.put("SuppressWithNearbyCommentFilter",
915                BASE_PACKAGE + ".filters.SuppressWithNearbyCommentFilter");
916    }
917
918    /**
919     * Fill short-to-full module names map with modules from checkstyle package.
920     */
921    private static void fillModulesFromCheckstylePackage() {
922        NAME_TO_FULL_MODULE_NAME.put("Checker", BASE_PACKAGE + ".Checker");
923        NAME_TO_FULL_MODULE_NAME.put("TreeWalker", BASE_PACKAGE + ".TreeWalker");
924    }
925
926}