Review request for JDK-8021398: j.l.r.Parameter.getAnnotatedType().getType() for not annotated use of type returns null

Paul Sandoz paul.sandoz at oracle.com
Tue Oct 1 08:34:32 UTC 2013


On Oct 1, 2013, at 9:12 AM, Eric McCorkle <eric.mccorkle at oracle.com> wrote:

> Hello, please review this simple patch which fixes a problem in the type
> annotations handling API.  This manifests as a problem with both
> j.l.r.Parameter.getAnnotatedType().getType() as well as
> j.l.r.Executable.getAnnotatedParameterTypes().getType().
> 
> The webrev is here:
> http://cr.openjdk.java.net/~emc/8021398/
> 


A minor optimization. Since we know the size we can change:

 133                 typeAnnotations = list.toArray(new TypeAnnotation[0]);

to:

 133                 typeAnnotations = list.toArray(new TypeAnnotation[list.size()]);

There are also other similar cases in the same source file that could be updated.

Also for the case of the empty array there is already:

  47     private static final TypeAnnotation[] EMPTY_TYPE_ANNOTATION_ARRAY = new TypeAnnotation[0];

which can be reused.

Paul.

> The bug report is here:
> https://bugs.openjdk.java.net/browse/JDK-8021398
> 
> Thanks,
> Eric



More information about the core-libs-dev mailing list