JDK-6917323 : serializable classes in java.dyn do not specify serialVersionUIDs
Type:Bug
Component:core-libs
Sub-Component:java.lang.invoke
Affected Version:7
Priority:P3
Status:Closed
Resolution:Fixed
OS:generic
CPU:generic
Submitted:2010-01-15
Updated:2017-05-16
Resolved:2011-01-11
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.
Missing serialVersionUIDs in java.dyn.NoAccessException, java.dyn.WrongMethodTypeException, java.dyn.InvokeDynamicBootstrapError and java.dyn.LinkagePermission.
Comments
PUBLIC COMMENTS
See
http://hg.openjdk.java.net/jdk7/tl/jdk/rev/a6295291fab1
07-10-2010
SUGGESTED FIX
# HG changeset patch
# User darcy
# Date 1286427328 25200
# Node ID a6295291fab141d640730ac1ddffc46d217ae524
# Parent 6fd4928b82a218a0b77d58adc878f02ce0c6fecc
6917323: serializable classes in java.dyn do not specify serialVersionUIDs
Reviewed-by: jrose
--- a/src/share/classes/java/dyn/InvokeDynamicBootstrapError.java Wed Oct 06 10:11:45 2010 -0400
+++ b/src/share/classes/java/dyn/InvokeDynamicBootstrapError.java Wed Oct 06 21:55:28 2010 -0700
@@ -39,8 +39,11 @@ package java.dyn;
* {@link Linkage#registerBootstrapMethod registerBootstrapMethod}.
*
* @author John Rose, JSR 292 EG
+ * @since 1.7
*/
public class InvokeDynamicBootstrapError extends LinkageError {
+ private static final long serialVersionUID = 292L;
+
/**
* Constructs an {@code InvokeDynamicBootstrapError} with no detail message.
*/
@@ -63,10 +66,9 @@ public class InvokeDynamicBootstrapError
* detail message and cause.
*
* @param s the detail message.
- * @param cause the cause.
+ * @param cause the cause, may be {@code null}.
*/
public InvokeDynamicBootstrapError(String s, Throwable cause) {
- super(s);
- this.initCause(cause);
+ super(s, cause);
}
}
--- a/src/share/classes/java/dyn/LinkagePermission.java Wed Oct 06 10:11:45 2010 -0400
+++ b/src/share/classes/java/dyn/LinkagePermission.java Wed Oct 06 21:55:28 2010 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2010, 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
@@ -81,6 +81,8 @@ import java.util.StringTokenizer;
*/
public final class LinkagePermission extends BasicPermission {
+ private static final long serialVersionUID = 292L;
+
/**
* Create a new LinkagePermission with the given name.
* The name is the symbolic name of the LinkagePermission, such as
--- a/src/share/classes/java/dyn/NoAccessException.java Wed Oct 06 10:11:45 2010 -0400
+++ b/src/share/classes/java/dyn/NoAccessException.java Wed Oct 06 21:55:28 2010 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2010, 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
@@ -35,8 +35,11 @@ package java.dyn;
* on behalf of the method handle creator,
* at the time of creation.
* @author John Rose, JSR 292 EG
+ * @since 1.7
*/
public class NoAccessException extends RuntimeException {
+ private static final long serialVersionUID = 292L;
+
/**
* Constructs a {@code NoAccessException} with no detail message.
*/
--- a/src/share/classes/java/dyn/WrongMethodTypeException.java Wed Oct 06 10:11:45 2010 -0400
+++ b/src/share/classes/java/dyn/WrongMethodTypeException.java Wed Oct 06 21:55:28 2010 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2010, 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
@@ -38,8 +38,11 @@ package java.dyn;
* instead of when the mismatched method handle is called.
*
* @author John Rose, JSR 292 EG
+ * @since 1.7
*/
public class WrongMethodTypeException extends RuntimeException {
+ private static final long serialVersionUID = 292L;
+
/**
* Constructs a {@code WrongMethodTypeException} with no detail message.
*/
--- a/src/share/classes/java/lang/LinkageError.java Wed Oct 06 10:11:45 2010 -0400
+++ b/src/share/classes/java/lang/LinkageError.java Wed Oct 06 21:55:28 2010 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2010, 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
@@ -26,7 +26,7 @@ package java.lang;
package java.lang;
/**
- * Subclasses of <code>LinkageError</code> indicate that a class has
+ * Subclasses of {@code LinkageError} indicate that a class has
* some dependency on another class; however, the latter class has
* incompatibly changed after the compilation of the former class.
*
@@ -39,14 +39,14 @@ class LinkageError extends Error {
private static final long serialVersionUID = 3579600108157160122L;
/**
- * Constructs a <code>LinkageError</code> with no detail message.
+ * Constructs a {@code LinkageError} with no detail message.
*/
public LinkageError() {
super();
}
/**
- * Constructs a <code>LinkageError</code> with the specified detail
+ * Constructs a {@code LinkageError} with the specified detail
* message.
*
* @param s the detail message.
@@ -54,4 +54,16 @@ class LinkageError extends Error {
public LinkageError(String s) {
super(s);
}
+
+ /**
+ * Constructs a {@code LinkageError} with the specified detail
+ * message and cause.
+ *
+ * @param s the detail message.
+ * @param cause the cause, may be {@code null}
+ * @since 1.7
+ */
+ public LinkageError(String s, Throwable cause) {
+ super(s, cause);
+ }
}
07-10-2010
EVALUATION
Yes, exceptions in the platform should have some serialVersionUIDs defined.
28-09-2010
EVALUATION
The following constants (based on serialver output in jdk7-b79) must be added into the appropriate classes:
- java.dyn.NoAccessException
private static final long serialVersionUID = 1853747985252174171L;
- java.dyn.WrongMethodTypeException
private static final long serialVersionUID = -7548593570172219089L;
- java.dyn.InvokeDynamicBootstrapError
private static final long serialVersionUID = -4999149398186301885L;
- java.dyn.LinkagePermission
private static final long serialVersionUID = -4702152237127970627L;