6990133: AnnotationProxyMaker.ValueVisitor$1 contains non-transient non-serializable field
authorjjg
Tue, 12 Oct 2010 14:22:55 -0700
changeset 6931 d6339142c51f
parent 6930 b6fea484cbb2
child 6932 ded41b98a923
6990133: AnnotationProxyMaker.ValueVisitor$1 contains non-transient non-serializable field Reviewed-by: darcy
langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java
langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java
--- a/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java	Tue Oct 12 13:19:47 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java	Tue Oct 12 14:22:55 2010 -0700
@@ -250,9 +250,13 @@
         /**
          * Sets "value" to an ExceptionProxy indicating a type mismatch.
          */
-        private void typeMismatch(final Method method, final Attribute attr) {
-            value = new ExceptionProxy() {
+        private void typeMismatch(Method method, final Attribute attr) {
+            class AnnotationTypeMismatchExceptionProxy extends ExceptionProxy {
                 private static final long serialVersionUID = 8473323277815075163L;
+                transient final Method method;
+                AnnotationTypeMismatchExceptionProxy(Method method) {
+                    this.method = method;
+                }
                 public String toString() {
                     return "<error>";   // eg:  @Anno(value=<error>)
                 }
@@ -260,7 +264,8 @@
                     return new AnnotationTypeMismatchException(method,
                                 attr.type.toString());
                 }
-            };
+            }
+            value = new AnnotationTypeMismatchExceptionProxy(method);
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java	Tue Oct 12 13:19:47 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java	Tue Oct 12 14:22:55 2010 -0700
@@ -250,9 +250,13 @@
         /**
          * Sets "value" to an ExceptionProxy indicating a type mismatch.
          */
-        private void typeMismatch(final Method method, final Attribute attr) {
-            value = new ExceptionProxy() {
+        private void typeMismatch(Method method, final Attribute attr) {
+            class AnnotationTypeMismatchExceptionProxy extends ExceptionProxy {
                 static final long serialVersionUID = 269;
+                transient final Method method;
+                AnnotationTypeMismatchExceptionProxy(Method method) {
+                    this.method = method;
+                }
                 public String toString() {
                     return "<error>";   // eg:  @Anno(value=<error>)
                 }
@@ -260,7 +264,8 @@
                     return new AnnotationTypeMismatchException(method,
                                 attr.type.toString());
                 }
-            };
+            }
+            value = new AnnotationTypeMismatchExceptionProxy(method);
         }
     }