-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
LANG-1317 Adds MethodUtils#findAnnotation and extend MethodUtils#getMethodsWithAnnotation for non-public, super-class and interface methods #261
Conversation
Thanks for the pull request! It is really unfortunate that the existing method I would not have been able to tell the difference between I believe we need a more intention revealing method name or maybe we should just add an overload of What do you think? |
@PascalSchumacher , thank you! I was overloaded by another job and forgot that I also can use method overloads. Yes, strongly I agree. Just I have some doubts about name |
You are right. The method signature I suggested omits the important super part. I agree it should be something like |
Another bad thing is that Another solution is to keep my current changes not modified but add following javadoc:
With these, for (searchSupers,igonreAccess) pair, we have both (false,false) and (true,true) available. In future, if somebody need other possibilities, new methods can be added e.g. |
Well we have to keep |
👌 I am working on a new commit. thanks! |
…d more unit tests
@PascalSchumacher , I made it better 😃 thanks a lot! Please feel free to make any recommendation if you think I can make it better.
😞 Do you know why? 👆 |
@yasserzamani I thinks because you added more conditional branches in the latest commit and that is why less LOC are covered |
Thank you @Abrasha , I signed up with coveralls.io and see that all of this PR's changes are covered with unit tests: MethodUtils , ClassUtils. Also these files show enhancement in coverage at COVERAGE CHANGED 🤔 |
Concerning the coverage: I think it's because the coverage differs between java versions. The build used to determine coverage depends on the order in which the travis builds finish. |
@yasserzamani Sorry for the delay, other open source projects and vacations interfered. I'm not sure if the priority parameter of Otherwise the pull request is fine. :=) 👍 |
@PascalSchumacher , You're welcome, I understand and as an open source fun contributor, I'm patient enough :)
No, is not. I just thought I should make it more general with more options to prevent future needs for other user's PRs. Now, with thanks to your recommendations I removed it :) |
* from interfaces, and so on in a breadth first way.</p> | ||
* | ||
* @param cls the class to look up, may be {@code null} | ||
* @return the {@code List} of superclasses in order going up from this one |
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.
This should also mention Interfaces.
Can you add a since tag to this method?
Thanks!
Created https://issues.apache.org/jira/browse/LANG-1321 for the |
If I'm not mistaken the list returned by Edit: I misunderstood what |
@PascalSchumacher , sorry for my bad decisions. Again I thought I should keep it public to provide same functionality for someone who needs in future :) Now, I removed it to MethodUtils as a private method. I also added Thanks a lot! |
@yasserzamani Thanks! No need to apologize. It is just that we try to be conservative with new additions (If we add a public method we have to support it for a long time and can not do any incompatible changes.). If the method is deemed generally useful it can always be moved and made public later on. |
Merged. Thank you very much. |
In order to fix WW-4744 ,
findAnnotation will be an extension for Method.getAnnotation that also searches interfaces and super classes.
findMethodsWithAnnotation will be an extension for getMethodsWithAnnotation that also supports non public methods, super class and interface methods.
NOTES:
To keep changes simple, currently no cache provided. Let's do that when needed 😃