TypeParameter and TypeArgument (in case of using a wildcard) could hold annotations, but they do not have a getTypeAnnotationInfo() getter exposed, despite parsing works seemingly correctly in both cases.
Consider analysing annotations specified on the method parameter types in the scan result of the following class:
class GenericTypeAnnotationTest {
@Target({ ElementType.FIELD, ElementType.TYPE_USE, ElementType.TYPE_PARAMETER })
private static @interface A {
}
<@A T> void saveT(T param) {
}
void saveUList(List<@A ?> param) {
}
}
typeParameter.toString() and typeArgument.toString() results show the @A annotation where expected, but there is no API to access the @A annotation info other than toString().
Apart from Java, this has a big impact on working with Kotlin compiled code, as for some types (BigDecimal and BigInteger are known examples, my wild guess, for supporting Kotlin language extensions) compiler emits List<@A ? extends Type> param in JVM bytecode whereas the source had List<@A Type> param.
TypeParameterandTypeArgument(in case of using a wildcard) could hold annotations, but they do not have agetTypeAnnotationInfo()getter exposed, despite parsing works seemingly correctly in both cases.Consider analysing annotations specified on the method parameter types in the scan result of the following class:
typeParameter.toString()andtypeArgument.toString()results show the@Aannotation where expected, but there is no API to access the@Aannotation info other thantoString().Apart from Java, this has a big impact on working with Kotlin compiled code, as for some types (
BigDecimalandBigIntegerare known examples, my wild guess, for supporting Kotlin language extensions) compiler emitsList<@A ? extends Type> paramin JVM bytecode whereas the source hadList<@A Type> param.