01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tctest.transparency;
05:
06: public class SubClassC extends SubClassB {
07:
08: int j = 9;
09:
10: public synchronized void method1() {
11: i = 20;
12: super .method1();
13: }
14:
15: public SubClassB getCopy() {
16: return super .getCopy();
17: }
18:
19: public Object clone() {
20: try {
21: // This is insane, but this is test code so ...
22: SubClassC c = (SubClassC) super .clone();
23: c.i++;
24: c.j--;
25: return c;
26: } catch (CloneNotSupportedException e) {
27: throw new RuntimeException(e);
28: }
29: }
30:
31: public synchronized void checkedUnCheckedSetsAndGets() {
32: //this should be unchecked
33: int newj = j + 100;
34: int newi = i + 1000;
35: j = newj;
36: i = newi;
37:
38: // This should be checked
39: SubClassD d = new SubClassD();
40: d.d = d.d++;
41: }
42:
43: public String toString() {
44: return "SubClassC::" + super .toString();
45: }
46:
47: public boolean equals(Object o) {
48: if (this == o)
49: return true;
50: if (o instanceof SubClassC) {
51: return j == ((SubClassC) o).j && super .equals(o);
52: }
53: return false;
54: }
55: }
|