Code review request for 6468534 "(reflect) Exception types cannot be parameterized, rephrase getGenericExceptionTypes"

Alan Bateman Alan.Bateman at Sun.COM
Tue Sep 22 16:51:54 UTC 2009


Joe Darcy wrote:
> Hello.
>
> Please review my simple fix below for 6468534 "(reflect) Exception 
> types cannot be parameterized, rephrase getGenericExceptionTypes."
>
> As documented in the JLS, "It is a compile-time error if a generic 
> class is a direct or indirect subclass of |Throwable|."
>
> http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.1.2
>
> Therefore, it is at most vacuously true for the {Constructor, 
> Method}.getGenericExceptionTypes to state "If an exception type is a 
> parameterized type..." and it would be clearer if this text were deleted.
>
> -Joe
>
> --- old/src/share/classes/java/lang/reflect/Constructor.java    
> 2009-09-21 21:42:21.000000000 -0700
> +++ new/src/share/classes/java/lang/reflect/Constructor.java    
> 2009-09-21 21:42:20.000000000 -0700
> @@ -275,10 +275,6 @@
>      * Returns an array of length 0 if the underlying method declares
>      * no exceptions in its {@code throws} clause.
>      *
> -     * <p>If an exception type is a parameterized type, the {@code Type}
> -     * object returned for it must accurately reflect the actual type
> -     * parameters used in the source code.
> -     *
>      * <p>If an exception type is a type variable or a parameterized
>      * type, it is created. Otherwise, it is resolved.
>      *
> --- old/src/share/classes/java/lang/reflect/Method.java    2009-09-21 
> 21:42:22.000000000 -0700
> +++ new/src/share/classes/java/lang/reflect/Method.java    2009-09-21 
> 21:42:21.000000000 -0700
> @@ -317,10 +317,6 @@
>      * Returns an array of length 0 if the underlying method declares
>      * no exceptions in its {@code throws} clause.
>      *
> -     * <p>If an exception type is a parameterized type, the {@code Type}
> -     * object returned for it must accurately reflect the actual type
> -     * parameters used in the source code.
> -     *
>      * <p>If an exception type is a type variable or a parameterized
>      * type, it is created. Otherwise, it is resolved.
>      *
This looks reasonable to me.

BTW: are there inconsistent indenting in these files? In Constructor it 
looks like getTypeParameters and getGenericExceptionTypes is 
mis-aligned. getGenericExceptionTypes in Method.java.

-Alan.



More information about the core-libs-dev mailing list