#615 Add option for IllegalInstantiation to allow self-instantiation

Future
closed
nobody
incomplete (2)
1
2013-11-15
2013-08-15
David Harkness
No

We have several value-holder classes (Price, Year, Zip, etc.) that provide a static factory method to encapsulate instantiation:

valueOf(String text)

The IllegalInstantiation check complains about each of these methods because the class is instantiating itself.

Request: Add an option to allow self-instantiation.

<module name="IllegalInstantiation">
    <property name="allowSelf" value="true" />
    <property name="classes" value="..." />
</module>

Discussion

  • Roman Ivanov
    Roman Ivanov
    2013-10-03

    please provide exact example of code that you have, where Check is complaining (exact message).

     
  • Roman Ivanov
    Roman Ivanov
    2013-10-03

    • labels: --> incomplete
     
  • Ivan Sopov
    Ivan Sopov
    2013-11-15

    • status: open --> closed