
com.puppycrawl.tools.checkstyle.meta.checks.coding.IllegalInstantiationCheck.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of checkstyle Show documentation
Show all versions of checkstyle Show documentation
Checkstyle is a development tool to help programmers write Java code
that adheres to a coding standard
<?xml version="1.0" encoding="UTF-8"?> <checkstyle-metadata> <module> <check fully-qualified-name="com.puppycrawl.tools.checkstyle.checks.coding.IllegalInstantiationCheck" name="IllegalInstantiation" parent="com.puppycrawl.tools.checkstyle.TreeWalker"> <description><div> Checks for illegal instantiations where a factory method is preferred. </div> <p> Rationale: Depending on the project, for some classes it might be preferable to create instances through factory methods rather than calling the constructor. </p> <p> A simple example is the {@code java.lang.Boolean} class. For performance reasons, it is preferable to use the predefined constants {@code } and {@code }. Constructor invocations should be replaced by calls to {@code Boolean.valueOf()}. </p> <p> Some extremely performance sensitive projects may require the use of factory methods for other classes as well, to enforce the usage of number caches or object pools. </p> <p> There is a limitation that it is currently not possible to specify array classes. </p></description> <properties> <property default-value="" name="classes" type="java.lang.String[]"> <description>Specify fully qualified class names that should not be instantiated.</description> </property> </properties> <message-keys> <message-key key="instantiation.avoid"/> </message-keys> </check> </module> </checkstyle-metadata>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy