test/jdk/java/io/Serializable/expectedStackTrace/ExpectedStackTrace.java
changeset 58565 baa5969ecf34
parent 47216 71c04702a3d5
equal deleted inserted replaced
58564:218a1a642c6f 58565:baa5969ecf34
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 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.
    40         this.m_str = m_str;
    40         this.m_str = m_str;
    41         this.m_int = m_int;
    41         this.m_int = m_int;
    42     }
    42     }
    43 }
    43 }
    44 
    44 
       
    45 @SuppressWarnings("serial") /* Incorrect declarations are being tested */
    45 class SerializableObject extends NotSerializableObject
    46 class SerializableObject extends NotSerializableObject
    46     implements Serializable
    47     implements Serializable
    47 {
    48 {
       
    49     private static final long serialVersionUID = 1L;
    48 
    50 
    49     public SerializableObject(String m_str, Integer m_int) {
    51     public SerializableObject(String m_str, Integer m_int) {
    50         super(m_str, m_int);
    52         super(m_str, m_int);
    51     }
    53     }
    52 
    54 
    65 
    67 
    66     private static Object getObject() throws Exception {
    68     private static Object getObject() throws Exception {
    67         ObjectStreamClass osc =
    69         ObjectStreamClass osc =
    68             ObjectStreamClass.lookup(SerializableObject.class);
    70             ObjectStreamClass.lookup(SerializableObject.class);
    69         SerializableObject initObj =
    71         SerializableObject initObj =
    70             (SerializableObject) osc.forClass().newInstance();
    72             (SerializableObject) osc.forClass().getConstructor().newInstance();
    71         return initObj;
    73         return initObj;
    72     }
    74     }
    73 
    75 
    74     private static void checkSerializable(Object initObj) throws Exception {
    76     private static void checkSerializable(Object initObj) throws Exception {
    75         try {
    77         try {