google-code-export / umple

Automatically exported from code.google.com/p/umple
1 stars 0 forks source link

timed event handler followed by a regular event incorrectly raises warning 54 claiming unguarded duplicate event #575

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The following code 

class X {
  sm {
    s1 {
      e1 -> a;
    }

    a {
      entry / {System.out.println("entering a");}
      after(1) -> b;
      e3 -> c;
    }

    b {
      entry / {System.out.println("entering b");}
      e2 -> c;
    }

    c {
      entry / {System.out.println("entering c");}
    }

  }
  public static void main(String [ ] args) {
    X x = new X();
    x.e1();
    x.e2();
  }
}

Results in 

Warning 54 on line 10 of file "timed1.ump":
Transition e3 will be ignored due to a prior unguarded duplicate event
Success! Processed timed1.ump.

This is incorrect. It must be that the code that raises warning 54 is somehow 
matching incorrectly.

Original issue reported on code.google.com by TimothyCLethbridge on 29 May 2014 at 3:03

GoogleCodeExporter commented 9 years ago

Original comment by PedroAug...@gmail.com on 4 Jun 2014 at 3:20

GoogleCodeExporter commented 9 years ago
Cause:

The issues 575 and 576 are caused by the same problem.

By definition if there is a transition in a state that also has a 
auto-transition a warning should be raised since the normal transition is 
unnecessary. This verification is done by the method 
checkStateForDuplicateEvents of UmpleInternalParser_CodeStateMachine.ump file. 
The problem here is that this method defines a auto-transition as a transition 
that does not have a guard nor event. Consequently, a timed transition is also 
considered as a auto-transition and raises a warning when followed by a 
"normal" transition.

Solution:

Change the autotransition definition to consider not only the existence of a 
guard and a event associated with the transition but also the presence of a 
timer value.

Original comment by PedroAug...@gmail.com on 4 Jun 2014 at 6:34

GoogleCodeExporter commented 9 years ago
Attached the patch to solve the issue and the summary about it.

Original comment by PedroAug...@gmail.com on 5 Jun 2014 at 2:35

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by TimothyCLethbridge on 5 Aug 2014 at 7:04