test/jdk/java/io/Serializable/InvalidClassException/noargctor/DefaultPackage.java
changeset 58565 baa5969ecf34
parent 47216 71c04702a3d5
equal deleted inserted replaced
58564:218a1a642c6f 58565:baa5969ecf34
     1 /*
     1 /*
     2  * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 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.
    54 };
    54 };
    55 
    55 
    56 class DefaultPublicSerializable
    56 class DefaultPublicSerializable
    57 extends DefaultPackagePublicConstructor implements Serializable
    57 extends DefaultPackagePublicConstructor implements Serializable
    58 {
    58 {
       
    59     private static final long serialVersionUID = 1L;
       
    60 
    59     int field1 = 5;
    61     int field1 = 5;
    60 };
    62 };
    61 
    63 
    62 class DefaultProtectedSerializable
    64 class DefaultProtectedSerializable
    63 extends DefaultPackageProtectedConstructor implements Serializable
    65 extends DefaultPackageProtectedConstructor implements Serializable
    64 {
    66 {
       
    67     private static final long serialVersionUID = 1L;
       
    68 
    65     int field1 = 5;
    69     int field1 = 5;
    66 };
    70 };
    67 
    71 
    68 class DefaultAccessSerializable
    72 class DefaultAccessSerializable
    69 extends DefaultPackageDefaultAccessConstructor implements Serializable
    73 extends DefaultPackageDefaultAccessConstructor implements Serializable
    70 {
    74 {
    71     int field1 = 5;
    75     private static final long serialVersionUID = 1L;
    72 };
    76 
    73 
    77     int field1 = 5;
       
    78 };
       
    79 
       
    80 @SuppressWarnings("serial") /* Incorrect declarations are being tested */
    74 class DefaultPrivateSerializable
    81 class DefaultPrivateSerializable
    75 extends DefaultPackagePrivateConstructor implements Serializable
    82 extends DefaultPackagePrivateConstructor implements Serializable
    76 {
    83 {
       
    84     private static final long serialVersionUID = 1L;
       
    85 
    77     int field1 = 5;
    86     int field1 = 5;
    78 
    87 
    79     DefaultPrivateSerializable() {
    88     DefaultPrivateSerializable() {
    80         super(1);
    89         super(1);
    81     }
    90     }
    82 };
    91 };
    83 
    92 
    84 class ExternalizablePublicConstructor implements Externalizable {
    93 class ExternalizablePublicConstructor implements Externalizable {
       
    94     private static final long serialVersionUID = 1L;
       
    95 
    85     public ExternalizablePublicConstructor() {
    96     public ExternalizablePublicConstructor() {
    86     }
    97     }
    87     public void writeExternal(ObjectOutput out) throws IOException {
    98     public void writeExternal(ObjectOutput out) throws IOException {
    88     }
    99     }
    89     public void readExternal(ObjectInput in)
   100     public void readExternal(ObjectInput in)
    90         throws IOException, ClassNotFoundException
   101         throws IOException, ClassNotFoundException
    91         {
   102         {
    92         }
   103         }
    93 };
   104 };
    94 
   105 
       
   106 @SuppressWarnings("serial") /* Incorrect declarations are being tested */
    95 class ExternalizableProtectedConstructor implements Externalizable {
   107 class ExternalizableProtectedConstructor implements Externalizable {
       
   108     private static final long serialVersionUID = 1L;
       
   109 
    96     protected ExternalizableProtectedConstructor() {
   110     protected ExternalizableProtectedConstructor() {
    97     }
   111     }
    98     public void writeExternal(ObjectOutput out) throws IOException {
   112     public void writeExternal(ObjectOutput out) throws IOException {
    99     }
   113     }
   100     public void readExternal(ObjectInput in)
   114     public void readExternal(ObjectInput in)
   101         throws IOException, ClassNotFoundException
   115         throws IOException, ClassNotFoundException
   102         {
   116         {
   103         }
   117         }
   104 };
   118 };
   105 
   119 
       
   120 @SuppressWarnings("serial") /* Incorrect declarations are being tested */
   106 class ExternalizableAccessConstructor implements Externalizable {
   121 class ExternalizableAccessConstructor implements Externalizable {
       
   122     private static final long serialVersionUID = 1L;
       
   123 
   107     ExternalizableAccessConstructor() {
   124     ExternalizableAccessConstructor() {
   108     }
   125     }
   109     public void writeExternal(ObjectOutput out) throws IOException {
   126     public void writeExternal(ObjectOutput out) throws IOException {
   110     }
   127     }
   111     public void readExternal(ObjectInput in)
   128     public void readExternal(ObjectInput in)
   112         throws IOException, ClassNotFoundException
   129         throws IOException, ClassNotFoundException
   113         {
   130         {
   114         }
   131         }
   115 };
   132 };
   116 
   133 
       
   134 @SuppressWarnings("serial") /* Incorrect declarations are being tested */
   117 class ExternalizablePrivateConstructor implements Externalizable {
   135 class ExternalizablePrivateConstructor implements Externalizable {
       
   136     private static final long serialVersionUID = 1L;
       
   137 
   118     private ExternalizablePrivateConstructor() {
   138     private ExternalizablePrivateConstructor() {
   119     }
   139     }
   120     public ExternalizablePrivateConstructor(int i) {
   140     public ExternalizablePrivateConstructor(int i) {
   121     }
   141     }
   122     public void writeExternal(ObjectOutput out) throws IOException {
   142     public void writeExternal(ObjectOutput out) throws IOException {