Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAMIXPackage>>methods is wrong #606

Closed
seandenigris opened this issue Aug 3, 2015 · 17 comments
Closed

FAMIXPackage>>methods is wrong #606

seandenigris opened this issue Aug 3, 2015 · 17 comments

Comments

@seandenigris
Copy link
Contributor

Originally reported on Google Code with ID 606

in FAMIXPackage, methods only returns the extended methods defined in the package:

FAMIXPackage>>methods
    ^ self privateState 
            cacheAt: #methods 
            ifAbsentPut: [ 
                childNamedEntities select: [ :child | child isKindOf: FAMIXBehaviouralEntity ]]

This has a different semantics from the one defined in Namespace:

FAMIXNamespace>>methods
    ^ self privateState 
            cacheAt: #methods 
            ifAbsentPut: [ 
                self classes flatCollect: #methods ]

So. I propose that FAMIXPackage>>methods is changed to extensionMethods and methods
is computed like in Namespace + extensionMethods.

Reported by tudor.girba on 2011-04-30 23:48:26

@seandenigris
Copy link
Contributor Author

Reported by tudor.girba on 2011-04-30 23:48:36

  • Labels added: Priority-Critical
  • Labels removed: Priority-Medium

@seandenigris
Copy link
Contributor Author

extensionMethods is already defined as 
"self privateState cacheAt: #extensionMethods ifAbsentPut: [ self methods select: [
:m| m isExtension ] ]"

What I understand is to have:
- extensionMethods without changes of the source code
- localMethods that we should modify to have the same as Namespace
- methods that is a union of extensionMethods and localMethods

Am I right ?

Reported by jannik.laval on 2011-05-02 06:53:34

@seandenigris
Copy link
Contributor Author

Reported by jannik.laval on 2011-05-02 06:54:00

@seandenigris
Copy link
Contributor Author

Pretty much, only that localMethods should be definedMethods (it already exists, only
with the wrong implementation).

Reported by tudor.girba on 2011-05-02 07:19:09

@seandenigris
Copy link
Contributor Author

Not sure,
I prefer localMethod than definedMethod for non-extension methods.

For now definedMethod is an alias of methods.
We should pay attention to not break the semantic already used.

Reported by jannik.laval on 2011-05-02 07:24:26

@seandenigris
Copy link
Contributor Author

Right now, the semantics of methods is to provide the extension methods only. So, currently
definedMethods returns only the extension methods which is wrong.

Given that the famix-extension API currently depends on this, it will raise erroneous
results, so we will have to revisit it anyway. We will probably rewrite it in terms
of Chef.

In any case, perhaps localMethods is better for the moment. We should not depend on
this method too much anyway.

Reported by tudor.girba on 2011-05-02 07:49:03

@seandenigris
Copy link
Contributor Author

I am not sure to understand: "Right now, the semantics of methods is to provide the
extension methods only".

childNamedEntities contains all entities in the package, right ?
if we select "child isKindOf: FAMIXBehaviouralEntity", we select all methods, no ?

Reported by jannik.laval on 2011-05-02 07:57:15

@seandenigris
Copy link
Contributor Author

childNamedEntities contains all the directly packagedIn entities, so it will contain
the defined classes and the extension methods. The methods defined in classes will
be accessible from the classes objects, but they won't be stored directly in package
(just like in namespace).

Reported by tudor.girba on 2011-05-02 08:50:45

@seandenigris
Copy link
Contributor Author

hum, that is the point of the discussion :)

When I browse a mooseModel, childNamedEntities contains all methods of the packages.
And we do not need to access the class to obtain them.

Reported by jannik.laval on 2011-05-02 09:09:38

@seandenigris
Copy link
Contributor Author

Hmm, I got confused by some other bug in the importer.

Please try the following:
- Import Famix-Core
- Browse All Packages
- You will find 2 packages: The Famix-Core package only contains the extensions, while
the Default one contains all the rest of the classes

This is a bug, but I do not know what the source is. Maybe it's RPackage, but I do
not have time to investigate.

In any case, coming back to the current issue, you are right that currently we specify
the package of all methods. I think this is against the original intention. For example,
we do not specify the packaging of attributes. So, I think we should only provide the
package information when it cannot be deduced from a (belongsTo) container.

Reported by tudor.girba on 2011-05-02 09:44:43

@seandenigris
Copy link
Contributor Author

I have not this bug. I use the Moose from Hudson (Apr 30, 2011 9:39:29 PM).
When I load Famix-Core, I have two packages: Famix-Core and Famix-Core-MooseChef.
Probably your RPackage is broken.

You are right. We should change that.
So, I summarize what we have to do:

- do not store package for a method that is contained in the same package of its class.
That should be done directly in importers.
- extensionMethods : return methods contained in a package
- localMethods/definedMethods: returns methods contains in classes from the selected
package
- methods that is a union of extensionMethods and localMethods

Now, what is the impact on all our tools ?
Is only SmalltalkImporter concerned by this change ?

Reported by jannik.laval on 2011-05-02 10:13:44

@seandenigris
Copy link
Contributor Author

Nice summary :).

I do not think anything else needs to be updated. Except for the API, but that needs
to be reviewed anyway.

Do you give it a try, or should I?

Reported by tudor.girba on 2011-05-02 10:39:58

@seandenigris
Copy link
Contributor Author

I am beginning to work on it.

Reported by jannik.laval on 2011-05-02 13:43:31

@seandenigris
Copy link
Contributor Author

I have to redefine parentPackage in FAMIXMethod like that:

===
parentPackage

    ^ parentPackage ifNil:[ self belongsTo parentPackage]
===

Is it ok ?
If yes, the source code is ready to be pushed in repo.

Reported by jannik.laval on 2011-05-02 14:34:18

@seandenigris
Copy link
Contributor Author

I fixed them.
All tests pass.

Reported by jannik.laval on 2011-05-02 16:03:51

  • Status changed: Fixed

@seandenigris
Copy link
Contributor Author

we should fix parentPackage.
move this behavior in packageScope

Reported by jannik.laval on 2011-05-04 18:56:40

  • Status changed: Started

@seandenigris
Copy link
Contributor Author

the code is now in packageScope.
And I change a lot of call to parentPackage in packageScope

Reported by jannik.laval on 2011-05-05 07:40:45

  • Status changed: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant