@@ -0,0 +1,2280 @@
+/*%0A * Copyright 2006 The Apache Software Foundation or its licensors, as%0A * applicable%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A * %0A *     http://www.apache.org/licenses/LICENSE-2.0%0A * %0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.apache.harmony.luni.tests.java.io;%0A%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.ObjectInputStream;%0Aimport java.io.ObjectOutputStream;%0Aimport java.io.Serializable;%0Aimport java.util.ArrayList;%0A%0Aimport junit.framework.TestCase;%0A%0Apublic class ObjectInputStreamTest extends TestCase %7B%0A%0A%09/**%0A%09 * Micro-scenario of de/serialization of an object with non-serializable superclass.%0A%09 * The super-constructor only should be invoked on the deserialized instance.%0A%09 */%0A%09public void test_readObject_Hierarchy() throws Exception %7B%0A%09    ByteArrayOutputStream baos = new ByteArrayOutputStream(); %0A%0A%09    ObjectOutputStream oos = new ObjectOutputStream(baos); %0A%09    oos.writeObject(new B());%0A%09    oos.close(); %0A%0A%09    ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray())); %0A%09    B b = (B) ois.readObject();%0A%09    ois.close();%0A%09    %0A%09    assertTrue(%22should construct super%22, A.list.contains(b));%0A%09    assertFalse(%22should not construct self%22, B.list.contains(b));%0A%09    assertEquals(%22super field A.s%22, A.DEFAULT, ((A)b).s);%0A%09    assertNull(%22transient field B.s%22, b.s);%0A%09%7D%0A%0A%09static class A %7B %0A%09%09static final ArrayList%3CA%3E list = new ArrayList%3CA%3E();  %0A%09    String s;%0A%09    public static final String DEFAULT = %22aaa%22;%0A%09    public A() %7B%0A%09    %09s = DEFAULT;%0A%09    %09list.add(this);%0A%09    %7D%0A%09%7D %0A%0A%09static class B extends A implements Serializable %7B %0A        private static final long serialVersionUID = 1L;%0A        static final ArrayList%3CA%3E list = new ArrayList%3CA%3E();  %0A%09    transient String s;%0A%09    public B() %7B%0A%09    %09s = %22bbb%22;%0A%09    %09list.add(this);%0A%09    %7D%0A%09%7D %09%0A%7D%0A%0A%0A

Apply test for HARMONY-812 (transient fields are serialized)