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