equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 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. |
40 interface I {} // interface present only on writing side |
40 interface I {} // interface present only on writing side |
41 |
41 |
42 class A implements Serializable { |
42 class A implements Serializable { |
43 private static final long serialVersionUID = 0L; |
43 private static final long serialVersionUID = 0L; |
44 String a = "a"; |
44 String a = "a"; |
|
45 @SuppressWarnings("serial") /* Incorrect declarations are being tested */ |
45 Object proxy; |
46 Object proxy; |
46 String z = "z"; |
47 String z = "z"; |
47 |
48 |
48 A(Object proxy) { this.proxy = proxy; } |
49 A(Object proxy) { this.proxy = proxy; } |
49 } |
50 } |
63 |
64 |
64 public class Write { |
65 public class Write { |
65 public static void main(String[] args) throws Exception { |
66 public static void main(String[] args) throws Exception { |
66 Object proxy = Proxy.newProxyInstance( |
67 Object proxy = Proxy.newProxyInstance( |
67 Write.class.getClassLoader(), |
68 Write.class.getClassLoader(), |
68 new Class[] { I.class }, new Handler()); |
69 new Class<?>[] { I.class }, new Handler()); |
69 ObjectOutputStream oout = new ObjectOutputStream( |
70 ObjectOutputStream oout = new ObjectOutputStream( |
70 new FileOutputStream("tmp.ser")); |
71 new FileOutputStream("tmp.ser")); |
71 oout.writeObject(new A(proxy)); |
72 oout.writeObject(new A(proxy)); |
72 oout.reset(); |
73 oout.reset(); |
73 oout.writeObject(new B(proxy)); |
74 oout.writeObject(new B(proxy)); |