Problem with inheritance

Issue #10 resolved
Wagner Silveira
created an issue

I'm writing a template for PHP. I found a possible problem with generalizations.

The "c.generalizations" attribute returns a reference to the subclass, but should return the reference of the superclass.

String generalization = ""
if (c.generalizations.size() > 0) {
    generalization = " extends ${c.generalizations.get(0).name}"
out << generalization

Result: extends Subclass

Result expected: extends Superclass

Comments (8)

  1. Mumpitz Master

    I think this is not a Problem of anycode. Create two classes, one called SuperClass the other called SubClass. Then draw the generalization arrow between them. Arrowhead to the SuperClass.

    Correct me if i am wrong, but in the generalization tab of the SuperClass it says: Name: <blank> To End Target: SubClass ClassType: SuperClass

    For my understanding there should be ClassType SubClass, because the End Target is a SubClass. So this would be an Issue for astah and the anycode implementation would be right.

  2. Randal Peters

    I think this is a bug with anycode-plugin. I believe the ClassType value refers to the type of the class that's selected. So, the type of the selected superclass should be SuperClass. If you select the subclass, then the ClassType is SubClass. I will attach a simple test example with two General superclasses and one Specialized subclass. Iterating through the getGeneralizations() does not produce the desired result. The information to fix the logic of anycode is contained within the specifications of Astah.

  3. Log in to comment