test/jdk/java/io/Serializable/wrongReturnTypes/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.
    41     private static final long serialVersionUID = 0L;
    41     private static final long serialVersionUID = 0L;
    42 
    42 
    43     static boolean writeObjectCalled;
    43     static boolean writeObjectCalled;
    44     static boolean writeReplaceCalled;
    44     static boolean writeReplaceCalled;
    45 
    45 
       
    46     @SuppressWarnings("serial") /* Incorrect use is being tested */
    46     private Object writeObject(ObjectOutputStream out) throws IOException {
    47     private Object writeObject(ObjectOutputStream out) throws IOException {
    47         writeObjectCalled = true;
    48         writeObjectCalled = true;
    48         out.defaultWriteObject();
    49         out.defaultWriteObject();
    49         return null;
    50         return null;
    50     }
    51     }
    51 
    52 
       
    53     @SuppressWarnings("serial") /* Incorrect use is being tested */
    52     private B writeReplace() throws ObjectStreamException {
    54     private B writeReplace() throws ObjectStreamException {
    53         writeReplaceCalled = true;
    55         writeReplaceCalled = true;
    54         return this;
    56         return this;
    55     }
    57     }
    56 }
    58 }