changeset 4892:c87f9d33fde6

8001309: Better handling of annotation interfaces Reviewed-by: darcy
author dmeetry
date Mon, 25 Mar 2013 12:41:55 +0400
parents 6e5d9d0cfcc9
children 5dd926007336
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	Wed Jun 12 15:05:39 2013 +0100
+++ 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);