umple: Duplicate enums generated for parallel state machines with the same names that are in different states

Brief Description

When an Umple model has parallel state machines with the same names in different states, duplicate enums are produced.

Minimum Steps to Reproduce

Consider the following example

class X {
  sm{
    s0{
      t1 {
        goS1-> s1;
      }
      ||
      t2 {
        goT3-> t3;
      }
      t3{ }
    }
    s1{
      t1{
        goT4-> t4;
      }
      t4{ }
      ||
      t2{
        goT5-> t5;
      }
      t5{ }
    }
  }
}

Expected Result

public class X
{

  //------------------------
  // MEMBER VARIABLES
  //------------------------

  //X State Machines
  public enum Sm { s0, s1 }
  public enum SmS0T1 { Null, t1 }
  public enum SmS0T2 { Null, t2, t3 }
  public enum SmS1T1 { Null, t1, t4 }
  public enum SmS1T2 { Null, t2, t5 }
  private Sm sm;
  private SmS0T1 smS0T1;
  private SmS0T2 smS0T2;
  private SmS1T1 smS1T1;
  private SmS1T2 smS1T2;

Actual Result

The corresponding enums in the Java code are

public class X
{

  //------------------------
  // MEMBER VARIABLES
  //------------------------

  //X State Machines
  public enum Sm { s0, s1 }
  public enum SmT1 { Null, t1 }
  public enum SmT2 { Null, t2, t3 }
  public enum SmT1 { Null, t1, t4 }
  public enum SmT2 { Null, t2, t5 }
  private Sm sm;
  private SmT1 smT1;
  private SmT2 smT2;
  private SmT1 smT1;
  private SmT2 smT2;

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

I think you can go ahead. Since you approach is correct, those test cases must be replaced with the correct one. Once you get the PR, I’ll ask two other people to explore the parallel state machines. This helps us to make sure we have not missed anything 😃

Yes. The generated code is definitely wrong. Expected result is also correct.