Mercurial > hg > openjdk > lambda > langtools
changeset 2591:cacf685c22c7
Automated merge with http://hg.openjdk.java.net/jdk8/tl/langtools
author | briangoetz |
---|---|
date | Mon, 28 Oct 2013 21:14:41 -0400 |
parents | 44e3ba40e00c (current diff) 0fde5fa9febf (diff) |
children | be4bcbd410e9 |
files | .hgtags .jcheck/conf test/tools/javac/Diagnostics/compressed/T8012003c.java test/tools/javac/Diagnostics/compressed/T8012003c.out test/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java test/tools/javac/defaultMethods/separate/Separate.java test/tools/javac/diags/examples/BadArgTypesInLambda.java |
diffstat | 26 files changed, 335 insertions(+), 233 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Mon Oct 28 12:29:34 2013 -0700 +++ b/.hgtags Mon Oct 28 21:14:41 2013 -0400 @@ -156,6 +156,10 @@ be069d72dde2bfe6f996c46325a320961ca854c2 jdk8-b32 46831c72b7f6c69fef2cc2935001863643a65f94 jdk8-b33 6b105afbb77ca9600a99eade31f686d070c70581 jdk8-b34 +42a7a264130d63029c7cd29c24379b32d147cdb3 lambda-b45 +68da3a8292fc7e068f1ca2fd5ad95d90e2872845 lambda-b48 +92ef69a3ba61b4252c2c129bed190f3d2e91d6c9 lambda-b50 +92ef69a3ba61b4252c2c129bed190f3d2e91d6c9 lambda-b56 defd666a786334465496c8901fa302b779c7e045 jdk8-b35 94bbaa67686f44a124cd16fd9f1e8a6a3f684d2d jdk8-b36 5891b38985e8b2502296fc29e726b527d03116d2 jdk8-b37
--- a/.jcheck/conf Mon Oct 28 12:29:34 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -project=jdk8
--- a/src/share/classes/com/sun/tools/javac/code/Types.java Mon Oct 28 12:29:34 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Mon Oct 28 21:14:41 2013 -0400 @@ -26,6 +26,7 @@ package com.sun.tools.javac.code; import java.lang.ref.SoftReference; +import java.util.Comparator; import java.util.HashSet; import java.util.HashMap; import java.util.Locale; @@ -33,6 +34,7 @@ import java.util.Set; import java.util.WeakHashMap; +import javax.lang.model.type.TypeKind; import javax.tools.JavaFileObject; import com.sun.tools.javac.code.Attribute.RetentionPolicy;
--- a/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Mon Oct 28 12:29:34 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Mon Oct 28 21:14:41 2013 -0400 @@ -503,6 +503,25 @@ } } } + + /** + * Get the list of stuck variables that do not depend on the target + * type - this means that inference will lead to same results during + * both OVERLOAD and CHECK modes. + */ + List<Type> targetFreevars() { + List<Type> freevars = msym.type.getTypeArguments(); + ListBuffer<Type> targetVars = new ListBuffer<>(); + outer: for (Type t : inferenceContext.inferencevars) { + for (Type t2 : freevars) { + if (msym.type.getReturnType().contains(t2) && + t.tsym == t2.tsym) { + targetVars.append(t); + } + } + } + return targetVars.toList(); + } } /**
--- a/test/Makefile Mon Oct 28 12:29:34 2013 -0700 +++ b/test/Makefile Mon Oct 28 21:14:41 2013 -0400 @@ -250,7 +250,7 @@ # Run jtreg tests # -# JTREG_HOME +# JT_HOME # Installed location of jtreg # JT_JAVA # Version of java used to run jtreg. Should normally be the same as TESTJAVA @@ -434,4 +434,3 @@ # No use of suffix rules .SUFFIXES: -
--- a/test/tools/javac/6889255/T6889255.java Mon Oct 28 12:29:34 2013 -0700 +++ b/test/tools/javac/6889255/T6889255.java Mon Oct 28 21:14:41 2013 -0400 @@ -417,6 +417,9 @@ String getExpectedName(VarSymbol v, int i) { // special cases: + // bridge methods use argN. No LVT for them anymore + if ((v.owner.flags() & Flags.BRIDGE) != 0) + return "arg" + (i - 1); // synthetic method if (((v.owner.owner.flags() & Flags.ENUM) != 0) && v.owner.name.toString().equals("valueOf")) @@ -428,10 +431,7 @@ // abstract methods don't have saved names // -- no Code attribute for the LocalVariableTable attribute if ((v.owner.flags() & Flags.ABSTRACT) != 0) - return "arg" + (i - 1); - // bridge methods use argN. No LVT for them anymore - if ((v.owner.flags() & Flags.BRIDGE) != 0) - return "arg" + (i - 1); + return "arg" + (i - 1); // The rest of this method assumes the local conventions in the test program Type t = v.type;
--- a/test/tools/javac/Diagnostics/compressed/T8012003c.java Mon Oct 28 12:29:34 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/** - * @test /nodynamiccopyright/ - * @bug 8012003 - * @summary Method diagnostics resolution need to be simplified in some cases - * test simplification of lambda type-checking error leading to resolution failure - * @compile/fail/ref=T8012003c.out -XDrawDiagnostics -Xdiags:compact T8012003c.java - */ - -class T8012003c { - - interface I { - void m(P p); - } - - void m(I i) { } - - void test() { - m(p->p.m()); - } -} - -class P { - private void m() { } -}
--- a/test/tools/javac/Diagnostics/compressed/T8012003c.out Mon Oct 28 12:29:34 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -T8012003c.java:18:15: compiler.err.report.access: m(), private, P -1 error
--- a/test/tools/javac/api/TestJavacTaskScanner.java Mon Oct 28 12:29:34 2013 -0700 +++ b/test/tools/javac/api/TestJavacTaskScanner.java Mon Oct 28 21:14:41 2013 -0400 @@ -40,7 +40,10 @@ import java.nio.*; import java.nio.charset.Charset; import java.util.Arrays; +import java.util.Stack; import javax.lang.model.element.Element; +import javax.lang.model.element.ElementKind; +import javax.lang.model.element.Modifier; import javax.lang.model.element.TypeElement; import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeMirror;
--- a/test/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java Mon Oct 28 12:29:34 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 7192246 - * @summary check that javac does not generate bridge methods for defaults - */ - -import com.sun.tools.classfile.ClassFile; -import com.sun.tools.classfile.ConstantPool.*; -import com.sun.tools.classfile.Method; - -import java.io.*; - -public class TestNoBridgeOnDefaults { - - interface A<X> { - default <Y> A<X> m(X x, Y y) { return Impl.<X,Y>m1(this, x, y); } - } - - static abstract class B<X> implements A<X> { } - - interface C<X> extends A<X> { - default <Y> C<X> m(X x, Y y) { return Impl.<X,Y>m2(this, x, y); } - } - - static abstract class D<X> extends B<X> implements C<X> { } - - static class Impl { - static <X, Y> A<X> m1(A<X> rec, X x, Y y) { return null; } - static <X, Y> C<X> m2(C<X> rec, X x, Y y) { return null; } - } - - static final String[] SUBTEST_NAMES = { B.class.getName() + ".class", D.class.getName() + ".class" }; - static final String TEST_METHOD_NAME = "m"; - - public static void main(String... args) throws Exception { - new TestNoBridgeOnDefaults().run(); - } - - public void run() throws Exception { - String workDir = System.getProperty("test.classes"); - for (int i = 0 ; i < SUBTEST_NAMES.length ; i ++) { - File compiledTest = new File(workDir, SUBTEST_NAMES[i]); - checkNoBridgeOnDefaults(compiledTest); - } - } - - void checkNoBridgeOnDefaults(File f) { - System.err.println("check: " + f); - try { - ClassFile cf = ClassFile.read(f); - for (Method m : cf.methods) { - String mname = m.getName(cf.constant_pool); - if (mname.equals(TEST_METHOD_NAME)) { - throw new Error("unexpected bridge method found " + m); - } - } - } catch (Exception e) { - e.printStackTrace(); - throw new Error("error reading " + f +": " + e); - } - } -}
--- a/test/tools/javac/defaultMethods/separate/Separate.java Mon Oct 28 12:29:34 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 7192246 - * @summary smoke test for separate compilation of default methods - * @author Maurizio Cimadamore - * @compile pkg1/A.java - * @compile Separate.java - */ - -import pkg1.A; - -class Separate { - interface B extends A.I { - default void m() { A.m(this); } - } - - interface C extends A.I, B { } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/defaultMethods/separate/Separate01.java Mon Oct 28 21:14:41 2013 -0400 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7192246 + * @summary smoke test for separate compilation of default methods + * @author Maurizio Cimadamore + * @compile pkg1/A.java + * @compile Separate01.java + */ + +import pkg1.A; + +class Separate01 { + interface B extends A.I { + default void m() { A.m(this); } + } + + interface C extends A.I, B { } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/defaultMethods/separate/Separate02.java Mon Oct 28 21:14:41 2013 -0400 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8013789 + * @summary Compiler should emit bridges in interfaces + * @compile pkg2/B.java + * @compile Separate02.java + */ + +import pkg2.B; + +class Separate02 implements B { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/defaultMethods/separate/pkg2/A.java Mon Oct 28 21:14:41 2013 -0400 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg2; + +public interface A { + Object m(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/defaultMethods/separate/pkg2/B.java Mon Oct 28 21:14:41 2013 -0400 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg2; + +public interface B extends A { + default String m() { return ""; } +}
--- a/test/tools/javac/defaultMethods/static/hiding/InterfaceMethodHidingTest.java Mon Oct 28 12:29:34 2013 -0700 +++ b/test/tools/javac/defaultMethods/static/hiding/InterfaceMethodHidingTest.java Mon Oct 28 21:14:41 2013 -0400 @@ -199,7 +199,7 @@ void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception { JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker, - Arrays.asList("-XDallowStaticInterfaceMethods"), null, Arrays.asList(source)); + null, null, Arrays.asList(source)); try { ct.analyze(); } catch (Throwable ex) {
--- a/test/tools/javac/defaultMethods/syntax/TestDefaultMethodsSyntax.java Mon Oct 28 12:29:34 2013 -0700 +++ b/test/tools/javac/defaultMethods/syntax/TestDefaultMethodsSyntax.java Mon Oct 28 21:14:41 2013 -0400 @@ -54,7 +54,7 @@ } List<String> getOptions() { - return Arrays.asList("-XDallowStaticInterfaceMethods", "-source", versionString); + return Arrays.asList("-source", versionString); } }
--- a/test/tools/javac/diags/examples.not-yet.txt Mon Oct 28 12:29:34 2013 -0700 +++ b/test/tools/javac/diags/examples.not-yet.txt Mon Oct 28 21:14:41 2013 -0400 @@ -110,4 +110,3 @@ compiler.warn.unknown.enum.constant # in bad class file compiler.warn.unknown.enum.constant.reason # in bad class file compiler.warn.override.equals.but.not.hashcode # when a class overrides equals but not hashCode method from Object -
--- a/test/tools/javac/diags/examples/BadArgTypesInLambda.java Mon Oct 28 12:29:34 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -// key: compiler.err.prob.found.req -// key: compiler.misc.inconvertible.types -// options: -Xdiags:verbose - -class BadArgTypesInLambda { - interface SAM { - void m(Integer i); - } - - void g(SAM s) { } - - void test() { - g(x->{ String s = x; }); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/8023364/T8023364a.java Mon Oct 28 21:14:41 2013 -0400 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8023364 + * @summary Exception in thread "main" java.lang.BootstrapMethodError: call site initialization exception + * @compile T8023364a.java + */ +public class T8023364a { + interface SAM<T> { + T get(); + } + + public static void main(String[] args) { + SAM<SAM> sam = new SAM<SAM>() { public SAM get() { return null; } }; + SAM temp = sam.get()::get; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/8023364/T8023364b.java Mon Oct 28 21:14:41 2013 -0400 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8023364 + * @summary Exception in thread "main" java.lang.BootstrapMethodError: call site initialization exception + * @compile T8023364b.java + */ +class Test { + + interface Supplier<X> { + X get(); + } + + static class A { + public A(Supplier<B> supplier) { } + } + + static class B { } + + static class C { + public B getB() { + return new B(); + } + } + + public static void main(String[] args) { + new Test().test(Test::getC); + } + + private static C getC() { + return new C(); + } + + public void test(Supplier<C> supplier) { + new A(supplier.get()::getB); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/BadConv01.out Mon Oct 28 21:14:41 2013 -0400 @@ -0,0 +1,2 @@ +BadConv01.java:35:13: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.invalid.generic.target.for.lambda.conv: m, kindname.interface, BadConv01.Bar)), #int(T), BadConv01.Bar +1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/BadConv02.out Mon Oct 28 21:14:41 2013 -0400 @@ -0,0 +1,3 @@ +BadConv02.java:44:15: compiler.err.cant.apply.symbol: kindname.constructor, FooImpl, int, compiler.misc.no.args, kindname.class, BadConv02.FooImpl, null +BadConv02.java:45:15: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.target.for.lambda.conv.must.have.default.constr: null, kindname.class, BadConv02.Foo)), #int(), BadConv02.Foo +2 errors
--- a/test/tools/javac/lambda/LambdaParserTest.java Mon Oct 28 12:29:34 2013 -0700 +++ b/test/tools/javac/lambda/LambdaParserTest.java Mon Oct 28 21:14:41 2013 -0400 @@ -29,7 +29,7 @@ * temporarily workaround combo tests are causing time out in several platforms * @library ../lib * @build JavacTestingAbstractThreadedTest - * @run main/othervm LambdaParserTest + * @run main/othervm/timeout=800 LambdaParserTest */ // use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047) @@ -51,10 +51,10 @@ NILARY_STMT("()->{ return x; }"), ONEARY_SHORT_EXPR("#PN->x"), ONEARY_SHORT_STMT("#PN->{ return x; }"), - ONEARY_EXPR("(#M1 #T1 #PN)->x"), - ONEARY_STMT("(#M1 #T1 #PN)->{ return x; }"), - TWOARY_EXPR("(#M1 #T1 #PN, #M2 #T2 y)->x"), - TWOARY_STMT("(#M1 #T1 #PN, #M2 #T2 y)->{ return x; }"); + ONEARY_EXPR("(#A1 #M1 #T1 #PN)->x"), + ONEARY_STMT("(#A1 #M1 #T1 #PN)->{ return x; }"), + TWOARY_EXPR("(#A1 #M1 #T1 #PN, #A2 #M2 #T2 y)->x"), + TWOARY_STMT("(#A1 #M1 #T1 #PN, #A2 #M2 #T2 y)->{ return x; }"); String lambdaTemplate; @@ -63,9 +63,12 @@ } String getLambdaString(LambdaParameterKind pk1, LambdaParameterKind pk2, - ModifierKind mk1, ModifierKind mk2, LambdaParameterName pn) { + ModifierKind mk1, AnnotationKind ak1, ModifierKind mk2, AnnotationKind ak2, + LambdaParameterName pn) { return lambdaTemplate.replaceAll("#M1", mk1.modifier) + .replaceAll("#A1", ak1.anno) .replaceAll("#M2", mk2.modifier) + .replaceAll("#A2", ak2.anno) .replaceAll("#T1", pk1.parameterType) .replaceAll("#T2", pk2.parameterType) .replaceAll("#PN", pn.nameStr); @@ -129,6 +132,22 @@ this == EXPLICIT_GENERIC2_VARARGS; } } + + enum AnnotationKind { + NONE(""), + ANNO("@Anno"); + + String anno; + + AnnotationKind(String anno) { + this.anno = anno; + } + + boolean compatibleWith(LambdaParameterKind pk) { + return pk != LambdaParameterKind.IMPLICIT || + this == NONE; + } + } enum ModifierKind { NONE(""), @@ -166,8 +185,9 @@ } String expressionString(LambdaParameterKind pk1, LambdaParameterKind pk2, - ModifierKind mk1, ModifierKind mk2, LambdaKind lk, LambdaParameterName pn, SubExprKind sk) { - return expressionTemplate.replaceAll("#L", lk.getLambdaString(pk1, pk2, mk1, mk2, pn)) + ModifierKind mk1, AnnotationKind ak1, ModifierKind mk2, AnnotationKind ak2, + LambdaKind lk, LambdaParameterName pn, SubExprKind sk) { + return expressionTemplate.replaceAll("#L", lk.getLambdaString(pk1, pk2, mk1, ak1, mk2, ak2, pn)) .replaceAll("#S", sk.subExpression); } } @@ -198,17 +218,19 @@ continue; for (ModifierKind mk1 : ModifierKind.values()) { if (mk1 != ModifierKind.NONE && lk.isShort()) - continue; - if (lk.arity() < 1 && mk1 != ModifierKind.NONE) - continue; - for (ModifierKind mk2 : ModifierKind.values()) { - if (lk.arity() < 2 && mk2 != ModifierKind.NONE) - continue; - for (SubExprKind sk : SubExprKind.values()) { - for (ExprKind ek : ExprKind.values()) { - pool.execute( - new LambdaParserTest(pk1, pk2, mk1, - mk2, lk, sk, ek, pn)); + continue; + for (AnnotationKind ak1 : AnnotationKind.values()) { + if (lk.arity() < 1 && mk1 != ModifierKind.NONE) + continue; + for (ModifierKind mk2 : ModifierKind.values()) { + for (AnnotationKind ak2 : AnnotationKind.values()) { + if (lk.arity() < 2 && mk2 != ModifierKind.NONE) + continue; + for (SubExprKind sk : SubExprKind.values()) { + for (ExprKind ek : ExprKind.values()) { + pool.execute(new LambdaParserTest(pk1, pk2, mk1, ak1, mk2, ak2, lk, pn, sk, ek)); + } + } } } } @@ -223,8 +245,8 @@ LambdaParameterKind pk1; LambdaParameterKind pk2; - ModifierKind mk1; - ModifierKind mk2; + ModifierKind mk1, mk2; + AnnotationKind ak1, ak2; LambdaKind lk; LambdaParameterName pn; SubExprKind sk; @@ -232,13 +254,15 @@ JavaSource source; DiagnosticChecker diagChecker; - LambdaParserTest(LambdaParameterKind pk1, LambdaParameterKind pk2, - ModifierKind mk1, ModifierKind mk2, LambdaKind lk, - SubExprKind sk, ExprKind ek, LambdaParameterName pn) { + LambdaParserTest(LambdaParameterKind pk1, LambdaParameterKind pk2, ModifierKind mk1, + AnnotationKind ak1, ModifierKind mk2, AnnotationKind ak2, LambdaKind lk, + LambdaParameterName pn, SubExprKind sk, ExprKind ek) { this.pk1 = pk1; this.pk2 = pk2; this.mk1 = mk1; + this.ak1 = ak1; this.mk2 = mk2; + this.ak2 = ak2; this.lk = lk; this.pn = pn; this.sk = sk; @@ -249,7 +273,8 @@ class JavaSource extends SimpleJavaFileObject { - String template = "class Test {\n" + + String template = "@interface Anno { }\n" + + "class Test {\n" + " SAM s = #E;\n" + "}"; @@ -257,8 +282,7 @@ public JavaSource() { super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); - source = template.replaceAll("#E", - ek.expressionString(pk1, pk2, mk1, mk2, lk, pn, sk)); + source = template.replaceAll("#E", ek.expressionString(pk1, pk2, mk1, ak1, mk2, ak2, lk, pn, sk)); } @Override @@ -284,16 +308,19 @@ boolean errorExpected = (lk.arity() > 0 && !mk1.compatibleWith(pk1)) || (lk.arity() > 1 && !mk2.compatibleWith(pk2)); - + + errorExpected |= !lk.isShort() && ((lk.arity() > 0 && !ak1.compatibleWith(pk1)) || + (lk.arity() > 1 && !ak2.compatibleWith(pk2))); + + errorExpected |= pn == LambdaParameterName.UNDERSCORE && + lk.arity() > 0; + if (lk.arity() == 2 && (pk1.explicit() != pk2.explicit() || pk1.isVarargs())) { errorExpected = true; } - errorExpected |= pn == LambdaParameterName.UNDERSCORE && - lk.arity() > 0; - if (errorExpected != diagChecker.errorFound) { throw new Error("invalid diagnostics for source:\n" + source.getCharContent(true) +
--- a/test/tools/javac/lambda/methodReference/SamConversionComboTest.java Mon Oct 28 12:29:34 2013 -0700 +++ b/test/tools/javac/lambda/methodReference/SamConversionComboTest.java Mon Oct 28 21:14:41 2013 -0400 @@ -7,7 +7,7 @@ * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * ANY WARRANTY; without even the implied warranty of MERzCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code).
--- a/test/tools/javac/lambda/mostSpecific/StructuralMostSpecificTest.java Mon Oct 28 12:29:34 2013 -0700 +++ b/test/tools/javac/lambda/mostSpecific/StructuralMostSpecificTest.java Mon Oct 28 21:14:41 2013 -0400 @@ -165,7 +165,7 @@ checkAfterExec(); } - + LambdaReturnKind lrk; RetTypeKind rt1, rt2; ArgTypeKind ak1, ak2; @@ -235,6 +235,12 @@ void check() { checkCount.incrementAndGet(); + + if (ak1 != ak2) + return; + + if (ak1 != ak2) + return; if (ak1 != ak2) return;