All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.puppycrawl.tools.checkstyle.meta.checks.coding.IllegalInstantiationCheck.xml Maven / Gradle / Ivy

Go to download

Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard

There is a newer version: 8.8
Show newest version
<?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>&lt;div&gt;
 Checks for illegal instantiations where a factory method is preferred.
 &lt;/div&gt;

 &lt;p&gt;
 Rationale: Depending on the project, for some classes it might be
 preferable to create instances through factory methods rather than
 calling the constructor.
 &lt;/p&gt;

 &lt;p&gt;
 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()}.
 &lt;/p&gt;

 &lt;p&gt;
 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.
 &lt;/p&gt;

 &lt;p&gt;
 There is a limitation that it is currently not possible to specify array classes.
 &lt;/p&gt;</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