Skip to content
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

WW-4744: AnnotationUtils supports non-public methods #124

Merged
merged 5 commits into from
Mar 29, 2017

Conversation

yasserzamani
Copy link
Member

With these changes, AnnotationUtils also has equipped with an internal cache. Mainly, getAnnotatedMethods and all it's usages have improved and equipped with enough unit tests (also all findAnnotation usages have equipped).

NOTES:
To avoid reinventing the wheel, I copied from Spring framework, So, I copied their license and authors as well where needed :)

* @author Sam Brannen
* @author Mark Fisher
* @author Chris Beams
* @author Phillip Webb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if adding those authors here makes any sense, in most cases we (at ASF) trying to remove the @author tag also asking those users about this class can confuse them.

Method equivalentMethod = clazz.getDeclaredMethod(method.getName(), method.getParameterTypes());
result = getAnnotation(equivalentMethod, annotationType);
} catch (NoSuchMethodException ex) {
// No equivalent method found
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to LOG this exception?

Copy link
Member Author

@yasserzamani yasserzamani Mar 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it is common to not found the method in a super class during our hierarchically search.

@lukaszlenart
Copy link
Member

Looks good, just have some doubts about putting @author tag

@asfbot
Copy link

asfbot commented Mar 21, 2017

Lukasz Lenart on dev@struts.apache.org replies:
2017-03-21 7:04 GMT+01:00 lukaszlenart git@git.apache.org:
tils.java ---
ses we (at ASF) trying to remove the @author tag also asking those users =
about this class can confuse them.

Should I ask legal [1] about that? What do you think?

[1] https://issues.apache.org/jira/browse/LEGAL/

Regards
--=20
=C5=81ukasz

@cnenning
Copy link
Member

Should I ask legal [1] about that? What do you think?

That's the class that has been copied from spring. Yes, I think it's better to ask how to handle this.

@lukaszlenart
Copy link
Member

That's the class that has been copied from spring

I meant, coping classes is ok if the license allows that (Spring uses AL 2.0) but my questions was about adding authors to some other class (not copied from Spring), maybe let's allow Yasser explain why he did that.

@aleksandr-m
Copy link
Contributor

Do we need custom annotation utility at all? Can't we just use existing libraries e.g. Apache Commons MethodUtils?

@yasserzamani
Copy link
Member Author

Yasser explain why he did that

Thank you for your review.

AnnotationUtils is not a new class but to avoid reinventing the wheel, I copied and merged some codes from Spring into that. While Spring has Copyright 2002-2014 the original author or authors. in his License header, I was not sure what to do with @authors :(

Currently, I am searching Internet for same to see what people do. Finally, I also may ask Spring.

@lukaszlenart
Copy link
Member

We must rather ask ASF legal body, you can post an issue in JIRA (see above)

@yasserzamani
Copy link
Member Author

We must rather ask ASF legal body, you can post an issue in JIRA (see above)

Thank you. As I could not find similar issue, I created Merge others codes having same license but different copyrights.

@yasserzamani
Copy link
Member Author

I also wait for ASF LEGAL part's answer but after some study, it seems I was not allowed to do such work 😞 If so, I think I have to write my own utils at where @aleksandr-m mentioned; re-inventing the wheel :(

Below are references; what do you think, please?

References:
[1] https://www.apache.org/licenses/LICENSE-2.0

  1. Redistribution.
    c. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and

[2] http://www.apache.org/legal/src-headers.html

TREATMENT OF THIRD-PARTY WORKS

  1. Do not modify or remove any copyright notices or licenses within third-party works.

[3] http://www.apache.org/dev/apply-license.html

CAN/SHOULD INDIVIDUAL COMMITTERS ADDED COPYRIGHT STATEMENTS TO THE NOTICE OR SOURCE CODE FILES?

No.

Though committers retain copyright, Apache asks that they do not add copyright statements. See the policy for more details.

@yasserzamani
Copy link
Member Author

Do we need custom annotation utility at all? Can't we just use existing libraries e.g. Apache Commons MethodUtils?

Thank you @aleksandr-m !

I am working on it. I started by creating LANG-1317

@yasserzamani
Copy link
Member Author

✅ All copied Spring's code including what I was imported in previously merged PR#117 removed 👌

After merge of LANG-1317 PR and S2's upgrade to use commons lang 3.6, I'll remove deprecated getAnnotatedMethods and findAnnotation to Apache Commons Lang 3.6 👌

@lukaszlenart
Copy link
Member

So as I understand this is ready to be merged with a future notice to use Commons Lang 3.6 when available?

@yasserzamani
Copy link
Member Author

@lukaszlenart , Yes in my opinion, Thank you!

@lukaszlenart
Copy link
Member

Cool, I will review this tomorrow just to double check and LGTM! Great work!

@lukaszlenart
Copy link
Member

Great work, LGTM! 👍

@asfgit asfgit merged commit 3cee495 into apache:master Mar 29, 2017
@yasserzamani yasserzamani deleted the WW-4744 branch March 29, 2017 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants