提交 7dca92cd 编写于 作者: D darcy

8001309: Better handling of annotation interfaces

Reviewed-by: ahgross, smarks, alanb
上级 a6615d16
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -337,12 +337,15 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable { ...@@ -337,12 +337,15 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
try { try {
annotationType = AnnotationType.getInstance(type); annotationType = AnnotationType.getInstance(type);
} catch(IllegalArgumentException e) { } catch(IllegalArgumentException e) {
// Class is no longer an annotation type; all bets are off // Class is no longer an annotation type; time to punch out
return; throw new java.io.InvalidObjectException("Non-annotation type in annotation serial stream");
} }
Map<String, Class<?>> memberTypes = annotationType.memberTypes(); 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()) { for (Map.Entry<String, Object> memberValue : memberValues.entrySet()) {
String name = memberValue.getKey(); String name = memberValue.getKey();
Class<?> memberType = memberTypes.get(name); Class<?> memberType = memberTypes.get(name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册