Tue, 12 Oct 2010 14:22:55 -0700
6990133: AnnotationProxyMaker.ValueVisitor$1 contains non-transient non-serializable field
Reviewed-by: darcy
1.1 --- a/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java Tue Oct 12 13:19:47 2010 -0700 1.2 +++ b/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java Tue Oct 12 14:22:55 2010 -0700 1.3 @@ -250,9 +250,13 @@ 1.4 /** 1.5 * Sets "value" to an ExceptionProxy indicating a type mismatch. 1.6 */ 1.7 - private void typeMismatch(final Method method, final Attribute attr) { 1.8 - value = new ExceptionProxy() { 1.9 + private void typeMismatch(Method method, final Attribute attr) { 1.10 + class AnnotationTypeMismatchExceptionProxy extends ExceptionProxy { 1.11 private static final long serialVersionUID = 8473323277815075163L; 1.12 + transient final Method method; 1.13 + AnnotationTypeMismatchExceptionProxy(Method method) { 1.14 + this.method = method; 1.15 + } 1.16 public String toString() { 1.17 return "<error>"; // eg: @Anno(value=<error>) 1.18 } 1.19 @@ -260,7 +264,8 @@ 1.20 return new AnnotationTypeMismatchException(method, 1.21 attr.type.toString()); 1.22 } 1.23 - }; 1.24 + } 1.25 + value = new AnnotationTypeMismatchExceptionProxy(method); 1.26 } 1.27 } 1.28
2.1 --- a/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java Tue Oct 12 13:19:47 2010 -0700 2.2 +++ b/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java Tue Oct 12 14:22:55 2010 -0700 2.3 @@ -250,9 +250,13 @@ 2.4 /** 2.5 * Sets "value" to an ExceptionProxy indicating a type mismatch. 2.6 */ 2.7 - private void typeMismatch(final Method method, final Attribute attr) { 2.8 - value = new ExceptionProxy() { 2.9 + private void typeMismatch(Method method, final Attribute attr) { 2.10 + class AnnotationTypeMismatchExceptionProxy extends ExceptionProxy { 2.11 static final long serialVersionUID = 269; 2.12 + transient final Method method; 2.13 + AnnotationTypeMismatchExceptionProxy(Method method) { 2.14 + this.method = method; 2.15 + } 2.16 public String toString() { 2.17 return "<error>"; // eg: @Anno(value=<error>) 2.18 } 2.19 @@ -260,7 +264,8 @@ 2.20 return new AnnotationTypeMismatchException(method, 2.21 attr.type.toString()); 2.22 } 2.23 - }; 2.24 + } 2.25 + value = new AnnotationTypeMismatchExceptionProxy(method); 2.26 } 2.27 } 2.28