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

joe darcy joe.darcy at oracle.com
Sat Jun 11 21:30:06 UTC 2016


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