Skip to content

Missing validation for duplicate name #1841

@joeseibel

Description

@joeseibel

If a classifier member has the same name as an inherited member, an error is not reported when also inheriting an unnamed mode transition. The following model should produce an error, but it doesn't:

package duplicate_name
public
  system s
    features
      e: in event port;
    modes
      m1: initial mode;
      m2: mode;
      m1 -[e]-> m2;
  end s;

  system implementation s.i1
    subcomponents
      sub: abstract;
  end s.i1;

  system implementation s.i2 extends s.i1
    subcomponents
      sub: system;
  end s.i2;
end duplicate_name;

Giving the mode transition a name will cause an error to be reported on sub in s.i2. The problem is that the validator assumes that all NamedElements have a non-null name. This results in a NullPointerException which aborts that validation. A null check needs to be added here:

&& ((NamedElement) ownedElement).getName().equalsIgnoreCase(ne.getName())) {

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions