test/jdk/java/io/Serializable/sanityCheck/SanityCheck.java
changeset 58565 baa5969ecf34
parent 47216 71c04702a3d5
equal deleted inserted replaced
58564:218a1a642c6f 58565:baa5969ecf34
     1 /*
     1 /*
     2  * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 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.
    29 
    29 
    30 import java.io.*;
    30 import java.io.*;
    31 import java.util.*;
    31 import java.util.*;
    32 
    32 
    33 class Item implements Serializable {
    33 class Item implements Serializable {
       
    34     private static final long serialVersionUID = 1L;
    34 
    35 
    35     static final int ARRAYLEN = 1000;
    36     static final int ARRAYLEN = 1000;
    36     static final int STRLEN = 1000;
    37     static final int STRLEN = 1000;
    37     static Random rand = new Random(System.currentTimeMillis());
    38     static Random rand = new Random(System.currentTimeMillis());
    38 
    39 
    53     float[] fary;
    54     float[] fary;
    54     long[] jary;
    55     long[] jary;
    55     double[] dary;
    56     double[] dary;
    56 
    57 
    57     String str;
    58     String str;
       
    59     @SuppressWarnings("serial")  /* Incorrect declarations are being tested */
    58     Object[] oary;
    60     Object[] oary;
    59 
    61 
    60     Item() {
    62     Item() {
    61         z = rand.nextBoolean();
    63         z = rand.nextBoolean();
    62         b = (byte) rand.nextInt();
    64         b = (byte) rand.nextInt();
    84             sary[i] = (short) rand.nextInt();
    86             sary[i] = (short) rand.nextInt();
    85             iary[i] = rand.nextInt();
    87             iary[i] = rand.nextInt();
    86             fary[i] = rand.nextFloat();
    88             fary[i] = rand.nextFloat();
    87             jary[i] = rand.nextLong();
    89             jary[i] = rand.nextLong();
    88             dary[i] = rand.nextDouble();
    90             dary[i] = rand.nextDouble();
    89             oary[i] = new Integer(rand.nextInt());
    91             oary[i] = rand.nextInt();
    90         }
    92         }
    91 
    93 
    92         char[] strChars = new char[STRLEN];
    94         char[] strChars = new char[STRLEN];
    93         for (int i = 0; i < STRLEN; i++) {
    95         for (int i = 0; i < STRLEN; i++) {
    94             strChars[i] = (char) rand.nextInt();
    96             strChars[i] = (char) rand.nextInt();
   124             return false;
   126             return false;
   125         }
   127         }
   126 
   128 
   127         return true;
   129         return true;
   128     }
   130     }
       
   131 
       
   132     @Override
       
   133     public int hashCode() {
       
   134         return Objects.hash(i, j);
       
   135     }
   129 }
   136 }
   130 
   137 
   131 public class SanityCheck {
   138 public class SanityCheck {
   132     public static void main(String[] args) throws Exception {
   139     public static void main(String[] args) throws Exception {
   133         for (int i = 0; i < 20; i++) {
   140         for (int i = 0; i < 20; i++) {