test/jdk/java/io/Serializable/resolveClass/MethodTest.java
changeset 58565 baa5969ecf34
parent 47216 71c04702a3d5
equal deleted inserted replaced
58564:218a1a642c6f 58565:baa5969ecf34
     1 /*
     1 /*
     2  * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 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.
    29 
    29 
    30 import java.io.*;
    30 import java.io.*;
    31 import java.lang.reflect.*;
    31 import java.lang.reflect.*;
    32 
    32 
    33 public class MethodTest implements Serializable {
    33 public class MethodTest implements Serializable {
       
    34     private static final long serialVersionUID = 1L;
       
    35 
    34     public static void main(String[] args) throws Exception {
    36     public static void main(String[] args) throws Exception {
    35         Method readObject = ObjectInputStream.class.getDeclaredMethod(
    37         Method readObject = ObjectInputStream.class.getDeclaredMethod(
    36             "readObject", new Class[0]);
    38             "readObject", new Class<?>[0]);
    37         ByteArrayOutputStream bout = new ByteArrayOutputStream();
    39         ByteArrayOutputStream bout = new ByteArrayOutputStream();
    38         ObjectOutputStream oout = new ObjectOutputStream(bout);
    40         ObjectOutputStream oout = new ObjectOutputStream(bout);
    39         oout.writeObject(new MethodTest());
    41         oout.writeObject(new MethodTest());
    40         oout.close();
    42         oout.close();
    41 
    43