-
Notifications
You must be signed in to change notification settings - Fork 65
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
Metadata is not available for synthetic getters/setters #78
Comments
Right, we consider the synthetic getters/setters to have no metadata. However, it would be trivial to change |
That would be awesome Erik. Just out of curiosity, could you describe why they're considered to not have metadata? It sounds like you made a conscious choice to omit it. |
They don't have metadata because metadata arises when a declaration is syntactically associated with a phrase on the form But it still makes sense to say that there are no benefits in insisting on such a strict interpretation (your examples illustrate that quite well), so we might as well deliver the metadata of the associated variable declaration. It is still possible for programmers to check |
That makes sense. For the record I just implemented this using |
Given that the model is nicely consistent today ("no syntax means no metadata"), and given that this model seems to work reasonably well in practicel, I'll change this to |
So I was porting over some code based on raw mirrors that processes annotations, including those on superclasses and mixins and ran into the issue that the synthetic getter/setter method mirrors that wrap variables accessed through
InstanceMirror#instanceMembers
do not expose metadata. I assume this is a known issue, but the discrepancy is highly confusing and I could not find it documented anywhere.As far as I understand my only option here is to use
ClassMirror#declarations
which means walking the class hierarchy manually. In all fairness this is also what I did with raw mirrors but it would be really nice and much less confusing if reflectable could provide the metadata for all instance members. At least is should be documented.The following program illustrates my issues:
Output:
The text was updated successfully, but these errors were encountered: