SemanticErrors

Timothy Lethbridge edited this page Jun 14, 2016 · 3 revisions
Clone this wiki locally

Introduction

This is an incomplete list of semantic errors and warnings that Umple should catch at runtime. If you're about to add a new entry, please provide a high-level description of the error, and give a code-oriented example.

Note: These will become test cases for the errors. Error messages for these= will be added to the en.error file

For example:

// Singleton classes should not be allowed on the many side of any association.

class X
{
    singleton;
}

class Y
{
   * -- * X; // This should generate a compile time error
}

Current Semantic Errors

  • 2 - Circular generalization. (not currently implemented)

    class NewClass
    {
      isA NewClass;
    }
    

    The message that appears is: Couldn't read results from the Umple compiler! And we get the same from more extensive circularity like this:

      class NewClass
      {
        isA B;
      }
    
      class B {
        isA A;
      }
    
      class A {
        isA NewClass;
      }
    
    
  • 2 - Associations with invalid multiplicities

    class X
    {
      2..1 -- * Y;
    }
    
    class Y
    {
    
    }
    
  • 2 - Associations with class name incorrectly specified

    class X
    {
    
    }
    
    class Y
    
    {
    
    }
    
    association
    {
      + X -- * Z;
    }
    
  • 2 - Defaulted variable not specified

    class X {
      defaulted attribute;
    }
    
  • 2 - Association class is missing an end

    associationClass X {
      + Y;
    }
    
    class Y {
    
    }
    
  • 2 - Association to itself has multiplicity with lower bound > 0 (on either side)

    class X {
      + -- 1 X;
    }
    

Current Semantic Warnings

  • 5 - Declaration of multiple namespaces should result in a compiler warning

    namespace blah;
    namespace blah2;
    
  • 5 - Singleton attributes not marked as lazy should result in a compiler warning

    class X
    {
      singleton;
      attribute1;
      attribute2;
    }
    
  • 5 - Singleton associations to 1 should result in a compiler warning

    class X
    {
      singleton;
      * -- 1 Y;
    }
    
    class Y
    {
    }
    
  • 3 - More than one key in a class

    class X {
      key {attribute1}
      key {attribute2}
    }