osate / osate2

Open Source AADL2 Tool Environment
http://osate.org
Eclipse Public License 2.0
36 stars 8 forks source link

subprogam call name resolution #127

Closed reteprelief closed 11 years ago

reteprelief commented 11 years ago

From Dominique:

I am having some errors (cannot modify without a transaction) with our tools and OSATE. The error hapens when our tools read AADL models, even though they are not modifying the models at all. This seems to be due to the following line of code (line 305, in bold font) in the Aadl2LinkingService class, which is setting the context of subprogram calls to null.

        if (searchResult != null
                && requiredType.isSuperTypeOf(searchResult.eClass())) {
            ((SubprogramCall) context).setContext(null); 
            return Collections.singletonList((EObject) searchResult);

Is this line really needed? If so, I will need to modify the code in my tools to manage a transaction which may be tedious.

reteprelief commented 11 years ago

Hi Dominique,

If you need to modify the model in a transaction, you can do it using an EMF transaction or a ligherweight Xtext transaction (http://koehnlein.blogspot.com/2010/06/semantic-model-access-in-xtext.html). We use it when instantiating a model (InstantiateHandler).

The subprogram call reference is tricky because it can be a reference to a Subprogram type (qualified name), subprogram implementation (qualified subprogram type impl), or a subcomponent subprogram access feature. The SubprogramCall object has a context and the subprogram fields. Currently the parser sets the reference and the name resolver figures things out – causing it to set the context.

In your code below we could probably leave out the setContext(null); since the value is already null. However, in the subcomponent access feature case I will have to set it.

Alternatively, I could have the parser fill in both when there is a . In this case, the context would be set to the type and the subprogram to the implementation. We will need to check whether other code makes the assumption that the context is null in this case.

Peter

juli1 commented 11 years ago

Hi all,

It appears to be related to the bug I got previously with Eclipse hanging while instantiating models. Dominique, could you tell us what the bug looks like and what are the effects of the bug ? Anyway, we should have a look at it and make OSATE resilient to all kind of bugs, so, let's look at how we can fix that issue !