JDK 9 RFR of JDK-5041778: (ann) AnnotationFormatError if "default" Class type not found

Joel Borggrén-Franck joel.borggren.franck at gmail.com
Sun Jun 12 18:43:20 UTC 2016


Looks good.

I think I would have avoided the nested ifs and just tested for
instanceof TypeNotPresentExceptionProxy directly but no big deal.

cheers
/Joel

On Sat, Jun 11, 2016 at 11:30 PM, joe darcy <joe.darcy at oracle.com> wrote:
> Hello,
>
> Please review these changes to address
>
>     JDK-5041778: (ann) AnnotationFormatError if "default" Class type not
> found
>     http://cr.openjdk.java.net/~darcy/5041778.0/
>
> The specification of Method.getDefaultValue states
>
>  631      * @throws TypeNotPresentException if the annotation is of type
>  632      *     {@link Class} and no definition can be found for the
>  633      *     default class value.
>
> However, the previous implementation threw an AnnotationFormatError in this
> case instead.
>
> An implementation note, the code
>
>  647             if (result instanceof TypeNotPresentExceptionProxy) {
>  648                 TypeNotPresentExceptionProxy proxy =
> (TypeNotPresentExceptionProxy)result;
>  649                 throw new TypeNotPresentException(proxy.typeName(),
> proxy.getCause());
>  650             }
>
> could instead something like
>
>     throw proxy.generateException();
>
> on line 649, but the code in the webrev should yield a more informative
> stack trace for the user.
>
> Thanks,
>
> -Joe
>


More information about the core-libs-dev mailing list