Merge jdk8u102-b02

Tue, 29 Mar 2016 23:02:18 +0100

author
robm
date
Tue, 29 Mar 2016 23:02:18 +0100
changeset 3103
8a650e692464
parent 3101
9b41ed61545e
parent 3102
e74dd6df4d4c
child 3104
42ce1583b562
child 3167
d5af468ae383

Merge

     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Tue Mar 29 13:28:35 2016 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Tue Mar 29 23:02:18 2016 +0100
     1.3 @@ -860,7 +860,7 @@
     1.4          private JCExpression makeReceiver(VarSymbol rcvr) {
     1.5              if (rcvr == null) return null;
     1.6              JCExpression rcvrExpr = make.Ident(rcvr);
     1.7 -            Type rcvrType = tree.sym.enclClass().type;
     1.8 +            Type rcvrType = tree.ownerAccessible ? tree.sym.enclClass().type : tree.expr.type;
     1.9              if (rcvrType == syms.arrayClass.type) {
    1.10                  // Map the receiver type to the actually type, not just "array"
    1.11                  rcvrType = tree.getQualifierExpression().type;
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/tools/javac/lambda/MethodReference75.java	Tue Mar 29 23:02:18 2016 +0100
     2.3 @@ -0,0 +1,46 @@
     2.4 +/*
     2.5 + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 + *
     2.8 + * This code is free software; you can redistribute it and/or modify it
     2.9 + * under the terms of the GNU General Public License version 2 only, as
    2.10 + * published by the Free Software Foundation.
    2.11 + *
    2.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    2.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.15 + * version 2 for more details (a copy is included in the LICENSE file that
    2.16 + * accompanied this code).
    2.17 + *
    2.18 + * You should have received a copy of the GNU General Public License version
    2.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    2.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.21 + *
    2.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    2.23 + * or visit www.oracle.com if you need additional information or have any
    2.24 + * questions.
    2.25 + */
    2.26 +
    2.27 +/*
    2.28 + * @test
    2.29 + * @bug 8143647
    2.30 + * @summary Javac compiles method reference that allows results in an IllegalAccessError
    2.31 + * @run main MethodReference75
    2.32 + */
    2.33 +
    2.34 +import pkg.PublicDerived8143647;
    2.35 +
    2.36 +public class MethodReference75 {
    2.37 +    public static void main(String[] args) {
    2.38 +        if (java.util.Arrays
    2.39 +                .asList(new PublicDerived8143647())
    2.40 +                .stream()
    2.41 +                .map(PublicDerived8143647::getX)
    2.42 +                .findFirst()
    2.43 +                .get()
    2.44 +                .equals("PackagePrivateBase"))
    2.45 +            System.out.println("OK");
    2.46 +        else
    2.47 +            throw new AssertionError("Unexpected output");
    2.48 +    }
    2.49 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/test/tools/javac/lambda/pkg/PublicDerived8143647.java	Tue Mar 29 23:02:18 2016 +0100
     3.3 @@ -0,0 +1,33 @@
     3.4 +/*
     3.5 + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.7 + *
     3.8 + * This code is free software; you can redistribute it and/or modify it
     3.9 + * under the terms of the GNU General Public License version 2 only, as
    3.10 + * published by the Free Software Foundation.
    3.11 + *
    3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    3.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    3.15 + * version 2 for more details (a copy is included in the LICENSE file that
    3.16 + * accompanied this code).
    3.17 + *
    3.18 + * You should have received a copy of the GNU General Public License version
    3.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    3.21 + *
    3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    3.23 + * or visit www.oracle.com if you need additional information or have any
    3.24 + * questions.
    3.25 + */
    3.26 +
    3.27 +package pkg;
    3.28 +
    3.29 +abstract class PackagePrivateBase8143647 {
    3.30 +    public String getX() {
    3.31 +        return "PackagePrivateBase";
    3.32 +    }
    3.33 +}
    3.34 +
    3.35 +public class PublicDerived8143647 extends PackagePrivateBase8143647 {
    3.36 +}

mercurial