1 /* 2 * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 public class ArrayTest implements java.io.Serializable { 25 private static final long serialVersionUID = 1L; 26 27 byte b[] = { 0, 1}; 28 short s[] = { 0, 1, 2}; 29 char c[] = { 'Z', 'Y', 'X'}; 30 int i[] = { 0, 1, 2, 3, 4}; 31 long l[] = { 0, 1, 2, 3, 4, 5}; 32 boolean z[] = new boolean[4]; 33 float f[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f}; 34 double d[] = { 1.0d, 2.0d, 3.0d, 4.0d, 5.0d, 6.0d, 7.0d}; 35 String string[] = { "ABC", "DEF", "GHI", "JKL"}; 36 PrimitivesTest prim[] = { new PrimitivesTest(), new PrimitivesTest() } ; 37 38 transient int ti[] = {99, 98, 97, 96}; 39 ArrayTest self = this; 40 41 static int si[] = {9, 8, 7, 6, 4} ; 42 ArrayTest()43 public ArrayTest() { 44 z[0] = true; 45 z[1] = false; 46 z[2] = true; 47 z[3] = false; 48 } 49 equals(ArrayTest other)50 public boolean equals(ArrayTest other) { 51 boolean ret = true; 52 if (other == null) { 53 System.err.println("\nother Array is " + other); 54 return false; 55 } 56 if (!ArrayOpsTest.verify(i, other.i)) { 57 System.err.println("\nUnpickling of int array failed"); 58 ret = false; 59 } 60 if (!ArrayOpsTest.verify(b, other.b)) { 61 System.err.println("\nUnpickling of byte array failed"); 62 ret = false; 63 } 64 if (!ArrayOpsTest.verify(s, other.s)) { 65 System.err.println("\nUnpickling of short array failed"); 66 ret = false; 67 } 68 if (!ArrayOpsTest.verify(c, other.c)) { 69 System.err.println("\nUnpickling of char array failed"); 70 ret = false; 71 } 72 if (!ArrayOpsTest.verify(l, other.l)) { 73 System.err.println("\nUnpickling of long array failed"); 74 ret = false; 75 } 76 if (!ArrayOpsTest.verify(f, other.f)) { 77 System.err.println("\nUnpickling of float array failed"); 78 ret = false; 79 } 80 if (!ArrayOpsTest.verify(d, other.d)) { 81 System.err.println("\nUnpickling of double array failed"); 82 ret = false; 83 } 84 if (!ArrayOpsTest.verify(z, other.z)) { 85 System.err.println("\nUnpickling of boolean array failed"); 86 ret = false; 87 } 88 if (!ArrayOpsTest.verify(string, other.string)) { 89 System.err.println("\nUnpickling of String array failed"); 90 ret = false; 91 } 92 if (!ArrayOpsTest.verify(prim, other.prim)) { 93 System.err.println("\nUnpickling of Primitives array failed"); 94 ret = false; 95 } 96 return ret; 97 } 98 } 99