changeset 6308:0ca6cbe3f350

8001309: Better handling of annotation interfaces Reviewed-by: darcy
author dmeetry
date Mon, 25 Mar 2013 12:41:55 +0400
parents ec931d812faa
children 141facdacbf0
files src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Fri Mar 22 15:40:16 2013 -0400
+++ b/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Mon Mar 25 12:41:55 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -337,12 +337,15 @@
         try {
             annotationType = AnnotationType.getInstance(type);
         } catch(IllegalArgumentException e) {
-            // Class is no longer an annotation type; all bets are off
-            return;
+            // Class is no longer an annotation type; time to punch out
+            throw new java.io.InvalidObjectException("Non-annotation type in annotation serial stream");
         }
 
         Map<String, Class<?>> memberTypes = annotationType.memberTypes();
 
+
+        // If there are annotation members without values, that
+        // situation is handled by the invoke method.
         for (Map.Entry<String, Object> memberValue : memberValues.entrySet()) {
             String name = memberValue.getKey();
             Class<?> memberType = memberTypes.get(name);