test/jdk/java/io/Serializable/ClassCastExceptionDetail/Write.java
changeset 58565 baa5969ecf34
parent 47216 71c04702a3d5
equal deleted inserted replaced
58564:218a1a642c6f 58565:baa5969ecf34
     1 /*
     1 /*
     2  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 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.
    39 
    39 
    40 import java.io.*;
    40 import java.io.*;
    41 
    41 
    42 class Foo implements Serializable {
    42 class Foo implements Serializable {
    43     private static final long serialVersionUID = 0L;
    43     private static final long serialVersionUID = 0L;
    44     private Integer bar = new Integer(0);
    44     private Integer bar = 0;
    45 }
    45 }
    46 
    46 
    47 class Gub extends Foo {}
    47 class Gub extends Foo {
       
    48     private static final long serialVersionUID = 1L;
       
    49 }
    48 
    50 
    49 public class Write {
    51 public class Write {
    50     public static void main(String[] args) throws Exception {
    52     public static void main(String[] args) throws Exception {
    51         ObjectOutputStream oout =
    53         ObjectOutputStream oout =
    52             new ObjectOutputStream(new FileOutputStream("tmp.ser"));
    54             new ObjectOutputStream(new FileOutputStream("tmp.ser"));