test/jdk/java/io/Serializable/unshared/Write.java
changeset 58565 baa5969ecf34
parent 47216 71c04702a3d5
equal deleted inserted replaced
58564:218a1a642c6f 58565:baa5969ecf34
     1 /*
     1 /*
     2  * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 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.
    35  */
    35  */
    36 
    36 
    37 import java.io.*;
    37 import java.io.*;
    38 
    38 
    39 class Foo implements Serializable {
    39 class Foo implements Serializable {
       
    40     private static final long serialVersionUID = 1L;
       
    41 
    40     private static final ObjectStreamField[] serialPersistentFields =
    42     private static final ObjectStreamField[] serialPersistentFields =
    41         new ObjectStreamField[] {
    43         new ObjectStreamField[] {
    42             new ObjectStreamField("shared1", String.class),
    44             new ObjectStreamField("shared1", String.class),
    43             new ObjectStreamField("shared2", String.class, false),
    45             new ObjectStreamField("shared2", String.class, false),
    44             new ObjectStreamField("unshared1", String.class, true),
    46             new ObjectStreamField("unshared1", String.class, true),
    52     }
    54     }
    53 }
    55 }
    54 
    56 
    55 class Bar implements Serializable {
    57 class Bar implements Serializable {
    56     private static final long serialVersionUID = 0L;
    58     private static final long serialVersionUID = 0L;
       
    59     @SuppressWarnings("serial") /* Incorrect use is being tested */
    57     Object obj;
    60     Object obj;
    58 
    61 
    59     Bar(Object obj) {
    62     Bar(Object obj) {
    60         this.obj = obj;
    63         this.obj = obj;
    61     }
    64     }