1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/javac/AccessMethods/AccessMethodsLHS.java Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,706 @@ 1.4 +/* 1.5 + * Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + */ 1.26 + 1.27 +/* 1.28 + * @test 1.29 + * @bug 4102566 1.30 + * @summary Test access methods for assignment targets. 1.31 + * @author William Maddox (maddox) 1.32 + * 1.33 + * @compile AccessMethodsLHS.java 1.34 + * @run main AccessMethodsLHS 1.35 + */ 1.36 + 1.37 +public class AccessMethodsLHS { 1.38 + 1.39 + static void fail(String msg) throws Exception { 1.40 + throw new Exception("FAIL: " + msg); 1.41 + } 1.42 + 1.43 + static int arg = 123456; 1.44 + 1.45 + private int i; 1.46 + private double d; 1.47 + 1.48 + private void m(int x) throws Exception { 1.49 + System.out.println("called AccessMethodsLHS.m"); 1.50 + if (x != 123456) 1.51 + AccessMethodsLHS.fail("bad argument"); 1.52 + } 1.53 + 1.54 + public static class Bar { 1.55 + private int i; 1.56 + private double d; 1.57 + private String s; 1.58 + 1.59 + private void m(int x) throws Exception { 1.60 + System.out.println("called AccessMethodsLHS.Bar.m"); 1.61 + if (x != 123456) 1.62 + AccessMethodsLHS.fail("bad argument"); 1.63 + } 1.64 + 1.65 + // Static members are permitted in a static inner class. 1.66 + 1.67 + static private int si; 1.68 + static private double sd; 1.69 + static private String ss; 1.70 + 1.71 + static private void sm(int x) throws Exception { 1.72 + System.out.println("called AccessMethodsLHS.Bar.sm"); 1.73 + if (x != 123456) 1.74 + AccessMethodsLHS.fail("bad argument"); 1.75 + } 1.76 + } 1.77 + 1.78 + public static class Baz { 1.79 + private int i; 1.80 + private double d; 1.81 + private String s; 1.82 + 1.83 + private void m(int x) throws Exception { 1.84 + System.out.println("called Baz.m"); 1.85 + if (x != 123456) 1.86 + AccessMethodsLHS.fail("bad argument"); 1.87 + } 1.88 + 1.89 + // Compiler rejects static members here correctly. 1.90 + 1.91 + // static private int si; 1.92 + // static private double sd; 1.93 + // static private String ss; 1.94 + } 1.95 + 1.96 + public class Quux { 1.97 + void DoIt () throws Exception { 1.98 + m(arg); 1.99 + i = 1; 1.100 + d = 1.0; 1.101 + i += 5; 1.102 + i--; 1.103 + } 1.104 + void DoMore(AccessMethodsLHS f) throws Exception { 1.105 + f.m(arg); 1.106 + } 1.107 + } 1.108 + 1.109 + public static class Quem { 1.110 + void DoIt () { 1.111 + // Illegal static refs to non-static vars 1.112 + // i = 1; 1.113 + // d = 1.0; 1.114 + // i += 5; 1.115 + // i--; 1.116 + } 1.117 + } 1.118 + 1.119 + static int effects = 0; 1.120 + 1.121 + static Bar iBar(Bar x) { effects++; return x; } 1.122 + 1.123 + static Baz iBaz(Baz x) { effects++; return x; } 1.124 + 1.125 + static void checkEffects(int i) throws Exception { 1.126 + if (effects != 1) { 1.127 + AccessMethodsLHS.fail("incorrect side-effect behavior (" + effects + "): " + i); 1.128 + } 1.129 + effects = 0; 1.130 + } 1.131 + 1.132 + static public void main(String args[]) throws Exception { 1.133 + 1.134 + Bar b = new Bar(); 1.135 + Baz c = new Baz(); 1.136 + 1.137 + System.out.println("testing assignment"); 1.138 + 1.139 + AccessMethodsLHS f = new AccessMethodsLHS(); 1.140 + 1.141 + Quux q1 = f.new Quux(); 1.142 + q1.DoIt(); 1.143 + q1.DoMore(f); 1.144 + 1.145 + Quem q2 = new Quem(); 1.146 + q2.DoIt(); 1.147 + 1.148 + // *** Static class, Non-static members *** 1.149 + 1.150 + b.m(arg); 1.151 + 1.152 + // Integer (1 word) 1.153 + 1.154 + b.i = 5; 1.155 + System.out.println(b.i); 1.156 + if (b.i != 5) 1.157 + AccessMethodsLHS.fail("simple assignment"); 1.158 + System.out.println(b.i); 1.159 + 1.160 + 1.161 + if ((b.i += 10) != 15) 1.162 + AccessMethodsLHS.fail("add-assign result"); 1.163 + System.out.println(b.i); 1.164 + 1.165 + if (b.i != 15) 1.166 + AccessMethodsLHS.fail("add-assign effect"); 1.167 + System.out.println(b.i); 1.168 + 1.169 + b.s = "foo"; 1.170 + if (!(b.s += "bar").equals("foobar")) 1.171 + AccessMethodsLHS.fail("concat-assign result"); 1.172 + System.out.println(b.s); 1.173 + 1.174 + if (!b.s.equals("foobar")) 1.175 + AccessMethodsLHS.fail("concat-assign effect"); 1.176 + System.out.println(b.s); 1.177 + 1.178 + b.s = "foo"; 1.179 + b.s += "bar"; 1.180 + if (!b.s.equals("foobar")) 1.181 + AccessMethodsLHS.fail("concat-assign effect (novalue)"); 1.182 + System.out.println(b.s); 1.183 + 1.184 + b.i = 0; 1.185 + b.i++; 1.186 + if (b.i != 1) 1.187 + AccessMethodsLHS.fail("post-increment effect"); 1.188 + System.out.println(b.i); 1.189 + 1.190 + b.i = 5; 1.191 + if (b.i++ != 5) 1.192 + AccessMethodsLHS.fail("post-increment result"); 1.193 + if (b.i != 6) 1.194 + AccessMethodsLHS.fail("post-increment effect (embedded)"); 1.195 + System.out.println(b.i); 1.196 + 1.197 + b.i = 1; 1.198 + --b.i; 1.199 + if (b.i != 0) 1.200 + AccessMethodsLHS.fail("pre-decrement effect"); 1.201 + 1.202 + b.i = 5; 1.203 + if (--b.i != 4) 1.204 + AccessMethodsLHS.fail("pre-decrement result"); 1.205 + if (b.i != 4) 1.206 + AccessMethodsLHS.fail("pre-decrement effect (embedded)"); 1.207 + System.out.println(b.i); 1.208 + 1.209 + // Double (2 word) 1.210 + 1.211 + b.d = 5.0; 1.212 + System.out.println(b.d); 1.213 + if (b.d != 5.0) 1.214 + AccessMethodsLHS.fail("simple assignment"); 1.215 + System.out.println(b.d); 1.216 + 1.217 + if ((b.d += 10) != 15.0) 1.218 + AccessMethodsLHS.fail("add-assign result"); 1.219 + System.out.println(b.d); 1.220 + 1.221 + if (b.d != 15.0) 1.222 + AccessMethodsLHS.fail("add-assign effect"); 1.223 + System.out.println(b.d); 1.224 + 1.225 + b.d = 0.0; 1.226 + b.d++; 1.227 + if (b.d != 1.0) 1.228 + AccessMethodsLHS.fail("post-increment effect"); 1.229 + System.out.println(b.d); 1.230 + 1.231 + b.d = 5.0; 1.232 + if (b.d++ != 5.0) 1.233 + AccessMethodsLHS.fail("post-increment result"); 1.234 + if (b.d != 6.0) 1.235 + AccessMethodsLHS.fail("post-increment effect (embedded)"); 1.236 + System.out.println(b.d); 1.237 + 1.238 + b.d = 1.0; 1.239 + --b.d; 1.240 + if (b.d != 0.0) 1.241 + AccessMethodsLHS.fail("pre-decrement effect"); 1.242 + 1.243 + b.d = 5.0; 1.244 + if (--b.d != 4.0) 1.245 + AccessMethodsLHS.fail("pre-decrement result"); 1.246 + if (b.d != 4.0) 1.247 + AccessMethodsLHS.fail("pre-decrement effect (embedded)"); 1.248 + System.out.println(b.d); 1.249 + 1.250 + // Integer (1 word) with side-effects in object reference 1.251 + 1.252 + iBar(b).i = 5; 1.253 + checkEffects(1); 1.254 + System.out.println(b.i); 1.255 + if (b.i != 5) 1.256 + AccessMethodsLHS.fail("simple assignment"); 1.257 + 1.258 + System.out.println(b.i); 1.259 + 1.260 + if ((iBar(b).i += 10) != 15) 1.261 + AccessMethodsLHS.fail("add-assign result"); 1.262 + checkEffects(2); 1.263 + System.out.println(b.i); 1.264 + 1.265 + if (b.i != 15) 1.266 + AccessMethodsLHS.fail("add-assign effect"); 1.267 + System.out.println(b.i); 1.268 + 1.269 + b.i = 0; 1.270 + iBar(b).i++; 1.271 + checkEffects(3); 1.272 + if (b.i != 1) 1.273 + AccessMethodsLHS.fail("post-increment effect"); 1.274 + System.out.println(b.i); 1.275 + 1.276 + b.i = 5; 1.277 + if (iBar(b).i++ != 5) 1.278 + AccessMethodsLHS.fail("post-increment result"); 1.279 + checkEffects(4); 1.280 + if (b.i != 6) 1.281 + AccessMethodsLHS.fail("post-increment effect (embedded)"); 1.282 + System.out.println(b.i); 1.283 + 1.284 + b.i = 1; 1.285 + --iBar(b).i; 1.286 + checkEffects(5); 1.287 + if (b.i != 0) 1.288 + AccessMethodsLHS.fail("pre-decrement effect"); 1.289 + 1.290 + b.i = 5; 1.291 + if (--iBar(b).i != 4) 1.292 + AccessMethodsLHS.fail("pre-decrement result"); 1.293 + checkEffects(6); 1.294 + if (b.i != 4) 1.295 + AccessMethodsLHS.fail("pre-decrement effect (embedded)"); 1.296 + System.out.println(b.i); 1.297 + 1.298 + 1.299 + // *** Static class, Static members *** 1.300 + 1.301 + Bar.sm(arg); 1.302 + 1.303 + // Integer (1 word) 1.304 + 1.305 + Bar.si = 5; 1.306 + System.out.println(Bar.si); 1.307 + if (Bar.si != 5) 1.308 + AccessMethodsLHS.fail("simple assignment"); 1.309 + System.out.println(Bar.si); 1.310 + 1.311 + if ((Bar.si += 10) != 15) 1.312 + AccessMethodsLHS.fail("add-assign result"); 1.313 + System.out.println(Bar.si); 1.314 + 1.315 + if (Bar.si != 15) 1.316 + AccessMethodsLHS.fail("add-assign effect"); 1.317 + System.out.println(Bar.si); 1.318 + 1.319 + Bar.ss = "foo"; 1.320 + if (!(Bar.ss += "bar").equals("foobar")) 1.321 + AccessMethodsLHS.fail("concat-assign result"); 1.322 + System.out.println(Bar.ss); 1.323 + 1.324 + if (!Bar.ss.equals("foobar")) 1.325 + AccessMethodsLHS.fail("concat-assign effect"); 1.326 + System.out.println(Bar.ss); 1.327 + 1.328 + Bar.ss = "foo"; 1.329 + Bar.ss += "bar"; 1.330 + if (!Bar.ss.equals("foobar")) 1.331 + AccessMethodsLHS.fail("concat-assign effect (novalue)"); 1.332 + System.out.println(Bar.ss); 1.333 + 1.334 + Bar.si = 0; 1.335 + Bar.si++; 1.336 + if (Bar.si != 1) 1.337 + AccessMethodsLHS.fail("post-increment effect"); 1.338 + System.out.println(Bar.si); 1.339 + 1.340 + Bar.si = 5; 1.341 + if (Bar.si++ != 5) 1.342 + AccessMethodsLHS.fail("post-increment result"); 1.343 + if (Bar.si != 6) 1.344 + AccessMethodsLHS.fail("post-increment effect (embedded)"); 1.345 + System.out.println(Bar.si); 1.346 + 1.347 + Bar.si = 1; 1.348 + --Bar.si; 1.349 + if (Bar.si != 0) 1.350 + AccessMethodsLHS.fail("pre-decrement effect"); 1.351 + 1.352 + Bar.si = 5; 1.353 + if (--Bar.si != 4) 1.354 + AccessMethodsLHS.fail("pre-decrement result"); 1.355 + if (Bar.si != 4) 1.356 + AccessMethodsLHS.fail("pre-decrement effect (embedded)"); 1.357 + System.out.println(Bar.si); 1.358 + 1.359 + // Double (2 word) 1.360 + 1.361 + Bar.sd = 5.0; 1.362 + System.out.println(Bar.sd); 1.363 + if (Bar.sd != 5.0) 1.364 + AccessMethodsLHS.fail("simple assignment"); 1.365 + System.out.println(Bar.sd); 1.366 + 1.367 + if ((Bar.sd += 10) != 15.0) 1.368 + AccessMethodsLHS.fail("add-assign result"); 1.369 + System.out.println(Bar.sd); 1.370 + 1.371 + if (Bar.sd != 15.0) 1.372 + AccessMethodsLHS.fail("add-assign effect"); 1.373 + System.out.println(Bar.sd); 1.374 + 1.375 + Bar.sd = 0.0; 1.376 + Bar.sd++; 1.377 + if (Bar.sd != 1.0) 1.378 + AccessMethodsLHS.fail("post-increment effect"); 1.379 + System.out.println(Bar.sd); 1.380 + 1.381 + Bar.sd = 5.0; 1.382 + if (Bar.sd++ != 5.0) 1.383 + AccessMethodsLHS.fail("post-increment result"); 1.384 + if (Bar.sd != 6.0) 1.385 + AccessMethodsLHS.fail("post-increment effect (embedded)"); 1.386 + System.out.println(Bar.sd); 1.387 + 1.388 + Bar.sd = 1.0; 1.389 + --Bar.sd; 1.390 + if (Bar.sd != 0.0) 1.391 + AccessMethodsLHS.fail("pre-decrement effect"); 1.392 + 1.393 + Bar.sd = 5.0; 1.394 + if (--Bar.sd != 4.0) 1.395 + AccessMethodsLHS.fail("pre-decrement result"); 1.396 + if (Bar.sd != 4.0) 1.397 + AccessMethodsLHS.fail("pre-decrement effect (embedded)"); 1.398 + System.out.println(Bar.sd); 1.399 + 1.400 + 1.401 + // *** Static class, Static members (invoked via object reference) *** 1.402 + 1.403 + b.sm(arg); 1.404 + 1.405 + iBar(b).sm(arg); 1.406 + checkEffects(101); 1.407 + 1.408 + // Integer (1 word) 1.409 + 1.410 + b.si = 5; 1.411 + System.out.println(b.si); 1.412 + if (b.si != 5) 1.413 + AccessMethodsLHS.fail("simple assignment"); 1.414 + System.out.println(b.si); 1.415 + 1.416 + if ((b.si += 10) != 15) 1.417 + AccessMethodsLHS.fail("add-assign result"); 1.418 + System.out.println(b.si); 1.419 + 1.420 + if (b.si != 15) 1.421 + AccessMethodsLHS.fail("add-assign effect"); 1.422 + System.out.println(b.si); 1.423 + 1.424 + b.ss = "foo"; 1.425 + if (!(b.ss += "bar").equals("foobar")) 1.426 + AccessMethodsLHS.fail("concat-assign result"); 1.427 + System.out.println(b.ss); 1.428 + 1.429 + if (!b.ss.equals("foobar")) 1.430 + AccessMethodsLHS.fail("concat-assign effect"); 1.431 + System.out.println(b.ss); 1.432 + 1.433 + b.ss = "foo"; 1.434 + b.ss += "bar"; 1.435 + if (!b.ss.equals("foobar")) 1.436 + AccessMethodsLHS.fail("concat-assign effect (novalue)"); 1.437 + System.out.println(b.ss); 1.438 + 1.439 + b.si = 0; 1.440 + b.si++; 1.441 + if (b.si != 1) 1.442 + AccessMethodsLHS.fail("post-increment effect"); 1.443 + System.out.println(b.si); 1.444 + 1.445 + b.si = 5; 1.446 + if (b.si++ != 5) 1.447 + AccessMethodsLHS.fail("post-increment result"); 1.448 + if (b.si != 6) 1.449 + AccessMethodsLHS.fail("post-increment effect (embedded)"); 1.450 + System.out.println(b.si); 1.451 + 1.452 + b.si = 1; 1.453 + --b.si; 1.454 + if (b.si != 0) 1.455 + AccessMethodsLHS.fail("pre-decrement effect"); 1.456 + 1.457 + b.si = 5; 1.458 + if (--b.si != 4) 1.459 + AccessMethodsLHS.fail("pre-decrement result"); 1.460 + if (b.si != 4) 1.461 + AccessMethodsLHS.fail("pre-decrement effect (embedded)"); 1.462 + System.out.println(b.si); 1.463 + 1.464 + // Double (2 word) 1.465 + 1.466 + b.sd = 5.0; 1.467 + System.out.println(b.sd); 1.468 + if (b.sd != 5.0) 1.469 + AccessMethodsLHS.fail("simple assignment"); 1.470 + System.out.println(b.sd); 1.471 + 1.472 + if ((b.sd += 10) != 15.0) 1.473 + AccessMethodsLHS.fail("add-assign result"); 1.474 + System.out.println(b.sd); 1.475 + 1.476 + if (b.sd != 15.0) 1.477 + AccessMethodsLHS.fail("add-assign effect"); 1.478 + System.out.println(b.sd); 1.479 + 1.480 + b.sd = 0.0; 1.481 + b.sd++; 1.482 + if (b.sd != 1.0) 1.483 + AccessMethodsLHS.fail("post-increment effect"); 1.484 + System.out.println(b.sd); 1.485 + 1.486 + b.sd = 5.0; 1.487 + if (b.sd++ != 5.0) 1.488 + AccessMethodsLHS.fail("post-increment result"); 1.489 + if (b.sd != 6.0) 1.490 + AccessMethodsLHS.fail("post-increment effect (embedded)"); 1.491 + System.out.println(b.sd); 1.492 + 1.493 + b.sd = 1.0; 1.494 + --b.sd; 1.495 + if (b.sd != 0.0) 1.496 + AccessMethodsLHS.fail("pre-decrement effect"); 1.497 + 1.498 + b.sd = 5.0; 1.499 + if (--b.sd != 4.0) 1.500 + AccessMethodsLHS.fail("pre-decrement result"); 1.501 + if (b.sd != 4.0) 1.502 + AccessMethodsLHS.fail("pre-decrement effect (embedded)"); 1.503 + System.out.println(b.sd); 1.504 + 1.505 + // Integer (1 word) with side-effects in object reference 1.506 + 1.507 + iBar(b).si = 5; 1.508 + checkEffects(7); 1.509 + System.out.println(b.si); 1.510 + if (b.si != 5) 1.511 + AccessMethodsLHS.fail("simple assignment"); 1.512 + System.out.println(b.si); 1.513 + 1.514 + if ((iBar(b).si += 10) != 15) 1.515 + AccessMethodsLHS.fail("add-assign result"); 1.516 + checkEffects(8); 1.517 + System.out.println(b.si); 1.518 + 1.519 + if (b.si != 15) 1.520 + AccessMethodsLHS.fail("add-assign effect"); 1.521 + System.out.println(b.si); 1.522 + 1.523 + iBar(b).si = 0; 1.524 + checkEffects(9); 1.525 + iBar(b).si++; 1.526 + checkEffects(10); 1.527 + if (b.si != 1) 1.528 + AccessMethodsLHS.fail("post-increment effect"); 1.529 + System.out.println(b.si); 1.530 + 1.531 + b.si = 5; 1.532 + if (iBar(b).si++ != 5) 1.533 + AccessMethodsLHS.fail("post-increment result"); 1.534 + checkEffects(11); 1.535 + if (b.si != 6) 1.536 + AccessMethodsLHS.fail("post-increment effect (embedded)"); 1.537 + System.out.println(b.si); 1.538 + 1.539 + b.si = 1; 1.540 + --iBar(b).si; 1.541 + checkEffects(12); 1.542 + if (b.si != 0) 1.543 + AccessMethodsLHS.fail("pre-decrement effect"); 1.544 + 1.545 + b.si = 5; 1.546 + if (--iBar(b).si != 4) 1.547 + AccessMethodsLHS.fail("pre-decrement result"); 1.548 + checkEffects(13); 1.549 + if (b.si != 4) 1.550 + AccessMethodsLHS.fail("pre-decrement effect (embedded)"); 1.551 + System.out.println(b.si); 1.552 + 1.553 + 1.554 + // *** Non-static class, Non-static members *** 1.555 + 1.556 + c.m(arg); 1.557 + 1.558 + iBaz(c).m(arg); 1.559 + checkEffects(102); 1.560 + 1.561 + // Integer (1 word) 1.562 + 1.563 + c.i = 5; 1.564 + System.out.println(c.i); 1.565 + if (c.i != 5) 1.566 + AccessMethodsLHS.fail("simple assignment"); 1.567 + System.out.println(c.i); 1.568 + 1.569 + if ((c.i += 10) != 15) 1.570 + AccessMethodsLHS.fail("add-assign result"); 1.571 + System.out.println(c.i); 1.572 + 1.573 + if (c.i != 15) 1.574 + AccessMethodsLHS.fail("add-assign effect"); 1.575 + System.out.println(c.i); 1.576 + 1.577 + c.s = "foo"; 1.578 + if (!(c.s += "bar").equals("foobar")) 1.579 + AccessMethodsLHS.fail("concat-assign result"); 1.580 + System.out.println(c.s); 1.581 + 1.582 + if (!c.s.equals("foobar")) 1.583 + AccessMethodsLHS.fail("concat-assign effect"); 1.584 + System.out.println(c.s); 1.585 + 1.586 + c.s = "foo"; 1.587 + c.s += "bar"; 1.588 + if (!c.s.equals("foobar")) 1.589 + AccessMethodsLHS.fail("concat-assign effect (novalue)"); 1.590 + System.out.println(c.s); 1.591 + 1.592 + c.i = 0; 1.593 + c.i++; 1.594 + if (c.i != 1) 1.595 + AccessMethodsLHS.fail("post-increment effect"); 1.596 + System.out.println(c.i); 1.597 + 1.598 + c.i = 5; 1.599 + if (c.i++ != 5) 1.600 + AccessMethodsLHS.fail("post-increment result"); 1.601 + if (c.i != 6) 1.602 + AccessMethodsLHS.fail("post-increment effect (embedded)"); 1.603 + System.out.println(c.i); 1.604 + 1.605 + c.i = 1; 1.606 + --c.i; 1.607 + if (c.i != 0) 1.608 + AccessMethodsLHS.fail("pre-decrement effect"); 1.609 + 1.610 + c.i = 5; 1.611 + if (--c.i != 4) 1.612 + AccessMethodsLHS.fail("pre-decrement result"); 1.613 + if (c.i != 4) 1.614 + AccessMethodsLHS.fail("pre-decrement effect (embedded)"); 1.615 + System.out.println(c.i); 1.616 + 1.617 + // Double (2 word) 1.618 + 1.619 + c.d = 5.0; 1.620 + System.out.println(c.d); 1.621 + if (c.d != 5.0) 1.622 + AccessMethodsLHS.fail("simple assignment"); 1.623 + System.out.println(c.d); 1.624 + 1.625 + if ((c.d += 10) != 15.0) 1.626 + AccessMethodsLHS.fail("add-assign result"); 1.627 + System.out.println(c.d); 1.628 + 1.629 + if (c.d != 15.0) 1.630 + AccessMethodsLHS.fail("add-assign effect"); 1.631 + System.out.println(c.d); 1.632 + 1.633 + c.d = 0.0; 1.634 + c.d++; 1.635 + if (c.d != 1.0) 1.636 + AccessMethodsLHS.fail("post-increment effect"); 1.637 + System.out.println(c.d); 1.638 + 1.639 + c.d = 5.0; 1.640 + if (c.d++ != 5.0) 1.641 + AccessMethodsLHS.fail("post-increment result"); 1.642 + if (c.d != 6.0) 1.643 + AccessMethodsLHS.fail("post-increment effect (embedded)"); 1.644 + System.out.println(c.d); 1.645 + 1.646 + c.d = 1.0; 1.647 + --c.d; 1.648 + if (c.d != 0.0) 1.649 + AccessMethodsLHS.fail("pre-decrement effect"); 1.650 + 1.651 + c.d = 5.0; 1.652 + if (--c.d != 4.0) 1.653 + AccessMethodsLHS.fail("pre-decrement result"); 1.654 + if (c.d != 4.0) 1.655 + AccessMethodsLHS.fail("pre-decrement effect (embedded)"); 1.656 + System.out.println(c.d); 1.657 + 1.658 + // Double (2 word) with side-effects in object reference 1.659 + 1.660 + iBaz(c).d = 5.0; 1.661 + checkEffects(14); 1.662 + System.out.println(c.d); 1.663 + if (c.d != 5.0) 1.664 + AccessMethodsLHS.fail("simple assignment"); 1.665 + System.out.println(c.d); 1.666 + 1.667 + if ((iBaz(c).d += 10) != 15.0) 1.668 + AccessMethodsLHS.fail("add-assign result"); 1.669 + checkEffects(15); 1.670 + System.out.println(c.d); 1.671 + 1.672 + if (c.d != 15.0) 1.673 + AccessMethodsLHS.fail("add-assign effect"); 1.674 + System.out.println(c.d); 1.675 + 1.676 + c.d = 0.0; 1.677 + iBaz(c).d++; 1.678 + checkEffects(16); 1.679 + if (c.d != 1.0) 1.680 + AccessMethodsLHS.fail("post-increment effect"); 1.681 + System.out.println(c.d); 1.682 + 1.683 + c.d = 5.0; 1.684 + if (iBaz(c).d++ != 5.0) 1.685 + AccessMethodsLHS.fail("post-increment result"); 1.686 + checkEffects(17); 1.687 + if (c.d != 6.0) 1.688 + AccessMethodsLHS.fail("post-increment effect (embedded)"); 1.689 + System.out.println(c.d); 1.690 + 1.691 + c.d = 1.0; 1.692 + --iBaz(c).d; 1.693 + checkEffects(18); 1.694 + if (c.d != 0.0) 1.695 + AccessMethodsLHS.fail("pre-decrement effect"); 1.696 + 1.697 + c.d = 5.0; 1.698 + if (--iBaz(c).d != 4.0) 1.699 + AccessMethodsLHS.fail("pre-decrement result"); 1.700 + checkEffects(19); 1.701 + if (c.d != 4.0) 1.702 + AccessMethodsLHS.fail("pre-decrement effect (embedded)"); 1.703 + System.out.println(c.d); 1.704 + 1.705 + // All done. 1.706 + 1.707 + System.out.println("done"); 1.708 + } 1.709 +}