#146 add check for presence of a constructor

release_3.4
closed
Check (274)
5
2012-10-10
2003-03-02
No

Add a check to make sure that classes always define a
constructor and don't rely on the default constructor.

Note, I'm working on this simple check to better
understand the framework. Hopefully it should be
completed shortly.

--Peter

Discussion

  • Rick Giles

    Rick Giles - 2003-07-20

    Logged In: YES
    user_id=539926

    The following configuration of 3.2 CVS check DescendantToken
    performs this check:

    <!-- check for presence of a constructor, request 696129 -->
    <module name="DescendantToken">
    <property name="tokens" value="CLASS_DEF"/>
    <property name="limitedTokens" value="CTOR_DEF"/>
    <property name="minimumNumber" value="1"/>
    <property name="maximumDepth" value="2"/>
    <property name="minimumMessage" value="Class should
    define a constructor."/>
    </module>

     
  • Tim Tyler

    Tim Tyler - 2003-07-20

    Logged In: YES
    user_id=796025

    I suspect that there's a wrinkle which may mean that some
    custom code is needed to implement this.

    In particular, I reckon abstract classes should not have
    this check applied to them.

     
  • Oleg Sukhodolsky

    Logged In: YES
    user_id=746148

    Committed to CVS for 3.4
    Module MissingCtor

     

Log in to post a comment.