test/jdk/java/io/Serializable/evolution/AddedField/WriteAddedField.java
changeset 58565 baa5969ecf34
parent 47216 71c04702a3d5
equal deleted inserted replaced
58564:218a1a642c6f 58565:baa5969ecf34
     1 /*
     1 /*
     2  * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 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 NewFieldClass implements Serializable {
    39 class NewFieldClass implements Serializable {
       
    40     private static final long serialVersionUID = 1L;
       
    41 
    40     int k;
    42     int k;
    41 
    43 
    42     NewFieldClass(int value) {
    44     NewFieldClass(int value) {
    43         k = value;
    45         k = value;
    44     }
    46     }
    45 };
    47 };
    46 
    48 
    47 class IncompatibleFieldClass implements Serializable {
    49 class IncompatibleFieldClass implements Serializable {
    48     private static long serialVersionUID = 3L;
    50     private static final long serialVersionUID = 3L;
    49     int x = 5;
    51     int x = 5;
    50 };
    52 };
    51 
    53 
       
    54 @SuppressWarnings("serial") /* Incorrect use is being tested */
    52 class NewExternFieldClass implements Externalizable {
    55 class NewExternFieldClass implements Externalizable {
       
    56     private static final long serialVersionUID = 1L;
       
    57 
    53     byte l;
    58     byte l;
    54 
    59 
    55     public NewExternFieldClass(int value) {
    60     public NewExternFieldClass(int value) {
    56         l = (byte)value;
    61         l = (byte)value;
    57     }
    62     }