-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
AnnotatedType support #25
Comments
Sounds reasonable in general, but on short term the problem is indeed with JDK compatibility: project only requires JDK 1.6 (Java 6) currently. |
I've also got into this situation... but when I saw the issue is 2 years old, my heart sank. |
@kaqqao Given stability of So: with a PR I would be open to upgrading JDK baseline dependency, and maybe bumping version of classmate itself to 2.0 to signify major change. |
If anyone is interested in working for a PR, I'd be happy to branch of 2.0 for Java 8 baseline, and leave 1.x maintenance branch. |
As a note, I forked a similar library, GeTyRef, and added support for With the knowledge obtained in the process, I guess I could help with this, but I'm terribly busy... But when my schedule eventually clears up, I might take a look if no one has stepped up in the meantime. |
Hi @cowtowncoder, Just warming up this five-year-old issue. |
@CarstenWickner I do not remember off-hand if I thought about this, but I think that as long as this (whether to collect annotations or not) was behind a switch (configuration setting), having additional optional reference on Given that it's 2020, raising JDK level from Java 6 to Java 8 would probably be fine as well; would just need to see if minor version upgrade (to 1.6) or major (2.0) would be warranted. However... not sure if just storing all annotations for types involved would be sufficient. Does this help? It has been a while since I looked into internals of this library. It is not super-complicated, I think, but I guess as an author I am biased. |
New to Java 8, the AnnotatedType class carries annotations bind to types in Generic expressions.
So if I write
I can get the
@NotNull
annotation via something like:But then I have to assume the parameter I want is the first in the returned array. But maybe I have something like
Using
ResolvedType
, I can calltype.typeParametersFor(List.class).get(0)
to get the correct parameter type (Integer
rather thanString
). It'd be nice to have also a way to retrieve the annotations associated with it (@NotNull
rather than@Null
). Note that this feature must not break support for Java 7, so some type of switch will probably need to be used.The text was updated successfully, but these errors were encountered: