equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2019, 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. |
7 * published by the Free Software Foundation. |
28 |
28 |
29 import java.io.*; |
29 import java.io.*; |
30 import java.lang.reflect.Array; |
30 import java.lang.reflect.Array; |
31 |
31 |
32 class A implements Serializable { |
32 class A implements Serializable { |
|
33 private static final long serialVersionUID = 1L; |
|
34 |
33 String stringA; |
35 String stringA; |
34 String stringB; |
36 String stringB; |
35 String stringC; |
37 String stringC; |
36 String[] arrayOfString; |
38 String[] arrayOfString; |
37 |
39 |
72 } |
74 } |
73 if (obj.getClass().isArray()) { |
75 if (obj.getClass().isArray()) { |
74 Object[] array = (Object[]) obj; |
76 Object[] array = (Object[]) obj; |
75 /* Double the array. |
77 /* Double the array. |
76 * Initialize new array elements with original array. */ |
78 * Initialize new array elements with original array. */ |
77 Class arrayComponentType = array.getClass().getComponentType(); |
79 Class<?> arrayComponentType = array.getClass().getComponentType(); |
78 Object[] newarray = |
80 Object[] newarray = |
79 (Object[])Array.newInstance(arrayComponentType, |
81 (Object[])Array.newInstance(arrayComponentType, |
80 array.length * 2); |
82 array.length * 2); |
81 for (int i = 0; i < array.length; i++) |
83 for (int i = 0; i < array.length; i++) |
82 newarray[i] = array[i]; |
84 newarray[i] = array[i]; |
106 if (obj.getClass().isArray()) { |
108 if (obj.getClass().isArray()) { |
107 Object[] array = (Object[])obj; |
109 Object[] array = (Object[])obj; |
108 |
110 |
109 /* Double the array. |
111 /* Double the array. |
110 * Initialize new array elements with original array. */ |
112 * Initialize new array elements with original array. */ |
111 Class arrayComponentType = array.getClass().getComponentType(); |
113 Class<?> arrayComponentType = array.getClass().getComponentType(); |
112 Object[] newarray = |
114 Object[] newarray = |
113 (Object[])Array.newInstance(arrayComponentType, |
115 (Object[])Array.newInstance(arrayComponentType, |
114 array.length * 2); |
116 array.length * 2); |
115 for (int i = 0; i < array.length; i++) |
117 for (int i = 0; i < array.length; i++) |
116 newarray[i] = array[i]; |
118 newarray[i] = array[i]; |