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 19:36:48 UTC 2013


Hi Eric,

If it is not too late you could also change other references to "new TypeAnnotation[0]" in the same source file.

  78         TypeAnnotation[] typeAnnotations = l.toArray(new TypeAnnotation[0]);
  79         return AnnotatedTypeFactory.buildAnnotatedType(type,
  80                                                        LocationInfo.BASE_LOCATION,
  81                                                        typeAnnotations,
  82                                                        typeAnnotations,
  83                                                        decl);

and

 279                     res[i] = AnnotatedTypeFactory.buildAnnotatedType(bounds[i],
 280                                                                      loc,
 281                                                                      l.toArray(new TypeAnnotation[0]),
 282                                                                      candidates.toArray(new TypeAnnotation[0]),
 283                                                                      (AnnotatedElement)decl);
 284                 }

Paul.

On Oct 1, 2013, at 8:18 PM, Eric McCorkle <eric.mccorkle at oracle.com> wrote:

> I forgot to hg add the test.  I've addressed your and others' comments,
> and refreshed the webrev.  Please review.
> 
> On 10/01/13 04:06, Joel Borggren-Franck wrote:
>> Hi Eric,
>> 
>> Thanks for fixing this.
>> 
>> On 2013-10-01, Eric McCorkle 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/
>>> 
>>> The bug report is here:
>>> https://bugs.openjdk.java.net/browse/JDK-8021398
>>> 
>> 
>> Fix looks mostly fine, but please use the shared array on line 47
>> instead of allocating a new one.
>> 
>> Also you lack a test, adopt the test from the bug and add it to
>> jdk/test/java/lang/annotations/typeAnnotations/
>> 
>> cheers
>> /Joel
>> 



More information about the core-libs-dev mailing list