JDK-7080038 : (ann) Serializable types in sun.reflect.annotation do not declare serialVersionUIDs
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 8
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-08-17
  • Updated: 2017-05-16
  • Resolved: 2012-05-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other JDK 7 JDK 8
5.0u75Fixed 5.0u81Fixed 7u2Fixed 8 b04Fixed
Related Reports
Relates :  
Relates :  
Description
The serializable types in sun.reflect.annotation.* used to persist annotation objects do not declare serialVersionUIDs, making the classes suspectible to compatability problems when those classes are edited.

Comments
This is regression in CPU14_04. We have to have it fixed in 5.0u75. SQE OK to take it.
11-08-2014

SQE has looked at the bug and decided no additional tests are needed.
14-08-2013

It is a trivial fix, and can be covered by tests from CR7067132.
14-08-2013

PUBLIC COMMENTS See http://hg.openjdk.java.net/jdk8/tl/jdk/rev/71e353aba896
23-08-2011

EVALUATION A fine idea.
17-08-2011

SUGGESTED FIX Add JDK 5-era serialVersionUIDs to the types in question: diff --git a/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java b/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java --- a/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java +++ b/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, 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 @@ -40,6 +40,7 @@ * @since 1.5 */ class AnnotationInvocationHandler implements InvocationHandler, Serializable { + private static final long serialVersionUID = 6182022883658399397L; private final Class<? extends Annotation> type; private final Map<String, Object> memberValues; diff --git a/src/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java b/src/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java --- a/src/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java +++ b/src/share/classes/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2011, 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 @@ -34,6 +34,7 @@ * @since 1.5 */ class AnnotationTypeMismatchExceptionProxy extends ExceptionProxy { + private static final long serialVersionUID = 7844069490309503934L; private Method member; private String foundType; diff --git a/src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java b/src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java --- a/src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java +++ b/src/share/classes/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2011, 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 @@ -33,6 +33,7 @@ * @since 1.5 */ public class EnumConstantNotPresentExceptionProxy extends ExceptionProxy { + private static final long serialVersionUID = -604662101303187330L; Class<? extends Enum> enumType; String constName; diff --git a/src/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java b/src/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java --- a/src/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java +++ b/src/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2011, 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 @@ -33,6 +33,7 @@ * @since 1.5 */ public class TypeNotPresentExceptionProxy extends ExceptionProxy { + private static final long serialVersionUID = 5565925172427947573L; String typeName; Throwable cause;
17-08-2011