equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
335 |
335 |
336 AnnotationType annotationType = null; |
336 AnnotationType annotationType = null; |
337 try { |
337 try { |
338 annotationType = AnnotationType.getInstance(type); |
338 annotationType = AnnotationType.getInstance(type); |
339 } catch(IllegalArgumentException e) { |
339 } catch(IllegalArgumentException e) { |
340 // Class is no longer an annotation type; all bets are off |
340 // Class is no longer an annotation type; time to punch out |
341 return; |
341 throw new java.io.InvalidObjectException("Non-annotation type in annotation serial stream"); |
342 } |
342 } |
343 |
343 |
344 Map<String, Class<?>> memberTypes = annotationType.memberTypes(); |
344 Map<String, Class<?>> memberTypes = annotationType.memberTypes(); |
345 |
345 |
|
346 |
|
347 // If there are annotation members without values, that |
|
348 // situation is handled by the invoke method. |
346 for (Map.Entry<String, Object> memberValue : memberValues.entrySet()) { |
349 for (Map.Entry<String, Object> memberValue : memberValues.entrySet()) { |
347 String name = memberValue.getKey(); |
350 String name = memberValue.getKey(); |
348 Class<?> memberType = memberTypes.get(name); |
351 Class<?> memberType = memberTypes.get(name); |
349 if (memberType != null) { // i.e. member still exists |
352 if (memberType != null) { // i.e. member still exists |
350 Object value = memberValue.getValue(); |
353 Object value = memberValue.getValue(); |