google-code-export / umple

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

State machine example "Runway" causes Statetable generation to fail. #682

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Go to umpleonline and choose the "Runway" example from the state machine 
examples.
2. Generate state tables.

The "Couldn't read results from the Umple compiler!" error appears.

I had expected that the entry, exit, or do actions in some of the states were 
causing this error, but I couldn't reproduce the problem with any of those 
three keywords alone.

Original issue reported on code.google.com by CraigBry...@gmail.com on 28 Feb 2015 at 3:39

GoogleCodeExporter commented 9 years ago
The code to find the correct guardString for a transition causes a 
StackOverflowError due to endless recursion.

java.lang.StackOverflowError
    at java.util.HashMap.resize(HashMap.java:581)
    at java.util.HashMap.addEntry(HashMap.java:879)
    at java.util.HashMap.put(HashMap.java:505)
    at cruise.umple.compiler.JavaGenerator.initializeLangaugeBasedVariables(JavaGenerator.java:2497)
    at cruise.umple.compiler.SuperCodeGenerator.<init>(SuperCodeGenerator.java:45)
    at cruise.umple.compiler.JavaGenerator.<init>(JavaGenerator.java:36)
    at cruise.umple.compiler.StateTableRow.extractGuardString(Generator_CodeStateTables.ump:227)
    at cruise.umple.compiler.StateTableRow.extractGuardString(StateTableRow.java:421)
    at cruise.umple.compiler.StateTableRow.extractGuardString(StateTableRow.java:421)
    at cruise.umple.compiler.StateTableRow.extractGuardString(StateTableRow.java:421)
    at cruise.umple.compiler.StateTableRow.extractGuardString(StateTableRow.java:421)

Original comment by CraigBry...@gmail.com on 1 Mar 2015 at 4:41

GoogleCodeExporter commented 9 years ago
After some trial and error, I believe this occurs when a guarded transition 
exists in a sub-sub-state (a doubly nested state). Transitions with guards in 
more deeply nested states also have this error.

Here's a simple example:

class A {
  boolean guard;
  sm {
    First{ ev1 -> Second; }
    Second{ a{ b{ ev1[guard] -> First; } } }
  }
}

Interestingly, this code (with only a singly nested state) doesn't cause the 
error.

class A {
  boolean guard;
  sm {
    First{ ev1 -> Second; }
    Second{ a{ ev1[guard] -> First; } }
  }
}

Original comment by CraigBry...@gmail.com on 1 Mar 2015 at 4:58

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r5169.

Original comment by CraigBry...@gmail.com on 2 Mar 2015 at 2:34