langtools/test/tools/javac/boxing/QualBoxedPostOp2.java
author duke
Wed, 05 Jul 2017 23:01:50 +0200
changeset 44228 e46434c65a2b
parent 42499 49b675740462
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42499
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
     1
/*
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
     4
 *
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
     7
 * published by the Free Software Foundation.
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
     8
 *
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    13
 * accompanied this code).
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    14
 *
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    18
 *
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    21
 * questions.
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    22
 */
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    23
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    24
/*
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    25
 * @test
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    26
 * @bug 8147527
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    27
 * @summary Qualified "super" boxed unary post-operation using a type variable.
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    28
 * @compile QualBoxedPostOp2.java
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    29
 * @run main QualBoxedPostOp2
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    30
 */
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    31
public class QualBoxedPostOp2<T> extends Parent2<Integer> {
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    32
    public static void main(String[] args) {
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    33
        new QualBoxedPostOp2().testAll();
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    34
    }
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    35
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    36
    private void testAll() {
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    37
        super.i = 10;
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    38
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    39
        equals(new Inner().testParent(), 10);
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    40
        equals(super.i, 11);
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    41
    }
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    42
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    43
    private void equals(int a, int b) {
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    44
        if (a != b) throw new Error();
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    45
    }
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    46
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    47
    T i;
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    48
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    49
    class Inner {
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    50
        private Integer testParent() {
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    51
            return QualBoxedPostOp2.super.i++;
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    52
        }
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    53
    }
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    54
}
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    55
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    56
class Parent2<T> {
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    57
    protected T i;
49b675740462 8147527: Wrong code generated for postfix unary operators
jlahoda
parents:
diff changeset
    58
}