Add support for java 8 annotation targets TYPE_USE and TYPE_PARAMETER
Java 8 adds two new targets for annotations.
- TYPE_USE - here are some examples
class MyData implements MyTypedInterface<@Limit(2) MyType> {}
new @Immutable Rock()
(@NonNull String) calculateValue()
void doSomething() throws @Critical IOException();
For all possible 16 type uses refer to https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.11
- TYPE_PARAMETER - is for declaring type parameters like
class MyClass<@NonNull T> {}
<@Immutable T> void process(T message);
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I have need for this but was able to work around the issue by creating a custom AbstractJType.
If there is interest in resolving this issue, I am willing to submit a pull-request.
However, I think it is likely this would be a breaking change for most of the API since a proper implementation requires separating the concept of type-usage from type-definition. For example, JPrimitiveType and JReferencedClass would no longer extend AbstractJType since they really represent usage of an existing type and not definitions of a new type.
Yes, feel free to submit a PR - the next update will anyway a major version (4) :)