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

Associations with the same role name but two different classes in superclasses and subclasses should produce an error. #961

Closed
katcavers opened this Issue Jan 21, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@katcavers
Contributor

katcavers commented Jan 21, 2017

Brief Description

When a superclass and subclass both have an association with the same role name, but the association is to different classes, an error should be produced.

Minimum Steps to Reproduce

class A
{
  0..1 -> * C assoc;
}

class B {
  isA A;
  0..1 -> * D assoc;
}

class C
{
}

class D
{
}

Expected Result

Expected results: ERROR

Actual Result

Invalid code is generated. Included below is a small subset to illustrate the issue:

public class A
{

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

  //A Associations
  private List<C> assoc;

  //------------------------
  // CONSTRUCTOR
  //------------------------

  public A()
  {
    assoc = new ArrayList<C>();
  }

 //------------------------
  // INTERFACE
  //------------------------

  public C getAssoc(int index)
  {
    C aAssoc = assoc.get(index);
    return aAssoc;
  }
}

public class B extends A
{

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

  //B Associations
  private List<D> assoc;

  //------------------------
  // CONSTRUCTOR
  //------------------------

  public B()
  {
    super();
    assoc = new ArrayList<D>();
  }

  //------------------------
  // INTERFACE
  //------------------------

  public D getAssoc(int index)
  {
    D aAssoc = assoc.get(index);
    return aAssoc;
  }
}

@katcavers katcavers self-assigned this Jan 21, 2017

@vahdat-ab vahdat-ab changed the title from Associations with the same role name but to different classes in superclasses and subclasses should produce an error. to Associations with the same role name but two different classes in superclasses and subclasses should produce an error. Jan 21, 2017

@vahdat-ab

This comment has been minimized.

Member

vahdat-ab commented Jan 21, 2017

This might be related to the issue #698

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