New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple null generated in some state machines #883

Closed
TimLethbridge opened this Issue Sep 21, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@TimLethbridge
Member

TimLethbridge commented Sep 21, 2016

The umple code below generates erroneous code. When the java is compiled the result is:

./Animal.java:20: error: variable Null is already defined in enum StateAlive
  public enum StateAlive { Null, Null, normal, zombie }
                                 ^
./Animal.java:21: error: variable Null is already defined in enum StateAliveNormal
  public enum StateAliveNormal { Null, Null, baby, adult }
                                       ^
./Animal.java:125: error: duplicate case label
      case Null:
      ^
./Animal.java:139: error: duplicate case label
      case Null:
      ^

Umple code that generates the above:

class World {
  name;
1 -- * Animal;
  * -- * Player gamers;

}


class ThingInWorld {
}

class Animal {
  isA ThingInWorld;
  * --* ThingInWorld drops;
  Boolean isAlive;

  state {
    alive {
      kill -> dead;
      normal {

        baby {
          growUp -> adult;
        }
        adult {
           zombify -> zombie;
        }
      }
      zombie {
        haveBaby -> adult;
      }
    }
    dead {
    }  
  }
}

class Player {
  1 -- 0..1 Session;
}

class Session {

}

class Sheep {
  isA Animal;
}

class Game {
     public static void main(String [ ] args) {
       System.out.println("Hello World");
  }
}

@vahdat-ab

This comment has been minimized.

Member

vahdat-ab commented Sep 21, 2016

I did a short checking. There is no issue in the metamodel and runtime model. Probably, it's related to code generation.

@tlaport4 tlaport4 self-assigned this Oct 11, 2016

@vahdat-ab vahdat-ab closed this Dec 6, 2016

@vahdat-ab vahdat-ab reopened this Dec 6, 2016

@vahdat-ab

This comment has been minimized.

Member

vahdat-ab commented Dec 6, 2016

This has been fixed by PR 928

@vahdat-ab vahdat-ab closed this Dec 6, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment