KDM 1.4 RTF Avatar
  1. OMG Issue

KDM14 — throws example in the spec is incomplete

  • Key: KDM14-16
  • Legacy Issue Number: 11710
  • Status: closed  
  • Source: KDM Analytics ( Dr. Nikolai Mansourov)
  • Summary:

    throws example in the spec is incomplete

  • Reported: KDM 1.0 — Sat, 1 Dec 2007 05:00 GMT
  • Disposition: Resolved — KDM 1.4
  • Disposition Summary:

    Add throws example

    class A {
    void foo() {
    try{
    bar();
    catch(Exception e)

    { println("Something went wrong"); }

    finally

    { println("Good bye"); }

    }
    void bar() throws MoreDescriptiveException{
    try

    { this.arr[20] = 20; println(arr); }

    catch (IndexOutOfBoundsException e)

    { println("Oops"); throw new "went too far" }

    finally

    { println(arr); }

    }

    int[] arr = new int[10]
    }

    Some comments:
    Some of the AbstractCodeElements are BlockUnits. I would have used EntryFlows instead of regular Flows, but that might be a matter of choice.
    1. TryUnit entryFlow> ActionElement[kind='Call'] not required?
    2. I see that we need to create new Exception to send. That's the revision I attached. I did a pass to do the changes, but I hope I got the numbering right (done manually).

    <!-- Create the Exception, no constructor called -->
    <codeElement xmi:id="id.47" xmi:type="action:ActionElement" name="a8" kind="New">
    <codeElement xmi:id="id.48" xmi:type="code:StorableUnit" type="id.67" kind="local"/>
    <actionRelation xmi:id="id.49" xmi:type="action:Creates" to="id.48" from="id.47"/>
    <actionRelation xmi:id="id:50" xmi:type="action:Flow" to="id.50" from="id.47"/>
    </codeElement>

    <!-- Throw statement -->
    <codeElement xmi:id="id.51" xmi:type="action:ActionElement" name="a9" kind="Throw">
    <actionRelation xmi:id="id.52" xmi:type="action:Throws" from="id.51" to="id.48"/>
    </codeElement>

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