author | rriggs |
Fri, 11 Oct 2019 13:11:56 -0400 | |
changeset 58565 | baa5969ecf34 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
30911
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
1 |
/* |
58565
baa5969ecf34
8231427: Warning cleanup in tests of java.io.Serializable
rriggs
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
30911
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
4 |
* |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
8 |
* |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
13 |
* accompanied this code). |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
14 |
* |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
18 |
* |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
21 |
* questions. |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
22 |
*/ |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
23 |
|
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
24 |
package $package; |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
25 |
|
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
26 |
import java.io.IOException; |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
27 |
import java.io.Serializable; |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
28 |
import failureAtomicity.SerialRef; |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
29 |
|
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
30 |
public class Bar extends Foo implements Serializable { |
58565
baa5969ecf34
8231427: Warning cleanup in tests of java.io.Serializable
rriggs
parents:
47216
diff
changeset
|
31 |
private static final long serialVersionUID = -0L; |
30911
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
32 |
|
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
33 |
public final long barPrim; |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
34 |
public final String barRef; |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
35 |
|
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
36 |
public final SerialRef ref; // So we can retrieve a reference to check |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
37 |
public $zebra_type zebraBar; // ordered alphabetically, must be last |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
38 |
|
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
39 |
public Bar(int fooPrim, String fooRef, $foo_zebra_type fooZebra, |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
40 |
long barPrim, String barRef, $zebra_type zebra) { |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
41 |
super(fooPrim, fooRef, fooZebra); |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
42 |
this.barPrim = barPrim; |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
43 |
this.barRef = barRef; |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
44 |
this.zebraBar = zebra; |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
45 |
this.ref = new SerialRef(this); |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
46 |
} |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
47 |
|
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
48 |
@Override |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
49 |
public String toString() { |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
50 |
return new StringBuilder() |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
51 |
.append("$package.Bar[") |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
52 |
.append("barPrim:").append(barPrim) |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
53 |
.append(", barRef:").append(barRef) |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
54 |
.append(", zebraBar:").append(zebraBar) |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
55 |
.append(", " + super.toString()) |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
56 |
.toString(); |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
57 |
} |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
58 |
|
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
59 |
//$has_readObject private void readObject(java.io.ObjectInputStream in) |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
60 |
//$has_readObject throws IOException, ClassNotFoundException |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
61 |
//$has_readObject { |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
62 |
//$has_readObject in.defaultReadObject(); |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
63 |
//$has_readObject } |
99e027461f4a
8071474: Better failure atomicity for default read object
chegar
parents:
diff
changeset
|
64 |
} |