-
-
Notifications
You must be signed in to change notification settings - Fork 352
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
review: feature: Spoon meta-model #1627
Conversation
Not really, I used name convention and I used the roles in the Actions |
bad27a8
to
dc5a179
Compare
@monperrus where to put these meta model classes? I guess it belongs to tests, because it is actually used only in testing and code generation (not in spoon runtime by clients), but on the other side code generator tasks are not pure tests, so if I put the code into tests then CI complains and generator which is src/main is missing dependency to SpoonMetaModel which is in src/test ... |
I think we have a metamodel package |
dc5a179
to
ac5adfe
Compare
I cannot see it. |
8dd6f8b
to
1e25412
Compare
We don't have a metamodel package but we have What about merging it with |
The WDYT about access to spoon sources in runtime? |
Metamodel using shadow CTClasses, wich should be equivalent to
source-based CtClasses, because the metamodel declarative information is
not in the method body.
|
How to get list Spoon model class using reflection if sources are not available? It looks like there is no easy solution. Or will we list all possible classes in an constant list? |
By listing all classes
(https://github.com/INRIA/spoon/blob/master/src/main/java/spoon/Metamodel.java#L39)
A test ensures that the list is up-to-date.
|
I like this idea, but
Will we move spoon.Metamodel into spoon.metamodel.Metamodel ? WDYT? |
Have just had a more detailed look. It seems clear that this code will stay in What you do here is creating a meta-meta-model :-) (a metamodel of the Spoon meta-model). That's fun and interesting. Note that there exists other metametamodels, starting with EMF/Ecore Note also that we can reuse Java/Spoon itself as a metametamodel (ie Spoon would be metacircular), in this case, we would have:
I like this solution, because we would use the Spoon API itself to model the Spoon metamodel, and this would help us to see how well it works. WDYT? |
I agree, it is not for client's. It is for spoon internal purposes: testing and generating of some spoon sources.
This model is too abstract. I would prefer to have domain (Spoon) specific meta meta model (DSMMM), which express the internal structures of spoon model. Why?
We will see if current Spoon specific meta meta model (SSMMM) is good or not. I am open to discuss it deeply, because I have only little experience with meta modeling, so may be it is on wrong way. But actually I like it and current SSMMM is helpful.
I understand the idea. At least on high level ;-)
But note one think, which is near to idea of using of spoon itself: SSMMM references CtType and CtMethod of Spoon model, which was build from spoon sources. So: "SSMMM is a facade above Spoon meta meta model". See WDYT? |
1e25412
to
c4099ef
Compare
By the way, I have committed refactored version of metamodel. This implementation is more straight forward and correctly handles generic types used in spoon. |
It is for spoon internal purposes: testing and generating of some
spoon sources.
I agree. I'm OK with merging it in test code when you'll be done.
|
456748a
to
745f25a
Compare
If the tests pass, I am done here. Please review |
* The fact that you are presently reading this means that you have had | ||
* knowledge of the CeCILL-C license and that you accept its terms. | ||
*/ | ||
package spoon.metamodel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to spoon.test.metamodel to make it clear that's for test only
Revapi Analysis resultsOld API: fr.inria.gforge.spoon:spoon-core:jar:6.0.0-20171028.224456-120 New API: fr.inria.gforge.spoon:spoon-core:jar:6.0.0-SNAPSHOT Detected changes: 5. Change 1
Change 2
Change 3
Change 4
Change 5
|
thanks Pavel! I'm really looking forward to how we'll use that in the future. |
I see that whenever one wants to write some generator of spoon helper (CloneVisitor, EqualsVisitor, ReplacementVisitor, RoleHandler #1582, CtRoleScanner #1614 , ...) s/he needs to create spoon model of spoon sources and to analyze (build some extra structure) it somehow.
I have feeling like it might be helpful to have a standard code, which can build a simple metamodel structure (first draft is in this PR) of the Spoon model.
I am really not sure how it should look like. May be we just need some wrappers around AST of Spoon sources ... do you have alternative ideas?
WDYT? Are we able to create a simple meta model which might simplify development of new spoon code generators and may be simplify writing some tests?
Note: the meta model of this PR is probably sufficient to generate: CtScanner, RoleHandler #1582, CtRoleScanner #1614, CtInheritanceScanner, ... ?
@tdurieux did you already used some metamodel to assign CtRole to spoon sources in past?