Hello Jacopo,
You cannot model initializers in FAMIX (neither field initialization,
nor instance or static initialization blocks). The same applies for
doublebrace initialization, and many other features of Java. The main
reason why is that Famix is supposed to be language independent and
thus a lossy model of software rather than a precise one, think of
JPEG vs GIF. Which is okay as long Famix is used for coarse-grained
high-level analysis, it is obvious that Famix would be a bad choice
for eg program transformation.
But you best address this question to the Moose mailing list (see
foward in CC). Fame is about the (meta)metamodeling-infrastructure
only, not about concrete metamodels such as Famix. I have left the
Moose team start fo this year, and maybe what I just said above is
obsolete in the meantime...
cheers,
AA
On 16 Sep 2008, at 12:11 , Jacopo Malnati wrote:
Hello everybody,
still in the context of exporting Java code to MSE, I don't know
how to handle a dependency that comes from the initialization of a
class field.
Let's say that a class has a field "myField" of type "MyType" and
that it gets declared in the body of the class and initialized with
a constructor, in place.
Something like:
MyClass {
MyType myField = new MyType(...)
}
Now, this is an invocation (of a constructor) but in Famix 2.2 an
invocation is between 2 AbstractBehaviouralEntity and in this case,
it's not. In fact the initialization of a class field can be
outside any method, therefore I don't know how to model this
dependency.
Is there any way I can model it? Or Famix 2.2 doesn't allow me to
model this situation?
Thanks :)
Jacopo