Upcoming SlideShare
×

# Semantics

593 views

Published on

Published in: Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
593
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
6
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Semantics

6. 6. class FinalTest { public static FinalTest ft; public static int [] x = new int[1]; static void foo() { public final int a; int [] myX = FinalTest.x; public final int [] b,c,d; int j = myX[0]; public final Point p; FinalTest f1 = ft; public final int [][] e; if (f1 == null) return; // Guaranteed to see value public FinalTest(int i) { // set in constructor? int i1 = f1.a; // yes a = i; int i2 = f1.b[0]; // yes int i3 = f1.c[0]; // yes int [] tmp = new int[1]; int i4 = f1.d[0]; // yes tmp[0] = i; int i5 = myX[0]; // no b = tmp; int i6 = f1.p.x; // yes int i7 = f1.e[0][0]; // yes c = new int[1]; // use j, i1 ... i7 c[0] = i; } } FinalTest.x[0] = i; d = FinalTest.x; // Thread 1: p = new Point(); // FinalTest.ft = new FinalTest(42); p.x = i; // Thread 2; e = new int[1][1]; // FinalTest.foo(); e[0][0] = i; } Figure 3: Subtle points of the revised semantics of ﬁnal 6