-
Notifications
You must be signed in to change notification settings - Fork 320
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
Xbase proposal: Add features to express the expected semantics of supertypes #2880
Comments
@cdietrich if I wanted to try to generate the EMF classes of |
no idea. side effect of mig? |
@cdietrich the same holds for the Xbase generator. I created this #2881 |
I don't think that's actually true, since interfaces like |
Right! So I guess it's even more important to separate the intentions and validate them. |
@szarnekow I started to work on that in my fork, and I might need some early feedback, please. Note that these branches are currently based on #2882 to have proper generation of common types. The currently working solution is in the branch https://github.com/LorenzoBettini/xtext/tree/lb_2880-2 In this branch, I haven't introduced The main commit is LorenzoBettini@0cb0120 the getter and setter for I then applied these new features in the I added a few more tests to Finally, I applied that to Domainmodel example and added a test (we were never testing with a superclass) LorenzoBettini@bad8527 Unfortunately, I could not add a check for proper usages of the new features: On a separate branch https://github.com/LorenzoBettini/xtext/commits/lb_2880-1/ I tried adding type.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE which would return false for the new types. TypesPackage.Literals.JVM_GENERIC_TYPE.isSuperTypeOf(type.eClass()) would be required; however, I wanted to first know whether you think it's worthwhile or whether the first proposal is enough. |
JvmGenericClass
and JvmGenericInterface
to types modelJvmGenericType
to express the expected semantics of supertypes
JvmGenericType
to express the expected semantics of supertypes
To properly and cleanly implement #2349, it would be nice to have in the types model proper types for a Jvm class and Jvm interface to distinguish between the intended extended class and implemented interfaces (for classes) and extended interfaces (for interfaces).
Actually, the
JvmGenericInterface
would not be strictly necessary since we can assume that all the set supertypes are meant to be interfaces.On the contrary,
JvmGenericClass
would be necessary (see #2349 (comment)).My proposed extension is meant to be backward compatible. Speaking about
JvmGenericClass
, I planned to add two fields,extendedClass
(singular) andimplementedInterfaces
(multiple), and let the inheritedsuperTypes
be consistent with them. Similarly, for the methodsgetExtendedClass
andgetImplementedInterfaces.
I could provide a PR against the main branch (and then use it in #2349).
@szarnekow, what do you think?
The text was updated successfully, but these errors were encountered: