test/jdk/java/io/Serializable/NoClassDefFoundErrorTrap/NoClassDefFoundErrorTrap.java
changeset 58565 baa5969ecf34
parent 47216 71c04702a3d5
equal deleted inserted replaced
58564:218a1a642c6f 58565:baa5969ecf34
     1 /*
     1 /*
     2  * Copyright (c) 1999, 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.
    38 public class NoClassDefFoundErrorTrap {
    38 public class NoClassDefFoundErrorTrap {
    39 
    39 
    40     private static NoClassDefFoundError ncdfe;
    40     private static NoClassDefFoundError ncdfe;
    41 
    41 
    42     public interface Bar {}
    42     public interface Bar {}
    43     public static class Foo implements Bar, java.io.Serializable {}
    43     public static class Foo implements Bar, java.io.Serializable {
       
    44         private static final long serialVersionUID = 1L;
       
    45     }
    44 
    46 
    45     /**
    47     /**
    46      * Test subclass of ObjectInputStream that overrides resolveClass
    48      * Test subclass of ObjectInputStream that overrides resolveClass
    47      * to throw a NoClassDefFoundError if our test class "Foo" is to
    49      * to throw a NoClassDefFoundError if our test class "Foo" is to
    48      * be resolved.
    50      * be resolved.
    53             throws IOException
    55             throws IOException
    54         {
    56         {
    55             super(in);
    57             super(in);
    56         }
    58         }
    57 
    59 
    58         protected Class resolveClass(ObjectStreamClass desc)
    60         protected Class<?> resolveClass(ObjectStreamClass desc)
    59             throws IOException, ClassNotFoundException
    61             throws IOException, ClassNotFoundException
    60         {
    62         {
    61             String name = desc.getName();
    63             String name = desc.getName();
    62 
    64 
    63             if (name.equals(Foo.class.getName())) {
    65             if (name.equals(Foo.class.getName())) {