langtools/test/tools/javac/lambda/InnerConstructor.java
author vromero
Wed, 23 Jan 2013 20:57:40 +0000
changeset 15384 5a8d00abf076
parent 14547 86d8d242b0c4
child 22690 86dd707d616a
permissions -rw-r--r--
8006694: temporarily workaround combo tests are causing time out in several platforms Reviewed-by: jjg Contributed-by: maurizio.cimadamore@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14537
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
     1
/*
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
     2
 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
     4
 *
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
     8
 *
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    13
 * accompanied this code).
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    14
 *
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    18
 *
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    21
 * questions.
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    22
 */
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    23
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    24
/*
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    25
 * @test
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14537
diff changeset
    26
 * @bug 8003280
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14537
diff changeset
    27
 * @summary Add lambda tests
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14537
diff changeset
    28
 *  Regression test JDK-8003306 inner class constructor in lambda
14537
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    29
 * @author  Robert Field
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    30
 */
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    31
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14537
diff changeset
    32
public class InnerConstructor {
14537
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    33
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14537
diff changeset
    34
    public static void main(String... args) {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14537
diff changeset
    35
        InnerConstructor ic = new InnerConstructor();
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14537
diff changeset
    36
        String res = ic.seq1().m().toString();
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14537
diff changeset
    37
        if (!res.equals("Cbl.toString")) {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14537
diff changeset
    38
            throw new AssertionError(String.format("Unexpected result: %s", res));
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14537
diff changeset
    39
        }
14537
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    40
    }
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    41
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    42
    Ib1 seq1() {
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    43
        return () -> new Cbl();
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    44
    }
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    45
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    46
    class Cbl {
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    47
        Cbl() {  }
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14537
diff changeset
    48
        public String toString() {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14537
diff changeset
    49
            return "Cbl.toString";
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents: 14537
diff changeset
    50
        }
14537
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    51
    }
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    52
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    53
    interface Ib1 {
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    54
        Object m();
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    55
    }
ad188879b6fe 8003306: Compiler crash: calculation of inner class access modifier
rfield
parents:
diff changeset
    56
}