Skip to content

Getter dispatch in case of default value in K3 #55

@fcoulon

Description

@fcoulon

For the case:

  • An EClass containing an attribute foo
  • An Aspect over this class declaring foo with a default value
    Can we consider the aspect has the priority?

It is breaking a test case in Melange. We load a model of merged Ecore + Aspect and try to access the attribute declared in the Aspect but we access the null value of the model.

val gemocHackGetter = '''
try {
for (java.lang.reflect.Method m : _self.getClass().getMethods()) {
if (m.getName().equals("«IF f.type.simpleName == "boolean" || f.type.simpleName == "Boolean"»is«ELSE»get«ENDIF»«f.simpleName.substring(0,1).toUpperCase() + f.simpleName.substring(1)»") &&
m.getParameterTypes().length == 0) {
Object ret = m.invoke(_self);
if (ret != null) {
return («f.type.type.qualifiedName») ret;
}«IF !f.type.primitive» else {
return null;
}
«ENDIF»
}
}
} catch (Exception e) {
// Chut !
}
return «PROP_VAR_NAME».«f.simpleName»;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions