langtools/test/tools/javac/AccessMethods/AccessMethodsLHS.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 10 06bc494ca11e
child 5520 86e4b9a9da40
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * Copyright 1998 Sun Microsystems, Inc.  All Rights Reserved.
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
 * have any questions.
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
 * @test
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
 * @bug 4102566
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
 * @summary Test access methods for assignment targets.
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
 * @author William Maddox (maddox)
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
 * @compile AccessMethodsLHS.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
 * @run main AccessMethodsLHS
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
public class AccessMethodsLHS {
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
    static void fail(String msg) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
        throw new Exception("FAIL: " + msg);
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
    static int arg = 123456;
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
    private int i;
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
    private double d;
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
    private void m(int x) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
        System.out.println("called AccessMethodsLHS.m");
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
        if (x != 123456)
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
            AccessMethodsLHS.fail("bad argument");
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
    public static class Bar {
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
        private int i;
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
        private double d;
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
        private String s;
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
        private void m(int x) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
            System.out.println("called AccessMethodsLHS.Bar.m");
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
            if (x != 123456)
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
                AccessMethodsLHS.fail("bad argument");
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
        // Static members are permitted in a static inner class.
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
        static private int si;
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
        static private double sd;
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
        static private String ss;
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
        static private void sm(int x) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
            System.out.println("called AccessMethodsLHS.Bar.sm");
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
            if (x != 123456)
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
                AccessMethodsLHS.fail("bad argument");
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    public static class Baz {
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
        private int i;
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
        private double d;
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
        private String s;
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
        private void m(int x) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
            System.out.println("called Baz.m");
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
            if (x != 123456)
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
                AccessMethodsLHS.fail("bad argument");
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
        // Compiler rejects static members here correctly.
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
        // static private int si;
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
        // static private double sd;
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
        // static private String ss;
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    public class Quux {
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
        void DoIt () throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
            m(arg);
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
            i = 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
            d = 1.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
            i += 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
            i--;
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
        void DoMore(AccessMethodsLHS f) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
            f.m(arg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
    public static class Quem {
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
        void DoIt () {
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
            // Illegal static refs to non-static vars
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
            // i = 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
            // d = 1.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
            // i += 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
            // i--;
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
    static int effects = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
    static Bar iBar(Bar x) { effects++; return x; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
    static Baz iBaz(Baz x) { effects++; return x; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
    static void checkEffects(int i) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
        if (effects != 1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
            AccessMethodsLHS.fail("incorrect side-effect behavior (" + effects + "): " + i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
        effects = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
    static public void main(String args[]) throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
        Bar b = new Bar();
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
        Baz c = new Baz();
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
        System.out.println("testing assignment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
        AccessMethodsLHS f = new AccessMethodsLHS();
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
        Quux q1 = f.new Quux();
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
        q1.DoIt();
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
        q1.DoMore(f);
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
        Quem q2 = new Quem();
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
        q2.DoIt();
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
        // *** Static class, Non-static members ***
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
        b.m(arg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
        // Integer (1 word)
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
        b.i = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
        if (b.i != 5)
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
            AccessMethodsLHS.fail("simple assignment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
        if ((b.i += 10) != 15)
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
            AccessMethodsLHS.fail("add-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
        if (b.i != 15)
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
            AccessMethodsLHS.fail("add-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
        b.s = "foo";
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
        if (!(b.s += "bar").equals("foobar"))
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
            AccessMethodsLHS.fail("concat-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
        System.out.println(b.s);
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
        if (!b.s.equals("foobar"))
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
            AccessMethodsLHS.fail("concat-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
        System.out.println(b.s);
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
        b.s = "foo";
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
        b.s += "bar";
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
        if (!b.s.equals("foobar"))
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
            AccessMethodsLHS.fail("concat-assign effect (novalue)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
        System.out.println(b.s);
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
        b.i = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
        b.i++;
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
        if (b.i != 1)
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
            AccessMethodsLHS.fail("post-increment effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
        b.i = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
        if (b.i++ != 5)
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
            AccessMethodsLHS.fail("post-increment result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
        if (b.i != 6)
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
            AccessMethodsLHS.fail("post-increment effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
        b.i = 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
        --b.i;
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
        if (b.i != 0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
            AccessMethodsLHS.fail("pre-decrement effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
        b.i = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
        if (--b.i != 4)
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
            AccessMethodsLHS.fail("pre-decrement result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
        if (b.i != 4)
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
            AccessMethodsLHS.fail("pre-decrement effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
        // Double (2 word)
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
        b.d = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
        System.out.println(b.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
        if (b.d != 5.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
            AccessMethodsLHS.fail("simple assignment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
        System.out.println(b.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
        if ((b.d += 10) != 15.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
            AccessMethodsLHS.fail("add-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
        System.out.println(b.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
        if (b.d != 15.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
            AccessMethodsLHS.fail("add-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
        System.out.println(b.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
        b.d = 0.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
        b.d++;
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
        if (b.d != 1.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
            AccessMethodsLHS.fail("post-increment effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
        System.out.println(b.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
        b.d = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
        if (b.d++ != 5.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
            AccessMethodsLHS.fail("post-increment result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
        if (b.d != 6.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
            AccessMethodsLHS.fail("post-increment effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
        System.out.println(b.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
        b.d = 1.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
        --b.d;
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
        if (b.d != 0.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
            AccessMethodsLHS.fail("pre-decrement effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
        b.d = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
        if (--b.d != 4.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
            AccessMethodsLHS.fail("pre-decrement result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
        if (b.d != 4.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
            AccessMethodsLHS.fail("pre-decrement effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
        System.out.println(b.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
        // Integer (1 word) with side-effects in object reference
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
        iBar(b).i = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
        checkEffects(1);
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
        if (b.i != 5)
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
            AccessMethodsLHS.fail("simple assignment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
        if ((iBar(b).i += 10) != 15)
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
            AccessMethodsLHS.fail("add-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
        checkEffects(2);
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
        if (b.i != 15)
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
            AccessMethodsLHS.fail("add-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
        b.i = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
        iBar(b).i++;
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
        checkEffects(3);
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
        if (b.i != 1)
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
            AccessMethodsLHS.fail("post-increment effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
        b.i = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
        if (iBar(b).i++ != 5)
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
            AccessMethodsLHS.fail("post-increment result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
        checkEffects(4);
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
        if (b.i != 6)
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
            AccessMethodsLHS.fail("post-increment effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
        b.i = 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
        --iBar(b).i;
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
        checkEffects(5);
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
        if (b.i != 0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
            AccessMethodsLHS.fail("pre-decrement effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
        b.i = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
        if (--iBar(b).i != 4)
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
            AccessMethodsLHS.fail("pre-decrement result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
        checkEffects(6);
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
        if (b.i != 4)
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
            AccessMethodsLHS.fail("pre-decrement effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
        System.out.println(b.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
        // *** Static class, Static members ***
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
        Bar.sm(arg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
        // Integer (1 word)
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
        Bar.si = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
        System.out.println(Bar.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
        if (Bar.si != 5)
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
            AccessMethodsLHS.fail("simple assignment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
        System.out.println(Bar.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
        if ((Bar.si += 10) != 15)
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
            AccessMethodsLHS.fail("add-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
        System.out.println(Bar.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
        if (Bar.si != 15)
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
            AccessMethodsLHS.fail("add-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
        System.out.println(Bar.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
        Bar.ss = "foo";
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
        if (!(Bar.ss += "bar").equals("foobar"))
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
            AccessMethodsLHS.fail("concat-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
        System.out.println(Bar.ss);
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
        if (!Bar.ss.equals("foobar"))
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
            AccessMethodsLHS.fail("concat-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
        System.out.println(Bar.ss);
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
        Bar.ss = "foo";
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
        Bar.ss += "bar";
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
        if (!Bar.ss.equals("foobar"))
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
            AccessMethodsLHS.fail("concat-assign effect (novalue)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
        System.out.println(Bar.ss);
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
        Bar.si = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
        Bar.si++;
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
        if (Bar.si != 1)
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
            AccessMethodsLHS.fail("post-increment effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
        System.out.println(Bar.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
        Bar.si = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
        if (Bar.si++ != 5)
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
            AccessMethodsLHS.fail("post-increment result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
        if (Bar.si != 6)
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
            AccessMethodsLHS.fail("post-increment effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
        System.out.println(Bar.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
        Bar.si = 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
        --Bar.si;
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
        if (Bar.si != 0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
            AccessMethodsLHS.fail("pre-decrement effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
        Bar.si = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
        if (--Bar.si != 4)
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
            AccessMethodsLHS.fail("pre-decrement result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
        if (Bar.si != 4)
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
            AccessMethodsLHS.fail("pre-decrement effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
        System.out.println(Bar.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
        // Double (2 word)
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
        Bar.sd = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
        System.out.println(Bar.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
        if (Bar.sd != 5.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
            AccessMethodsLHS.fail("simple assignment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
        System.out.println(Bar.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
        if ((Bar.sd += 10) != 15.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
            AccessMethodsLHS.fail("add-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   366
        System.out.println(Bar.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
        if (Bar.sd != 15.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
            AccessMethodsLHS.fail("add-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
        System.out.println(Bar.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
        Bar.sd = 0.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
        Bar.sd++;
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
        if (Bar.sd != 1.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   375
            AccessMethodsLHS.fail("post-increment effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
        System.out.println(Bar.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
        Bar.sd = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
        if (Bar.sd++ != 5.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
            AccessMethodsLHS.fail("post-increment result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
        if (Bar.sd != 6.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
            AccessMethodsLHS.fail("post-increment effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
        System.out.println(Bar.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
        Bar.sd = 1.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
        --Bar.sd;
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
        if (Bar.sd != 0.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
            AccessMethodsLHS.fail("pre-decrement effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
        Bar.sd = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
        if (--Bar.sd != 4.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
            AccessMethodsLHS.fail("pre-decrement result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
        if (Bar.sd != 4.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
            AccessMethodsLHS.fail("pre-decrement effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
        System.out.println(Bar.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
        // *** Static class, Static members (invoked via object reference) ***
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
        b.sm(arg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
        iBar(b).sm(arg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
        checkEffects(101);
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
        // Integer (1 word)
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
        b.si = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
        if (b.si != 5)
06bc494ca11e Initial load
duke
parents:
diff changeset
   410
            AccessMethodsLHS.fail("simple assignment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
        if ((b.si += 10) != 15)
06bc494ca11e Initial load
duke
parents:
diff changeset
   414
            AccessMethodsLHS.fail("add-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   415
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   416
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
        if (b.si != 15)
06bc494ca11e Initial load
duke
parents:
diff changeset
   418
            AccessMethodsLHS.fail("add-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   419
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   420
06bc494ca11e Initial load
duke
parents:
diff changeset
   421
        b.ss = "foo";
06bc494ca11e Initial load
duke
parents:
diff changeset
   422
        if (!(b.ss += "bar").equals("foobar"))
06bc494ca11e Initial load
duke
parents:
diff changeset
   423
            AccessMethodsLHS.fail("concat-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   424
        System.out.println(b.ss);
06bc494ca11e Initial load
duke
parents:
diff changeset
   425
06bc494ca11e Initial load
duke
parents:
diff changeset
   426
        if (!b.ss.equals("foobar"))
06bc494ca11e Initial load
duke
parents:
diff changeset
   427
            AccessMethodsLHS.fail("concat-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   428
        System.out.println(b.ss);
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
06bc494ca11e Initial load
duke
parents:
diff changeset
   430
        b.ss = "foo";
06bc494ca11e Initial load
duke
parents:
diff changeset
   431
        b.ss += "bar";
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
        if (!b.ss.equals("foobar"))
06bc494ca11e Initial load
duke
parents:
diff changeset
   433
            AccessMethodsLHS.fail("concat-assign effect (novalue)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   434
        System.out.println(b.ss);
06bc494ca11e Initial load
duke
parents:
diff changeset
   435
06bc494ca11e Initial load
duke
parents:
diff changeset
   436
        b.si = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   437
        b.si++;
06bc494ca11e Initial load
duke
parents:
diff changeset
   438
        if (b.si != 1)
06bc494ca11e Initial load
duke
parents:
diff changeset
   439
            AccessMethodsLHS.fail("post-increment effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   440
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   441
06bc494ca11e Initial load
duke
parents:
diff changeset
   442
        b.si = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   443
        if (b.si++ != 5)
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
            AccessMethodsLHS.fail("post-increment result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   445
        if (b.si != 6)
06bc494ca11e Initial load
duke
parents:
diff changeset
   446
            AccessMethodsLHS.fail("post-increment effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   447
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   448
06bc494ca11e Initial load
duke
parents:
diff changeset
   449
        b.si = 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   450
        --b.si;
06bc494ca11e Initial load
duke
parents:
diff changeset
   451
        if (b.si != 0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   452
            AccessMethodsLHS.fail("pre-decrement effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   453
06bc494ca11e Initial load
duke
parents:
diff changeset
   454
        b.si = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   455
        if (--b.si != 4)
06bc494ca11e Initial load
duke
parents:
diff changeset
   456
            AccessMethodsLHS.fail("pre-decrement result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
        if (b.si != 4)
06bc494ca11e Initial load
duke
parents:
diff changeset
   458
            AccessMethodsLHS.fail("pre-decrement effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   459
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   460
06bc494ca11e Initial load
duke
parents:
diff changeset
   461
        // Double (2 word)
06bc494ca11e Initial load
duke
parents:
diff changeset
   462
06bc494ca11e Initial load
duke
parents:
diff changeset
   463
        b.sd = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   464
        System.out.println(b.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   465
        if (b.sd != 5.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   466
            AccessMethodsLHS.fail("simple assignment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   467
        System.out.println(b.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   468
06bc494ca11e Initial load
duke
parents:
diff changeset
   469
        if ((b.sd += 10) != 15.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   470
            AccessMethodsLHS.fail("add-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   471
        System.out.println(b.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   472
06bc494ca11e Initial load
duke
parents:
diff changeset
   473
        if (b.sd != 15.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   474
            AccessMethodsLHS.fail("add-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
        System.out.println(b.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   476
06bc494ca11e Initial load
duke
parents:
diff changeset
   477
        b.sd = 0.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   478
        b.sd++;
06bc494ca11e Initial load
duke
parents:
diff changeset
   479
        if (b.sd != 1.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   480
            AccessMethodsLHS.fail("post-increment effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   481
        System.out.println(b.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   482
06bc494ca11e Initial load
duke
parents:
diff changeset
   483
        b.sd = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   484
        if (b.sd++ != 5.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   485
            AccessMethodsLHS.fail("post-increment result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   486
        if (b.sd != 6.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   487
            AccessMethodsLHS.fail("post-increment effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   488
        System.out.println(b.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   489
06bc494ca11e Initial load
duke
parents:
diff changeset
   490
        b.sd = 1.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   491
        --b.sd;
06bc494ca11e Initial load
duke
parents:
diff changeset
   492
        if (b.sd != 0.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   493
            AccessMethodsLHS.fail("pre-decrement effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   494
06bc494ca11e Initial load
duke
parents:
diff changeset
   495
        b.sd = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   496
        if (--b.sd != 4.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   497
            AccessMethodsLHS.fail("pre-decrement result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   498
        if (b.sd != 4.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   499
            AccessMethodsLHS.fail("pre-decrement effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   500
        System.out.println(b.sd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   501
06bc494ca11e Initial load
duke
parents:
diff changeset
   502
        // Integer (1 word) with side-effects in object reference
06bc494ca11e Initial load
duke
parents:
diff changeset
   503
06bc494ca11e Initial load
duke
parents:
diff changeset
   504
        iBar(b).si = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   505
        checkEffects(7);
06bc494ca11e Initial load
duke
parents:
diff changeset
   506
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   507
        if (b.si != 5)
06bc494ca11e Initial load
duke
parents:
diff changeset
   508
            AccessMethodsLHS.fail("simple assignment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   509
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   510
06bc494ca11e Initial load
duke
parents:
diff changeset
   511
        if ((iBar(b).si += 10) != 15)
06bc494ca11e Initial load
duke
parents:
diff changeset
   512
            AccessMethodsLHS.fail("add-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   513
        checkEffects(8);
06bc494ca11e Initial load
duke
parents:
diff changeset
   514
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   515
06bc494ca11e Initial load
duke
parents:
diff changeset
   516
        if (b.si != 15)
06bc494ca11e Initial load
duke
parents:
diff changeset
   517
            AccessMethodsLHS.fail("add-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   518
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   519
06bc494ca11e Initial load
duke
parents:
diff changeset
   520
        iBar(b).si = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   521
        checkEffects(9);
06bc494ca11e Initial load
duke
parents:
diff changeset
   522
        iBar(b).si++;
06bc494ca11e Initial load
duke
parents:
diff changeset
   523
        checkEffects(10);
06bc494ca11e Initial load
duke
parents:
diff changeset
   524
        if (b.si != 1)
06bc494ca11e Initial load
duke
parents:
diff changeset
   525
            AccessMethodsLHS.fail("post-increment effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   526
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   527
06bc494ca11e Initial load
duke
parents:
diff changeset
   528
        b.si = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   529
        if (iBar(b).si++ != 5)
06bc494ca11e Initial load
duke
parents:
diff changeset
   530
            AccessMethodsLHS.fail("post-increment result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   531
        checkEffects(11);
06bc494ca11e Initial load
duke
parents:
diff changeset
   532
        if (b.si != 6)
06bc494ca11e Initial load
duke
parents:
diff changeset
   533
            AccessMethodsLHS.fail("post-increment effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   534
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   535
06bc494ca11e Initial load
duke
parents:
diff changeset
   536
        b.si = 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   537
        --iBar(b).si;
06bc494ca11e Initial load
duke
parents:
diff changeset
   538
        checkEffects(12);
06bc494ca11e Initial load
duke
parents:
diff changeset
   539
        if (b.si != 0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   540
            AccessMethodsLHS.fail("pre-decrement effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   541
06bc494ca11e Initial load
duke
parents:
diff changeset
   542
        b.si = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   543
        if (--iBar(b).si != 4)
06bc494ca11e Initial load
duke
parents:
diff changeset
   544
            AccessMethodsLHS.fail("pre-decrement result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   545
        checkEffects(13);
06bc494ca11e Initial load
duke
parents:
diff changeset
   546
        if (b.si != 4)
06bc494ca11e Initial load
duke
parents:
diff changeset
   547
            AccessMethodsLHS.fail("pre-decrement effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   548
        System.out.println(b.si);
06bc494ca11e Initial load
duke
parents:
diff changeset
   549
06bc494ca11e Initial load
duke
parents:
diff changeset
   550
06bc494ca11e Initial load
duke
parents:
diff changeset
   551
        // *** Non-static class, Non-static members ***
06bc494ca11e Initial load
duke
parents:
diff changeset
   552
06bc494ca11e Initial load
duke
parents:
diff changeset
   553
        c.m(arg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   554
06bc494ca11e Initial load
duke
parents:
diff changeset
   555
        iBaz(c).m(arg);
06bc494ca11e Initial load
duke
parents:
diff changeset
   556
        checkEffects(102);
06bc494ca11e Initial load
duke
parents:
diff changeset
   557
06bc494ca11e Initial load
duke
parents:
diff changeset
   558
        // Integer (1 word)
06bc494ca11e Initial load
duke
parents:
diff changeset
   559
06bc494ca11e Initial load
duke
parents:
diff changeset
   560
        c.i = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   561
        System.out.println(c.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   562
        if (c.i != 5)
06bc494ca11e Initial load
duke
parents:
diff changeset
   563
            AccessMethodsLHS.fail("simple assignment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   564
        System.out.println(c.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   565
06bc494ca11e Initial load
duke
parents:
diff changeset
   566
        if ((c.i += 10) != 15)
06bc494ca11e Initial load
duke
parents:
diff changeset
   567
            AccessMethodsLHS.fail("add-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   568
        System.out.println(c.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   569
06bc494ca11e Initial load
duke
parents:
diff changeset
   570
        if (c.i != 15)
06bc494ca11e Initial load
duke
parents:
diff changeset
   571
            AccessMethodsLHS.fail("add-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   572
        System.out.println(c.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   573
06bc494ca11e Initial load
duke
parents:
diff changeset
   574
        c.s = "foo";
06bc494ca11e Initial load
duke
parents:
diff changeset
   575
        if (!(c.s += "bar").equals("foobar"))
06bc494ca11e Initial load
duke
parents:
diff changeset
   576
            AccessMethodsLHS.fail("concat-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   577
        System.out.println(c.s);
06bc494ca11e Initial load
duke
parents:
diff changeset
   578
06bc494ca11e Initial load
duke
parents:
diff changeset
   579
        if (!c.s.equals("foobar"))
06bc494ca11e Initial load
duke
parents:
diff changeset
   580
            AccessMethodsLHS.fail("concat-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   581
        System.out.println(c.s);
06bc494ca11e Initial load
duke
parents:
diff changeset
   582
06bc494ca11e Initial load
duke
parents:
diff changeset
   583
        c.s = "foo";
06bc494ca11e Initial load
duke
parents:
diff changeset
   584
        c.s += "bar";
06bc494ca11e Initial load
duke
parents:
diff changeset
   585
        if (!c.s.equals("foobar"))
06bc494ca11e Initial load
duke
parents:
diff changeset
   586
            AccessMethodsLHS.fail("concat-assign effect (novalue)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   587
        System.out.println(c.s);
06bc494ca11e Initial load
duke
parents:
diff changeset
   588
06bc494ca11e Initial load
duke
parents:
diff changeset
   589
        c.i = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   590
        c.i++;
06bc494ca11e Initial load
duke
parents:
diff changeset
   591
        if (c.i != 1)
06bc494ca11e Initial load
duke
parents:
diff changeset
   592
            AccessMethodsLHS.fail("post-increment effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   593
        System.out.println(c.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   594
06bc494ca11e Initial load
duke
parents:
diff changeset
   595
        c.i = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   596
        if (c.i++ != 5)
06bc494ca11e Initial load
duke
parents:
diff changeset
   597
            AccessMethodsLHS.fail("post-increment result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   598
        if (c.i != 6)
06bc494ca11e Initial load
duke
parents:
diff changeset
   599
            AccessMethodsLHS.fail("post-increment effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   600
        System.out.println(c.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   601
06bc494ca11e Initial load
duke
parents:
diff changeset
   602
        c.i = 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   603
        --c.i;
06bc494ca11e Initial load
duke
parents:
diff changeset
   604
        if (c.i != 0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   605
            AccessMethodsLHS.fail("pre-decrement effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   606
06bc494ca11e Initial load
duke
parents:
diff changeset
   607
        c.i = 5;
06bc494ca11e Initial load
duke
parents:
diff changeset
   608
        if (--c.i != 4)
06bc494ca11e Initial load
duke
parents:
diff changeset
   609
            AccessMethodsLHS.fail("pre-decrement result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   610
        if (c.i != 4)
06bc494ca11e Initial load
duke
parents:
diff changeset
   611
            AccessMethodsLHS.fail("pre-decrement effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   612
        System.out.println(c.i);
06bc494ca11e Initial load
duke
parents:
diff changeset
   613
06bc494ca11e Initial load
duke
parents:
diff changeset
   614
        // Double (2 word)
06bc494ca11e Initial load
duke
parents:
diff changeset
   615
06bc494ca11e Initial load
duke
parents:
diff changeset
   616
        c.d = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   617
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   618
        if (c.d != 5.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   619
            AccessMethodsLHS.fail("simple assignment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   620
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   621
06bc494ca11e Initial load
duke
parents:
diff changeset
   622
        if ((c.d += 10) != 15.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   623
            AccessMethodsLHS.fail("add-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   624
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   625
06bc494ca11e Initial load
duke
parents:
diff changeset
   626
        if (c.d != 15.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   627
            AccessMethodsLHS.fail("add-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   628
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   629
06bc494ca11e Initial load
duke
parents:
diff changeset
   630
        c.d = 0.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   631
        c.d++;
06bc494ca11e Initial load
duke
parents:
diff changeset
   632
        if (c.d != 1.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   633
            AccessMethodsLHS.fail("post-increment effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   634
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   635
06bc494ca11e Initial load
duke
parents:
diff changeset
   636
        c.d = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   637
        if (c.d++ != 5.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   638
            AccessMethodsLHS.fail("post-increment result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   639
        if (c.d != 6.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   640
            AccessMethodsLHS.fail("post-increment effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   641
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   642
06bc494ca11e Initial load
duke
parents:
diff changeset
   643
        c.d = 1.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   644
        --c.d;
06bc494ca11e Initial load
duke
parents:
diff changeset
   645
        if (c.d != 0.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   646
            AccessMethodsLHS.fail("pre-decrement effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   647
06bc494ca11e Initial load
duke
parents:
diff changeset
   648
        c.d = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   649
        if (--c.d != 4.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   650
            AccessMethodsLHS.fail("pre-decrement result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   651
        if (c.d != 4.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   652
            AccessMethodsLHS.fail("pre-decrement effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   653
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   654
06bc494ca11e Initial load
duke
parents:
diff changeset
   655
        // Double (2 word) with side-effects in object reference
06bc494ca11e Initial load
duke
parents:
diff changeset
   656
06bc494ca11e Initial load
duke
parents:
diff changeset
   657
        iBaz(c).d = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   658
        checkEffects(14);
06bc494ca11e Initial load
duke
parents:
diff changeset
   659
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   660
        if (c.d != 5.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   661
            AccessMethodsLHS.fail("simple assignment");
06bc494ca11e Initial load
duke
parents:
diff changeset
   662
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   663
06bc494ca11e Initial load
duke
parents:
diff changeset
   664
        if ((iBaz(c).d += 10) != 15.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   665
            AccessMethodsLHS.fail("add-assign result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   666
        checkEffects(15);
06bc494ca11e Initial load
duke
parents:
diff changeset
   667
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   668
06bc494ca11e Initial load
duke
parents:
diff changeset
   669
        if (c.d != 15.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   670
            AccessMethodsLHS.fail("add-assign effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   671
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   672
06bc494ca11e Initial load
duke
parents:
diff changeset
   673
        c.d = 0.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   674
        iBaz(c).d++;
06bc494ca11e Initial load
duke
parents:
diff changeset
   675
        checkEffects(16);
06bc494ca11e Initial load
duke
parents:
diff changeset
   676
        if (c.d != 1.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   677
            AccessMethodsLHS.fail("post-increment effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   678
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   679
06bc494ca11e Initial load
duke
parents:
diff changeset
   680
        c.d = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   681
        if (iBaz(c).d++ != 5.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   682
            AccessMethodsLHS.fail("post-increment result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   683
        checkEffects(17);
06bc494ca11e Initial load
duke
parents:
diff changeset
   684
        if (c.d != 6.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   685
            AccessMethodsLHS.fail("post-increment effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   686
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   687
06bc494ca11e Initial load
duke
parents:
diff changeset
   688
        c.d = 1.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   689
        --iBaz(c).d;
06bc494ca11e Initial load
duke
parents:
diff changeset
   690
        checkEffects(18);
06bc494ca11e Initial load
duke
parents:
diff changeset
   691
        if (c.d != 0.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   692
            AccessMethodsLHS.fail("pre-decrement effect");
06bc494ca11e Initial load
duke
parents:
diff changeset
   693
06bc494ca11e Initial load
duke
parents:
diff changeset
   694
        c.d = 5.0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   695
        if (--iBaz(c).d != 4.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   696
            AccessMethodsLHS.fail("pre-decrement result");
06bc494ca11e Initial load
duke
parents:
diff changeset
   697
        checkEffects(19);
06bc494ca11e Initial load
duke
parents:
diff changeset
   698
        if (c.d != 4.0)
06bc494ca11e Initial load
duke
parents:
diff changeset
   699
            AccessMethodsLHS.fail("pre-decrement effect (embedded)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   700
        System.out.println(c.d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   701
06bc494ca11e Initial load
duke
parents:
diff changeset
   702
        // All done.
06bc494ca11e Initial load
duke
parents:
diff changeset
   703
06bc494ca11e Initial load
duke
parents:
diff changeset
   704
        System.out.println("done");
06bc494ca11e Initial load
duke
parents:
diff changeset
   705
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   706
}