langtools/test/tools/javac/T8023112/SkipLazyConstantCreationForMethodRefTest.java
author sogoel
Fri, 29 Aug 2014 00:42:42 -0700
changeset 26274 02a5b23ee21c
parent 19656 7f0afbdbf142
child 32337 c9d3ab9f601c
permissions -rw-r--r--
8055074: Group 9a: golden files for tests in tools/javac dir Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19656
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
     1
/*
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
     4
 *
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    10
 *
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    15
 * accompanied this code).
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    16
 *
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    20
 *
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    23
 * questions.
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    24
 */
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    25
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    26
/*
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    27
 * @test
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    28
 * @bug 8023112
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    29
 * @summary Mixing up the method type argument with the class type for method
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    30
 *          reference ClassType<Q>::<T>new
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    31
 * @compile SkipLazyConstantCreationForMethodRefTest.java
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    32
 */
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    33
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    34
public class SkipLazyConstantCreationForMethodRefTest<T> {
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    35
    SkipLazyConstantCreationForMethodRefTest(int a, boolean b) {}
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    36
    SkipLazyConstantCreationForMethodRefTest() {}
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    37
}
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    38
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    39
class SubClass<T> extends SkipLazyConstantCreationForMethodRefTest {
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    40
    SubClass(int a, boolean b) {}
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    41
}
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    42
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    43
interface SAM {
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    44
    SubClass<SkipLazyConstantCreationForMethodRefTest> m(int a, boolean b);
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    45
}
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    46
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    47
interface Tester1 {
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    48
    SAM s11 = SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new;
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    49
    SAM s12 = (SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new);
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    50
    SAM s13 = (SAM)SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new;
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    51
    SAM s14 = true ? s11 : s12;
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    52
    SAM s15 = true ? s11 : (SAM)SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new;
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    53
    SAM s16 = true ? (SAM)SubClass<SkipLazyConstantCreationForMethodRefTest>::<Object>new : s12;
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    54
}
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    55
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    56
interface Tester2 {
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    57
    SAM s21 = Tester1.s11;
7f0afbdbf142 8023112: javac should not use lazy constant evaluation approach for method references
vromero
parents:
diff changeset
    58
}