# HG changeset patch # User darcy # Date 1467778300 25200 # Node ID 3ee56008894b47b043c838d6b3d3d8a4de2fd84e # Parent 58407025750014e3b5621fa19fae706951ae5da7 6226715: (ann) java.lang.annotation.AnnotationTypeMismatchException could not be serialized Reviewed-by: rriggs diff -r 584070257500 -r 3ee56008894b jdk/src/java.base/share/classes/java/lang/annotation/AnnotationTypeMismatchException.java --- a/jdk/src/java.base/share/classes/java/lang/annotation/AnnotationTypeMismatchException.java Tue Jul 05 20:41:56 2016 -0700 +++ b/jdk/src/java.base/share/classes/java/lang/annotation/AnnotationTypeMismatchException.java Tue Jul 05 21:11:40 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ /** * The {@code Method} object for the annotation element. */ - private final Method element; + private final transient Method element; /** * The (erroneous) type of data found in the annotation. This string @@ -57,10 +57,12 @@ * Constructs an AnnotationTypeMismatchException for the specified * annotation type element and found data type. * - * @param element the {@code Method} object for the annotation element + * @param element the {@code Method} object for the annotation + * element, may be {@code null} * @param foundType the (erroneous) type of data found in the annotation. * This string may, but is not required to, contain the value - * as well. The exact format of the string is unspecified. + * as well. The exact format of the string is unspecified, + * may be {@code null}. */ public AnnotationTypeMismatchException(Method element, String foundType) { super("Incorrectly typed data found for annotation element " + element @@ -71,8 +73,11 @@ /** * Returns the {@code Method} object for the incorrectly typed element. + * The value may be unavailable if this exception has been + * serialized and then read back in. * - * @return the {@code Method} object for the incorrectly typed element + * @return the {@code Method} object for the incorrectly typed + * element, or {@code null} if unavailable */ public Method element() { return this.element; @@ -81,7 +86,8 @@ /** * Returns the type of data found in the incorrectly typed element. * The returned string may, but is not required to, contain the value - * as well. The exact format of the string is unspecified. + * as well. The exact format of the string is unspecified and the string + * may be {@code null}. * * @return the type of data found in the incorrectly typed element */