src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java
Print this page
@@ -29,10 +29,12 @@
import java.lang.annotation.*;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.io.ObjectInputStream;
+import java.io.IOException;
import sun.reflect.annotation.*;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.MirroredTypeException;
import javax.lang.model.type.MirroredTypesException;
@@ -266,14 +268,14 @@
/**
* ExceptionProxy for MirroredTypeException.
* The toString, hashCode, and equals methods foward to the underlying
* type.
*/
- private static class MirroredTypeExceptionProxy extends ExceptionProxy {
+ private static final class MirroredTypeExceptionProxy extends ExceptionProxy {
static final long serialVersionUID = 269;
- private transient final TypeMirror type;
+ private transient TypeMirror type;
private final String typeString;
MirroredTypeExceptionProxy(TypeMirror t) {
type = t;
typeString = t.toString();
@@ -294,22 +296,29 @@
}
protected RuntimeException generateException() {
return new MirroredTypeException(type);
}
+
+ // Explicitly set all transient fields.
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException {
+ s.defaultReadObject();
+ type = null;
+ }
}
/**
* ExceptionProxy for MirroredTypesException.
* The toString, hashCode, and equals methods foward to the underlying
* types.
*/
- private static class MirroredTypesExceptionProxy extends ExceptionProxy {
+ private static final class MirroredTypesExceptionProxy extends ExceptionProxy {
static final long serialVersionUID = 269;
- private transient final List<TypeMirror> types;
+ private transient List<TypeMirror> types;
private final String typeStrings;
MirroredTypesExceptionProxy(List<TypeMirror> ts) {
types = ts;
typeStrings = ts.toString();
@@ -331,7 +340,14 @@
}
protected RuntimeException generateException() {
return new MirroredTypesException(types);
}
+
+ // Explicitly set all transient fields.
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException {
+ s.defaultReadObject();
+ types = null;
+ }
}
}