KDM 1.4 RTF Avatar
  1. OMG Issue

KDM14 — Confusion in the type of the method getCodeElement in ClassUnit

  • Key: KDM14-139
  • Status: closed  
  • Source: KDM Analytics ( Nikolai Mansourov)
  • Summary:

    The type is CodeItems. So we have a method getCodeElements that in fact returns a list of CodeItems.

    This leads to code written like this :
    List<CodeElement> myList= cu.getCodeElements();
    Which causes class cast exceptions since a CodeItem isn't a CodeElement

    The method should be renamed getCodeItems, or type made more generic to AbstractCodeElement

  • Reported: KDM 1.3 — Sun, 18 Jan 2015 17:02 GMT
  • Disposition: Resolved — KDM 1.4
  • Disposition Summary:

    Change the type of property codeElements in ClassUnit and TemplateUnit to AbstractCodeElement

    Currently the type is CodeItems; it should be made more generic to AbstractCodeElement in order to avoid confusion with the type of hte generated method getCodeElement and to allow extensions.

  • Updated: Tue, 12 Jul 2016 14:44 GMT