-
Notifications
You must be signed in to change notification settings - Fork 14
Match sub-classing interfaces #338
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
Comments
Thank you for the offer. It sounds worthwhile to me. Please send a PR and we'll review. |
I wasn't familiar before with how the generator worked, but I had a look now. It looks like it parses the files directly checking if specific interfaces are implemented, without actually building the class graph. This means we have no real knowledge during generation outside of what's specified in the source file of the class. So I see three options:
The first one is likely simpler, but less user friendly. The second one is probably slower, more complex, but a better UX. Third one is just a less flexible variant of the second one, and is probably simpler to implement, but less flexible in terms of UX. Thoughts? Maybe you also have a different idea of how this could be implemented. |
I'm distracted with preparing some things for upcoming releases, so I can't dig into this right now to give an informed opinion. Pinging @ttddyy in case he has any thoughts. |
I think auto-detecting (choice 2) wouldn't be a bad approach since it's only targeting enums. The number of interfaces implemented by enums should be relatively small, so traversing them wouldn't be too heavy of an operation. For all three choices, another consideration is retrieving values from methods like Overall, I think auto-detection and hierarchical value retrieval would give the necessary feature here. |
Description
We use
MeterDocumentation
with enums to document our metrics, and generally quite like the pattern, as it provides some technical documentation for all our metrics. We extendMeterDocumentation
however to add more information. While it would be nice to have that shown by the generator, this is not the problem.The main issue is that the generator doesn't pick up enums implementing the extending interface, it only picks up enums which directly implement
MeterDocumentation
.Take the following
ExtendedMeterDocumentation
interface:And the following enum:
Naively, I would expect the generator to pick up
MyMetrics
, but it does not.As a workaround, I can do the following:
Then the generator will pick it up. It would be great though if it wasn't necessary to again declare the implementation of
MeterDocumentation
.I'm happy to pick this up if you think this would be valuable. I understand there's not much urgency if there is a workaround :)
The text was updated successfully, but these errors were encountered: