test/jdk/java/io/ObjectInputStream/ResolveProxyClass.java
changeset 58565 baa5969ecf34
parent 47216 71c04702a3d5
equal deleted inserted replaced
58564:218a1a642c6f 58565:baa5969ecf34
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 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.
    34  *
    34  *
    35  * @build ResolveProxyClass
    35  * @build ResolveProxyClass
    36  * @run main ResolveProxyClass
    36  * @run main ResolveProxyClass
    37  */
    37  */
    38 
    38 
    39 import java.lang.reflect.*;
       
    40 import java.io.*;
    39 import java.io.*;
    41 
    40 
    42 public class ResolveProxyClass {
    41 public class ResolveProxyClass {
    43 
    42 
    44     /*
    43     /*
    50 
    49 
    51         TestObjectInputStream() throws IOException {
    50         TestObjectInputStream() throws IOException {
    52             super();
    51             super();
    53         }
    52         }
    54 
    53 
    55         protected Class resolveProxyClass(String[] interfaces)
    54         protected Class<?> resolveProxyClass(String[] interfaces)
    56             throws IOException, ClassNotFoundException
    55             throws IOException, ClassNotFoundException
    57         {
    56         {
    58             return super.resolveProxyClass(interfaces);
    57             return super.resolveProxyClass(interfaces);
    59         }
    58         }
    60     }
    59     }
    80              * ObjectInputStream.resolveProxyClass gets executed.
    79              * ObjectInputStream.resolveProxyClass gets executed.
    81              */
    80              */
    82             ClassLoader expectedLoader = ResolveProxyClass.class.getClassLoader();
    81             ClassLoader expectedLoader = ResolveProxyClass.class.getClassLoader();
    83 
    82 
    84             TestObjectInputStream in = new TestObjectInputStream();
    83             TestObjectInputStream in = new TestObjectInputStream();
    85             Class proxyClass = in.resolveProxyClass(
    84             Class<?> proxyClass = in.resolveProxyClass(
    86                 new String[] { Runnable.class.getName() });
    85                 new String[] { Runnable.class.getName() });
    87             ClassLoader proxyLoader = proxyClass.getClassLoader();
    86             ClassLoader proxyLoader = proxyClass.getClassLoader();
    88             System.err.println("proxy class \"" + proxyClass +
    87             System.err.println("proxy class \"" + proxyClass +
    89                 "\" defined in loader: " + proxyLoader);
    88                 "\" defined in loader: " + proxyLoader);
    90 
    89