Fri, 27 Jun 2014 14:01:25 -0700
Merge
test/tools/javac/varargs/6313164/T6313164.out | file | annotate | diff | comparison | revisions |
1.1 --- a/.hgtags Wed Jun 25 14:21:02 2014 -0700 1.2 +++ b/.hgtags Fri Jun 27 14:01:25 2014 -0700 1.3 @@ -289,3 +289,4 @@ 1.4 d9e6bb92751956ab7f0a469e2f3228a4dc5bb05f jdk8u20-b16 1.5 b45fd486977d6cfe64c9947b7afd203c62ec4e98 jdk8u20-b17 1.6 a550336d045faa63ac4439d4901d9f36e0b634bf jdk8u20-b18 1.7 +c04d99e00268ed87cfbdf76beb1a0ea08abd9a9c jdk8u20-b19
2.1 --- a/src/share/classes/com/sun/tools/javac/code/Source.java Wed Jun 25 14:21:02 2014 -0700 2.2 +++ b/src/share/classes/com/sun/tools/javac/code/Source.java Fri Jun 27 14:01:25 2014 -0700 2.3 @@ -233,6 +233,9 @@ 2.4 public boolean allowFunctionalInterfaceMostSpecific() { 2.5 return compareTo(JDK1_8) >= 0; 2.6 } 2.7 + public boolean allowPostApplicabilityVarargsAccessCheck() { 2.8 + return compareTo(JDK1_8) >= 0; 2.9 + } 2.10 public static SourceVersion toSourceVersion(Source source) { 2.11 switch(source) { 2.12 case JDK1_2:
3.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java Wed Jun 25 14:21:02 2014 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java Fri Jun 27 14:01:25 2014 -0700 3.3 @@ -779,42 +779,41 @@ 3.4 3.5 @Override 3.6 public List<Attribute.Compound> getAnnotationMirrors() { 3.7 - return onlyTypeVariableAnnotations(owner.getRawTypeAttributes()); 3.8 - } 3.9 - 3.10 - private List<Attribute.Compound> onlyTypeVariableAnnotations( 3.11 - List<Attribute.TypeCompound> candidates) { 3.12 - // Declaration annotations on TypeParameters are stored in type attributes 3.13 + // Declaration annotations on type variables are stored in type attributes 3.14 + // on the owner of the TypeVariableSymbol 3.15 + List<Attribute.TypeCompound> candidates = owner.getRawTypeAttributes(); 3.16 + int index = owner.getTypeParameters().indexOf(this); 3.17 List<Attribute.Compound> res = List.nil(); 3.18 for (Attribute.TypeCompound a : candidates) { 3.19 - if (a.position.type == TargetType.CLASS_TYPE_PARAMETER || 3.20 - a.position.type == TargetType.METHOD_TYPE_PARAMETER) 3.21 + if (isCurrentSymbolsAnnotation(a, index)) 3.22 res = res.prepend(a); 3.23 } 3.24 3.25 - return res = res.reverse(); 3.26 + return res.reverse(); 3.27 } 3.28 3.29 - 3.30 - 3.31 // Helper to getAnnotation[s] 3.32 @Override 3.33 public <A extends Annotation> Attribute.Compound getAttribute(Class<A> annoType) { 3.34 - 3.35 String name = annoType.getName(); 3.36 3.37 // Declaration annotations on type variables are stored in type attributes 3.38 // on the owner of the TypeVariableSymbol 3.39 List<Attribute.TypeCompound> candidates = owner.getRawTypeAttributes(); 3.40 + int index = owner.getTypeParameters().indexOf(this); 3.41 for (Attribute.TypeCompound anno : candidates) 3.42 - if (anno.position.type == TargetType.CLASS_TYPE_PARAMETER || 3.43 - anno.position.type == TargetType.METHOD_TYPE_PARAMETER) 3.44 - if (name.contentEquals(anno.type.tsym.flatName())) 3.45 - return anno; 3.46 + if (isCurrentSymbolsAnnotation(anno, index) && 3.47 + name.contentEquals(anno.type.tsym.flatName())) 3.48 + return anno; 3.49 3.50 return null; 3.51 } 3.52 - 3.53 + //where: 3.54 + boolean isCurrentSymbolsAnnotation(Attribute.TypeCompound anno, int index) { 3.55 + return (anno.position.type == TargetType.CLASS_TYPE_PARAMETER || 3.56 + anno.position.type == TargetType.METHOD_TYPE_PARAMETER) && 3.57 + anno.position.parameter_index == index; 3.58 + } 3.59 3.60 3.61 @Override
4.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Wed Jun 25 14:21:02 2014 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Fri Jun 27 14:01:25 2014 -0700 4.3 @@ -629,7 +629,7 @@ 4.4 * (ii) perform functional interface bridge calculation. 4.5 */ 4.6 public ClassSymbol makeFunctionalInterfaceClass(Env<AttrContext> env, Name name, List<Type> targets, long cflags) { 4.7 - if (targets.isEmpty() || !isFunctionalInterface(targets.head)) { 4.8 + if (targets.isEmpty()) { 4.9 return null; 4.10 } 4.11 Symbol descSym = findDescriptorSymbol(targets.head.tsym); 4.12 @@ -2300,7 +2300,7 @@ 4.13 public Type visitType(Type t, Void ignored) { 4.14 // A note on wildcards: there is no good way to 4.15 // determine a supertype for a super bounded wildcard. 4.16 - return null; 4.17 + return Type.noType; 4.18 } 4.19 4.20 @Override 4.21 @@ -2467,7 +2467,7 @@ 4.22 return false; 4.23 return 4.24 t.isRaw() || 4.25 - supertype(t) != null && isDerivedRaw(supertype(t)) || 4.26 + supertype(t) != Type.noType && isDerivedRaw(supertype(t)) || 4.27 isDerivedRaw(interfaces(t)); 4.28 } 4.29 4.30 @@ -3218,6 +3218,7 @@ 4.31 return tvar.rank_field; 4.32 } 4.33 case ERROR: 4.34 + case NONE: 4.35 return 0; 4.36 default: 4.37 throw new AssertionError();
5.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Jun 25 14:21:02 2014 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Jun 27 14:01:25 2014 -0700 5.3 @@ -2968,10 +2968,19 @@ 5.4 if (checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK && 5.5 pt != Type.recoveryType) { 5.6 //check that functional interface class is well-formed 5.7 - ClassSymbol csym = types.makeFunctionalInterfaceClass(env, 5.8 - names.empty, List.of(fExpr.targets.head), ABSTRACT); 5.9 - if (csym != null) { 5.10 - chk.checkImplementations(env.tree, csym, csym); 5.11 + try { 5.12 + /* Types.makeFunctionalInterfaceClass() may throw an exception 5.13 + * when it's executed post-inference. See the listener code 5.14 + * above. 5.15 + */ 5.16 + ClassSymbol csym = types.makeFunctionalInterfaceClass(env, 5.17 + names.empty, List.of(fExpr.targets.head), ABSTRACT); 5.18 + if (csym != null) { 5.19 + chk.checkImplementations(env.tree, csym, csym); 5.20 + } 5.21 + } catch (Types.FunctionDescriptorLookupError ex) { 5.22 + JCDiagnostic cause = ex.getDiagnostic(); 5.23 + resultInfo.checkContext.report(env.tree, cause); 5.24 } 5.25 } 5.26 }
6.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Jun 25 14:21:02 2014 -0700 6.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Jun 27 14:01:25 2014 -0700 6.3 @@ -2679,7 +2679,7 @@ 6.4 checkClassBounds(pos, seensofar, it); 6.5 } 6.6 Type st = types.supertype(type); 6.7 - if (st != null) checkClassBounds(pos, seensofar, st); 6.8 + if (st != Type.noType) checkClassBounds(pos, seensofar, st); 6.9 } 6.10 6.11 /** Enter interface into into set.
7.1 --- a/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Wed Jun 25 14:21:02 2014 -0700 7.2 +++ b/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Fri Jun 27 14:01:25 2014 -0700 7.3 @@ -930,7 +930,7 @@ 7.4 7.5 LambdaReturnScanner() { 7.6 super(EnumSet.of(BLOCK, CASE, CATCH, DOLOOP, FOREACHLOOP, 7.7 - FORLOOP, RETURN, SYNCHRONIZED, SWITCH, TRY, WHILELOOP)); 7.8 + FORLOOP, IF, RETURN, SYNCHRONIZED, SWITCH, TRY, WHILELOOP)); 7.9 } 7.10 } 7.11
8.1 --- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Wed Jun 25 14:21:02 2014 -0700 8.2 +++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Fri Jun 27 14:01:25 2014 -0700 8.3 @@ -1994,7 +1994,11 @@ 8.4 // If instance access isn't needed, make it static. 8.5 // Interface instance methods must be default methods. 8.6 // Lambda methods are private synthetic. 8.7 + // Inherit ACC_STRICT from the enclosing method, or, for clinit, 8.8 + // from the class. 8.9 translatedSym.flags_field = SYNTHETIC | LAMBDA_METHOD | 8.10 + owner.flags_field & STRICTFP | 8.11 + owner.owner.flags_field & STRICTFP | 8.12 PRIVATE | 8.13 (thisReferenced? (inInterface? DEFAULT : 0) : STATIC); 8.14
9.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Jun 25 14:21:02 2014 -0700 9.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Fri Jun 27 14:01:25 2014 -0700 9.3 @@ -96,6 +96,7 @@ 9.4 public final boolean varargsEnabled; 9.5 public final boolean allowMethodHandles; 9.6 public final boolean allowFunctionalInterfaceMostSpecific; 9.7 + public final boolean checkVarargsAccessDuringResolution; 9.8 private final boolean debugResolve; 9.9 private final boolean compactMethodDiags; 9.10 final EnumSet<VerboseResolutionMode> verboseResolutionMode; 9.11 @@ -137,6 +138,8 @@ 9.12 Target target = Target.instance(context); 9.13 allowMethodHandles = target.hasMethodHandles(); 9.14 allowFunctionalInterfaceMostSpecific = source.allowFunctionalInterfaceMostSpecific(); 9.15 + checkVarargsAccessDuringResolution = 9.16 + source.allowPostApplicabilityVarargsAccessCheck(); 9.17 polymorphicSignatureScope = new Scope(syms.noSymbol); 9.18 9.19 inapplicableMethodException = new InapplicableMethodException(diags); 9.20 @@ -834,7 +837,10 @@ 9.21 Warner warn) { 9.22 super.argumentsAcceptable(env, deferredAttrContext, argtypes, formals, warn); 9.23 //should we expand formals? 9.24 - if (deferredAttrContext.phase.isVarargsRequired()) { 9.25 + if ((!checkVarargsAccessDuringResolution || 9.26 + (checkVarargsAccessDuringResolution && 9.27 + deferredAttrContext.mode == AttrMode.CHECK)) && 9.28 + deferredAttrContext.phase.isVarargsRequired()) { 9.29 //check varargs element type accessibility 9.30 varargsAccessible(env, types.elemtype(formals.last()), 9.31 deferredAttrContext.inferenceContext);
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/test/tools/javac/defaultMethods/static/StaticInvoke.java Fri Jun 27 14:01:25 2014 -0700 10.3 @@ -0,0 +1,15 @@ 10.4 +/* @test /nodynamiccopyright/ 10.5 + * @bug 8037385 10.6 + * @summary Must not allow static interface method invocation in legacy code 10.7 + * @compile -source 8 -Xlint:-options StaticInvoke.java 10.8 + * @compile/fail/ref=StaticInvoke7.out -source 7 -Xlint:-options -XDrawDiagnostics StaticInvoke.java 10.9 + * @compile/fail/ref=StaticInvoke6.out -source 6 -Xlint:-options -XDrawDiagnostics StaticInvoke.java 10.10 + */ 10.11 +import java.util.stream.Stream; 10.12 + 10.13 +class StaticInvoke { 10.14 + void test() { 10.15 + Stream.empty(); 10.16 + java.util.stream.Stream.empty(); 10.17 + } 10.18 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/test/tools/javac/defaultMethods/static/StaticInvoke6.out Fri Jun 27 14:01:25 2014 -0700 11.3 @@ -0,0 +1,3 @@ 11.4 +StaticInvoke.java:12:15: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.6 11.5 +StaticInvoke.java:13:32: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.6 11.6 +2 errors
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/test/tools/javac/defaultMethods/static/StaticInvoke7.out Fri Jun 27 14:01:25 2014 -0700 12.3 @@ -0,0 +1,3 @@ 12.4 +StaticInvoke.java:12:15: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.7 12.5 +StaticInvoke.java:13:32: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.7 12.6 +2 errors
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/test/tools/javac/generics/wildcards/T8034147.java Fri Jun 27 14:01:25 2014 -0700 13.3 @@ -0,0 +1,35 @@ 13.4 +/* 13.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 13.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.7 + * 13.8 + * This code is free software; you can redistribute it and/or modify it 13.9 + * under the terms of the GNU General Public License version 2 only, as 13.10 + * published by the Free Software Foundation. 13.11 + * 13.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 13.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13.15 + * version 2 for more details (a copy is included in the LICENSE file that 13.16 + * accompanied this code). 13.17 + * 13.18 + * You should have received a copy of the GNU General Public License version 13.19 + * 2 along with this work; if not, write to the Free Software Foundation, 13.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 13.21 + * 13.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 13.23 + * or visit www.oracle.com if you need additional information or have any 13.24 + * questions. 13.25 + */ 13.26 + 13.27 +/* 13.28 + * @test 13.29 + * @bug 8034147 13.30 + * @summary javac crashes with a NullPointerException during bounds checking 13.31 + * @compile T8034147.java 13.32 + */ 13.33 + 13.34 +class T8034147 { 13.35 + static class One<X extends Two<? super X>> {} 13.36 + static class Two<Y extends Three<? extends Y>> implements Three<Y> {} 13.37 + interface Three<Z> {} 13.38 +}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/test/tools/javac/lambda/LambdaTestStrictFP.java Fri Jun 27 14:01:25 2014 -0700 14.3 @@ -0,0 +1,70 @@ 14.4 +/* 14.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 14.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.7 + * 14.8 + * This code is free software; you can redistribute it and/or modify it 14.9 + * under the terms of the GNU General Public License version 2 only, as 14.10 + * published by the Free Software Foundation. 14.11 + * 14.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 14.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14.15 + * version 2 for more details (a copy is included in the LICENSE file that 14.16 + * accompanied this code). 14.17 + * 14.18 + * You should have received a copy of the GNU General Public License version 14.19 + * 2 along with this work; if not, write to the Free Software Foundation, 14.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 14.21 + * 14.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 14.23 + * or visit www.oracle.com if you need additional information or have any 14.24 + * questions. 14.25 + */ 14.26 + 14.27 +/* 14.28 + * @test 14.29 + * @bug 8046060 14.30 + * @summary Different results of floating point multiplication for lambda code block 14.31 + */ 14.32 + 14.33 +strictfp 14.34 +public class LambdaTestStrictFP { 14.35 + 14.36 + static double fld = eval(() -> { 14.37 + double x = Double.longBitsToDouble(0x1e7ee00000000000L); 14.38 + double y = Double.longBitsToDouble(0x2180101010101010L); 14.39 + 14.40 + return x * y; 14.41 + }); 14.42 + 14.43 + public static void main(String args[]) { 14.44 + double result = eval(() -> { 14.45 + double x = Double.longBitsToDouble(0x1e7ee00000000000L); 14.46 + double y = Double.longBitsToDouble(0x2180101010101010L); 14.47 + 14.48 + return x * y; 14.49 + }); 14.50 + { 14.51 + double x = Double.longBitsToDouble(0x1e7ee00000000000L); 14.52 + double y = Double.longBitsToDouble(0x2180101010101010L); 14.53 + 14.54 + double z = x * y; 14.55 + check(z, result, "method"); 14.56 + check(z, fld, "field"); 14.57 + } 14.58 + } 14.59 + 14.60 + private static void check(double expected, double got, String where) { 14.61 + if (got != expected) { 14.62 + throw new AssertionError(where + ": Non-strictfp " + got + " != " + expected); 14.63 + } 14.64 + } 14.65 + 14.66 + private static double eval(Face arg) { 14.67 + return arg.m(); 14.68 + } 14.69 + 14.70 + private interface Face { 14.71 + double m(); 14.72 + } 14.73 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/test/tools/javac/lambda/LambdaTestStrictFPFlag.java Fri Jun 27 14:01:25 2014 -0700 15.3 @@ -0,0 +1,76 @@ 15.4 +/* 15.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.7 + * 15.8 + * This code is free software; you can redistribute it and/or modify it 15.9 + * under the terms of the GNU General Public License version 2 only, as 15.10 + * published by the Free Software Foundation. 15.11 + * 15.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 15.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15.15 + * version 2 for more details (a copy is included in the LICENSE file that 15.16 + * accompanied this code). 15.17 + * 15.18 + * You should have received a copy of the GNU General Public License version 15.19 + * 2 along with this work; if not, write to the Free Software Foundation, 15.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 15.21 + * 15.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 15.23 + * or visit www.oracle.com if you need additional information or have any 15.24 + * questions. 15.25 + */ 15.26 + 15.27 +/* 15.28 + * @test 15.29 + * @bug 8046060 15.30 + * @summary Different results of floating point multiplication for lambda code block 15.31 + */ 15.32 + 15.33 +import java.io.*; 15.34 +import java.net.URL; 15.35 +import com.sun.tools.classfile.*; 15.36 +import static com.sun.tools.classfile.AccessFlags.ACC_STRICT; 15.37 + 15.38 +public class LambdaTestStrictFPFlag { 15.39 + public static void main(String[] args) throws Exception { 15.40 + new LambdaTestStrictFPFlag().run(); 15.41 + } 15.42 + 15.43 + void run() throws Exception { 15.44 + ClassFile cf = getClassFile("LambdaTestStrictFPFlag$Test.class"); 15.45 + ConstantPool cp = cf.constant_pool; 15.46 + boolean found = false; 15.47 + for (Method meth: cf.methods) { 15.48 + if (meth.getName(cp).startsWith("lambda$")) { 15.49 + if ((meth.access_flags.flags & ACC_STRICT) == 0) { 15.50 + throw new Exception("strict flag missing from lambda"); 15.51 + } 15.52 + found = true; 15.53 + } 15.54 + } 15.55 + if (!found) { 15.56 + throw new Exception("did not find lambda method"); 15.57 + } 15.58 + } 15.59 + 15.60 + ClassFile getClassFile(String name) throws IOException, ConstantPoolException { 15.61 + URL url = getClass().getResource(name); 15.62 + InputStream in = url.openStream(); 15.63 + try { 15.64 + return ClassFile.read(in); 15.65 + } finally { 15.66 + in.close(); 15.67 + } 15.68 + } 15.69 + 15.70 + class Test { 15.71 + strictfp void test() { 15.72 + Face itf = () -> { }; 15.73 + } 15.74 + } 15.75 + 15.76 + interface Face { 15.77 + void m(); 15.78 + } 15.79 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/test/tools/javac/lambda/LambdaTestStrictFPMethod.java Fri Jun 27 14:01:25 2014 -0700 16.3 @@ -0,0 +1,65 @@ 16.4 +/* 16.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.7 + * 16.8 + * This code is free software; you can redistribute it and/or modify it 16.9 + * under the terms of the GNU General Public License version 2 only, as 16.10 + * published by the Free Software Foundation. 16.11 + * 16.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 16.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16.15 + * version 2 for more details (a copy is included in the LICENSE file that 16.16 + * accompanied this code). 16.17 + * 16.18 + * You should have received a copy of the GNU General Public License version 16.19 + * 2 along with this work; if not, write to the Free Software Foundation, 16.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 16.21 + * 16.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 16.23 + * or visit www.oracle.com if you need additional information or have any 16.24 + * questions. 16.25 + */ 16.26 + 16.27 +/* 16.28 + * @test 16.29 + * @bug 8046060 16.30 + * @summary Different results of floating point multiplication for lambda code block 16.31 + */ 16.32 + 16.33 +public class LambdaTestStrictFPMethod { 16.34 + 16.35 + public static void main(String args[]) { 16.36 + new LambdaTestStrictFPMethod().test(); 16.37 + } 16.38 + 16.39 + strictfp void test() { 16.40 + double result = eval(() -> { 16.41 + double x = Double.longBitsToDouble(0x1e7ee00000000000L); 16.42 + double y = Double.longBitsToDouble(0x2180101010101010L); 16.43 + 16.44 + return x * y; 16.45 + }); 16.46 + { 16.47 + double x = Double.longBitsToDouble(0x1e7ee00000000000L); 16.48 + double y = Double.longBitsToDouble(0x2180101010101010L); 16.49 + 16.50 + double z = x * y; 16.51 + check(z, result, "method"); 16.52 + } 16.53 + } 16.54 + 16.55 + strictfp void check(double expected, double got, String where) { 16.56 + if (got != expected) { 16.57 + throw new AssertionError(where + ": Non-strictfp " + got + " != " + expected); 16.58 + } 16.59 + } 16.60 + 16.61 + static double eval(Face arg) { 16.62 + return arg.m(); 16.63 + } 16.64 + 16.65 + interface Face { 16.66 + double m(); 16.67 + } 16.68 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.java Fri Jun 27 14:01:25 2014 -0700 17.3 @@ -0,0 +1,24 @@ 17.4 +/* 17.5 + * @test /nodynamiccopyright/ 17.6 + * @bug 8038182 17.7 + * @summary javac crash with FunctionDescriptorLookupError for invalid functional interface 17.8 + * @compile/fail/ref=CrashFunctionDescriptorExceptionTest.out -XDrawDiagnostics CrashFunctionDescriptorExceptionTest.java 17.9 + */ 17.10 + 17.11 +class CrashFunctionDescriptorExceptionTest { 17.12 + 17.13 + @SuppressWarnings("unchecked") 17.14 + void m () { 17.15 + bar((B b) -> {}); 17.16 + } 17.17 + 17.18 + <E extends A<E>> void bar(I<E> i) {} 17.19 + 17.20 + class A<E> {} 17.21 + 17.22 + class B<E> extends A<E> {} 17.23 + 17.24 + interface I<E extends A<E>> { 17.25 + void foo(E e); 17.26 + } 17.27 +}
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 18.2 +++ b/test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.out Fri Jun 27 14:01:25 2014 -0700 18.3 @@ -0,0 +1,2 @@ 18.4 +CrashFunctionDescriptorExceptionTest.java:12:13: compiler.err.prob.found.req: (compiler.misc.no.suitable.functional.intf.inst: CrashFunctionDescriptorExceptionTest.I<CrashFunctionDescriptorExceptionTest.B>) 18.5 +1 error
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 19.2 +++ b/test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.java Fri Jun 27 14:01:25 2014 -0700 19.3 @@ -0,0 +1,33 @@ 19.4 +/* 19.5 + * @test /nodynamiccopyright/ 19.6 + * @bug 8042759 19.7 + * @summary Lambda returning implicitly-typed lambdas considered pertinent to applicability 19.8 + * @compile/fail/ref=ImplicitLambdaConsideredForApplicabilityTest.out -XDrawDiagnostics ImplicitLambdaConsideredForApplicabilityTest.java 19.9 + */ 19.10 + 19.11 +abstract class ImplicitLambdaConsideredForApplicabilityTest { 19.12 + interface A { 19.13 + B m(int a, int b); 19.14 + } 19.15 + 19.16 + interface C { 19.17 + String m(int a, int b); 19.18 + } 19.19 + 19.20 + interface B { 19.21 + int m(int c); 19.22 + } 19.23 + 19.24 + abstract void foo(A a); 19.25 + 19.26 + abstract void foo(C c); 19.27 + 19.28 + void bar() { 19.29 + foo((int a, int b) -> { 19.30 + if(a < b) 19.31 + return c -> 0; 19.32 + else 19.33 + return c -> 0; 19.34 + }); 19.35 + } 19.36 +}
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.out Fri Jun 27 14:01:25 2014 -0700 20.3 @@ -0,0 +1,2 @@ 20.4 +ImplicitLambdaConsideredForApplicabilityTest.java:26:9: compiler.err.ref.ambiguous: foo, kindname.method, foo(ImplicitLambdaConsideredForApplicabilityTest.A), ImplicitLambdaConsideredForApplicabilityTest, kindname.method, foo(ImplicitLambdaConsideredForApplicabilityTest.C), ImplicitLambdaConsideredForApplicabilityTest 20.5 +1 error
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/test/tools/javac/missingSuperRecovery/MissingInterfaceTest.java Fri Jun 27 14:01:25 2014 -0700 21.3 @@ -0,0 +1,15 @@ 21.4 +/* 21.5 + * @test /nodynamiccopyright/ 21.6 + * @bug 8036007 21.7 + * @summary javac crashes when encountering an unresolvable interface 21.8 + * @build MissingInterfaceTestDep 21.9 + * @clean Closeable 21.10 + * @compile/fail/ref=MissingInterfaceTest.out -XDrawDiagnostics MissingInterfaceTest.java 21.11 + */ 21.12 + 21.13 +public class MissingInterfaceTest { 21.14 + void test(MissingInterfaceTestDep s) { 21.15 + s.call(); 21.16 + s.another(); 21.17 + } 21.18 +}
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 22.2 +++ b/test/tools/javac/missingSuperRecovery/MissingInterfaceTest.out Fri Jun 27 14:01:25 2014 -0700 22.3 @@ -0,0 +1,3 @@ 22.4 +MissingInterfaceTest.java:12:10: compiler.err.cant.access: Closeable, (compiler.misc.class.file.not.found: Closeable) 22.5 +MissingInterfaceTest.java:13:10: compiler.err.cant.resolve.location.args: kindname.method, another, , , (compiler.misc.location.1: kindname.variable, s, MissingInterfaceTestDep) 22.6 +2 errors
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/test/tools/javac/missingSuperRecovery/MissingInterfaceTestDep.java Fri Jun 27 14:01:25 2014 -0700 23.3 @@ -0,0 +1,26 @@ 23.4 +/* 23.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 23.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.7 + * 23.8 + * This code is free software; you can redistribute it and/or modify it 23.9 + * under the terms of the GNU General Public License version 2 only, as 23.10 + * published by the Free Software Foundation. 23.11 + * 23.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 23.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23.15 + * version 2 for more details (a copy is included in the LICENSE file that 23.16 + * accompanied this code). 23.17 + * 23.18 + * You should have received a copy of the GNU General Public License version 23.19 + * 2 along with this work; if not, write to the Free Software Foundation, 23.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23.21 + * 23.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23.23 + * or visit www.oracle.com if you need additional information or have any 23.24 + * questions. 23.25 + */ 23.26 + 23.27 +public class MissingInterfaceTestDep implements Intermediate {} 23.28 +interface Intermediate extends Closeable { } 23.29 +interface Closeable {}
24.1 --- a/test/tools/javac/processing/model/element/TestTypeParameterAnnotations.java Wed Jun 25 14:21:02 2014 -0700 24.2 +++ b/test/tools/javac/processing/model/element/TestTypeParameterAnnotations.java Fri Jun 27 14:01:25 2014 -0700 24.3 @@ -1,5 +1,5 @@ 24.4 /* 24.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 24.6 + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. 24.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.8 * 24.9 * This code is free software; you can redistribute it and/or modify it 24.10 @@ -23,7 +23,7 @@ 24.11 24.12 /* 24.13 * @test 24.14 - * @bug 8011027 24.15 + * @bug 8011027 8046916 24.16 * @library /tools/javac/lib 24.17 * @build JavacTestingAbstractProcessor TestTypeParameterAnnotations 24.18 * @compile -processor TestTypeParameterAnnotations -proc:only TestTypeParameterAnnotations.java 24.19 @@ -33,10 +33,16 @@ 24.20 import java.lang.annotation.*; 24.21 import javax.annotation.processing.*; 24.22 import javax.lang.model.element.*; 24.23 -import javax.lang.model.util.*; 24.24 import javax.tools.*; 24.25 24.26 -public class TestTypeParameterAnnotations<@Foo @Bar @Baz T> extends JavacTestingAbstractProcessor { 24.27 +@ExpectedTypeParameterAnnotations(typeParameterName="T1", 24.28 + annotations={"Foo1", "Bar1", "Baz1"}) 24.29 +@ExpectedTypeParameterAnnotations(typeParameterName="T2", annotations={}) 24.30 +@ExpectedTypeParameterAnnotations(typeParameterName="T3", 24.31 + annotations={"Foo2", "Bar2", "Baz2"}) 24.32 +@ExpectedTypeParameterAnnotations(typeParameterName="T4", annotations={}) 24.33 +public class TestTypeParameterAnnotations<@Foo1 @Bar1 @Baz1 T1, T2, @Foo2 @Bar2 @Baz2 T3, T4> extends 24.34 + JavacTestingAbstractProcessor { 24.35 int round = 0; 24.36 24.37 public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { 24.38 @@ -74,82 +80,69 @@ 24.39 int check(Element e, List<? extends TypeParameterElement> typarams) { 24.40 if (typarams.isEmpty()) 24.41 return 0; 24.42 - if (typarams.size() != 1) 24.43 - return 0; 24.44 24.45 - for (TypeParameterElement tpe: typarams) { 24.46 - boolean b1 = checkAnnotationMirrors(tpe, tpe.getAnnotationMirrors()); 24.47 - boolean b2 = checkAnnotationMirrors(tpe, elements.getAllAnnotationMirrors(tpe)); 24.48 - boolean b3 = checkGetAnnotation(tpe); 24.49 - boolean b4 = checkGetAnnotations(tpe); 24.50 - return b1 && b2 && b3 && b4 ? 1 : 0; 24.51 + for (TypeParameterElement tpe : typarams) { 24.52 + ExpectedTypeParameterAnnotations expected = null; 24.53 + for (ExpectedTypeParameterAnnotations a : e.getAnnotationsByType(ExpectedTypeParameterAnnotations.class)) { 24.54 + if (tpe.getSimpleName().contentEquals(a.typeParameterName())) { 24.55 + expected = a; 24.56 + break; 24.57 + } 24.58 + } 24.59 + if (expected == null) { 24.60 + throw new IllegalStateException("Does not have expected values annotation."); 24.61 + } 24.62 + checkAnnotationMirrors(tpe, tpe.getAnnotationMirrors(), expected); 24.63 + checkAnnotationMirrors(tpe, elements.getAllAnnotationMirrors(tpe), expected); 24.64 + checkGetAnnotation(tpe, expected); 24.65 + checkGetAnnotations(tpe, expected); 24.66 } 24.67 - return 0; 24.68 + 24.69 + return typarams.size(); 24.70 } 24.71 24.72 - boolean checkAnnotationMirrors(TypeParameterElement tpe, List<? extends AnnotationMirror> l) { 24.73 - if (l.size() != 3) { 24.74 - error("To few annotations, got " + l.size() + 24.75 - ", should be 3", tpe); 24.76 - return false; 24.77 + void checkAnnotationMirrors(TypeParameterElement tpe, List<? extends AnnotationMirror> l, ExpectedTypeParameterAnnotations expected) { 24.78 + String[] expectedAnnotations = expected.annotations(); 24.79 + 24.80 + if (l.size() != expectedAnnotations.length) { 24.81 + error("Incorrect number of annotations, got " + l.size() + 24.82 + ", should be " + expectedAnnotations.length, tpe); 24.83 + return ; 24.84 } 24.85 24.86 - AnnotationMirror m = l.get(0); 24.87 - if (!m.getAnnotationType().asElement().equals(elements.getTypeElement("Foo"))) { 24.88 - error("Wrong type of annotation, was expecting @Foo", m.getAnnotationType().asElement()); 24.89 - return false; 24.90 + for (int i = 0; i < expectedAnnotations.length; i++) { 24.91 + AnnotationMirror m = l.get(i); 24.92 + if (!m.getAnnotationType().asElement().equals(elements.getTypeElement(expectedAnnotations[i]))) { 24.93 + error("Wrong type of annotation, was expecting @Foo", m.getAnnotationType().asElement()); 24.94 + return ; 24.95 + } 24.96 } 24.97 - m = l.get(1); 24.98 - if (!m.getAnnotationType().asElement().equals(elements.getTypeElement("Bar"))) { 24.99 - error("Wrong type of annotation, was expecting @Bar", m.getAnnotationType().asElement()); 24.100 - return false; 24.101 - } 24.102 - m = l.get(2); 24.103 - if (!m.getAnnotationType().asElement().equals(elements.getTypeElement("Baz"))) { 24.104 - error("Wrong type of annotation, was expecting @Baz", m.getAnnotationType().asElement()); 24.105 - return false; 24.106 - } 24.107 - return true; 24.108 } 24.109 24.110 - boolean checkGetAnnotation(TypeParameterElement tpe) { 24.111 - Foo f = tpe.getAnnotation(Foo.class); 24.112 - if (f == null) 24.113 - error("Expecting @Foo to be present in getAnnotation()", tpe); 24.114 + void checkGetAnnotation(TypeParameterElement tpe, ExpectedTypeParameterAnnotations expected) { 24.115 + List<String> expectedAnnotations = Arrays.asList(expected.annotations()); 24.116 24.117 - Bar b = tpe.getAnnotation(Bar.class); 24.118 - if (b == null) 24.119 - error("Expecting @Bar to be present in getAnnotation()", tpe); 24.120 + for (Class<? extends Annotation> c : ALL_ANNOTATIONS) { 24.121 + Object a = tpe.getAnnotation(c); 24.122 24.123 - Baz z = tpe.getAnnotation(Baz.class); 24.124 - if (z == null) 24.125 - error("Expecting @Baz to be present in getAnnotation()", tpe); 24.126 - 24.127 - return f != null && 24.128 - b != null && 24.129 - z != null; 24.130 + if (a != null ^ expectedAnnotations.indexOf(c.getName()) != (-1)) { 24.131 + error("Unexpected behavior for " + c.getName(), tpe); 24.132 + return ; 24.133 + } 24.134 + } 24.135 } 24.136 24.137 - boolean checkGetAnnotations(TypeParameterElement tpe) { 24.138 - Foo[] f = tpe.getAnnotationsByType(Foo.class); 24.139 - if (f.length != 1) { 24.140 - error("Expecting 1 @Foo to be present in getAnnotationsByType()", tpe); 24.141 - return false; 24.142 + void checkGetAnnotations(TypeParameterElement tpe, ExpectedTypeParameterAnnotations expected) { 24.143 + List<String> expectedAnnotations = Arrays.asList(expected.annotations()); 24.144 + 24.145 + for (Class<? extends Annotation> c : ALL_ANNOTATIONS) { 24.146 + Object[] a = tpe.getAnnotationsByType(c); 24.147 + 24.148 + if (a.length > 0 ^ expectedAnnotations.indexOf(c.getName()) != (-1)) { 24.149 + error("Unexpected behavior for " + c.getName(), tpe); 24.150 + return ; 24.151 + } 24.152 } 24.153 - 24.154 - Bar[] b = tpe.getAnnotationsByType(Bar.class); 24.155 - if (b.length != 1) { 24.156 - error("Expecting 1 @Bar to be present in getAnnotationsByType()", tpe); 24.157 - return false; 24.158 - } 24.159 - 24.160 - Baz[] z = tpe.getAnnotationsByType(Baz.class); 24.161 - if (z.length != 1) { 24.162 - error("Expecting 1 @Baz to be present in getAnnotationsByType()", tpe); 24.163 - return false; 24.164 - } 24.165 - 24.166 - return true; 24.167 } 24.168 24.169 void note(String msg) { 24.170 @@ -168,23 +161,71 @@ 24.171 messager.printMessage(Diagnostic.Kind.ERROR, msg); 24.172 } 24.173 24.174 + Class<? extends Annotation>[] ALL_ANNOTATIONS = new Class[] { 24.175 + Foo1.class, Bar1.class, Baz1.class, 24.176 + Foo2.class, Bar2.class, Baz2.class, 24.177 + }; 24.178 + 24.179 // additional generic elements to test 24.180 - <@Foo @Bar @Baz X> X m(X x) { return x; } 24.181 + @ExpectedTypeParameterAnnotations(typeParameterName="W", 24.182 + annotations={"Foo1", "Bar1", "Baz1"}) 24.183 + @ExpectedTypeParameterAnnotations(typeParameterName="X", annotations={}) 24.184 + @ExpectedTypeParameterAnnotations(typeParameterName="Y", 24.185 + annotations={"Foo2", "Bar2", "Baz2"}) 24.186 + @ExpectedTypeParameterAnnotations(typeParameterName="Z", annotations={}) 24.187 + <@Foo1 @Bar1 @Baz1 W, X, @Foo2 @Bar2 @Baz2 Y, Z> X m(X x) { return x; } 24.188 24.189 - interface Intf<@Foo @Bar @Baz X> { X m() ; } 24.190 + @ExpectedTypeParameterAnnotations(typeParameterName="W", 24.191 + annotations={"Foo1", "Bar1", "Baz1"}) 24.192 + @ExpectedTypeParameterAnnotations(typeParameterName="X", annotations={}) 24.193 + @ExpectedTypeParameterAnnotations(typeParameterName="Y", 24.194 + annotations={"Foo2", "Bar2", "Baz2"}) 24.195 + @ExpectedTypeParameterAnnotations(typeParameterName="Z", annotations={}) 24.196 + interface Intf<@Foo1 @Bar1 @Baz1 W, X, @Foo2 @Bar2 @Baz2 Y, Z> { X m() ; } 24.197 24.198 - class Class<@Foo @Bar @Baz X> { 24.199 - <@Foo @Bar @Baz Y> Class() { } 24.200 + @ExpectedTypeParameterAnnotations(typeParameterName="W", 24.201 + annotations={"Foo1", "Bar1", "Baz1"}) 24.202 + @ExpectedTypeParameterAnnotations(typeParameterName="X", annotations={}) 24.203 + @ExpectedTypeParameterAnnotations(typeParameterName="Y", 24.204 + annotations={"Foo2", "Bar2", "Baz2"}) 24.205 + @ExpectedTypeParameterAnnotations(typeParameterName="Z", annotations={}) 24.206 + class Clazz<@Foo1 @Bar1 @Baz1 W, X, @Foo2 @Bar2 @Baz2 Y, Z> { 24.207 + @ExpectedTypeParameterAnnotations(typeParameterName="W", 24.208 + annotations={"Foo1", "Bar1", "Baz1"}) 24.209 + @ExpectedTypeParameterAnnotations(typeParameterName="X", annotations={}) 24.210 + @ExpectedTypeParameterAnnotations(typeParameterName="Y", 24.211 + annotations={"Foo2", "Bar2", "Baz2"}) 24.212 + @ExpectedTypeParameterAnnotations(typeParameterName="Z", annotations={}) 24.213 + <@Foo1 @Bar1 @Baz1 W, X, @Foo2 @Bar2 @Baz2 Y, Z> Clazz() { } 24.214 } 24.215 24.216 - final int expect = 5; // top level class, plus preceding examples 24.217 + final int expect = 5 * 4; // top level class, plus preceding examples, 4 type variables each 24.218 } 24.219 24.220 @Target(ElementType.TYPE_PARAMETER) 24.221 -@interface Foo {} 24.222 +@interface Foo1 {} 24.223 24.224 @Target(ElementType.TYPE_PARAMETER) 24.225 -@interface Bar {} 24.226 +@interface Bar1 {} 24.227 24.228 @Target(ElementType.TYPE_PARAMETER) 24.229 -@interface Baz {} 24.230 +@interface Baz1 {} 24.231 + 24.232 +@Target(ElementType.TYPE_PARAMETER) 24.233 +@interface Foo2 {} 24.234 + 24.235 +@Target(ElementType.TYPE_PARAMETER) 24.236 +@interface Bar2 {} 24.237 + 24.238 +@Target(ElementType.TYPE_PARAMETER) 24.239 +@interface Baz2 {} 24.240 + 24.241 +@Repeatable(ExpectedTypeParameterAnnotationsCollection.class) 24.242 +@interface ExpectedTypeParameterAnnotations { 24.243 + public String typeParameterName(); 24.244 + public String[] annotations(); 24.245 +} 24.246 + 24.247 +@interface ExpectedTypeParameterAnnotationsCollection { 24.248 + public ExpectedTypeParameterAnnotations[] value(); 24.249 +}
25.1 --- a/test/tools/javac/varargs/6313164/T6313164.java Wed Jun 25 14:21:02 2014 -0700 25.2 +++ b/test/tools/javac/varargs/6313164/T6313164.java Fri Jun 27 14:01:25 2014 -0700 25.3 @@ -1,18 +1,26 @@ 25.4 /* 25.5 * @test /nodynamiccopyright/ 25.6 - * @bug 6313164 25.7 + * @bug 6313164 8036953 25.8 * @author mcimadamore 25.9 * @summary javac generates code that fails byte code verification for the varargs feature 25.10 - * @compile/fail/ref=T6313164.out -XDrawDiagnostics T6313164.java 25.11 + * @compile/fail/ref=T6313164Source7.out -source 7 -XDrawDiagnostics T6313164.java 25.12 + * @compile/fail/ref=T6313164Source8AndHigher.out -XDrawDiagnostics T6313164.java 25.13 */ 25.14 import p1.*; 25.15 25.16 class T6313164 { 25.17 - { B b = new B(); 25.18 - b.foo1(new B(), new B()); //error - A not accesible 25.19 - b.foo2(new B(), new B()); //ok - A not accessible, but foo2(Object...) applicable 25.20 - b.foo3(null, null); //error - A (inferred) not accesible 25.21 - b.foo4(null, null); //error - A (inferred in 15.12.2.8 - no resolution backtrack) not accesible 25.22 - b.foo4(new B(), new C()); //ok - A (inferred in 15.12.2.7) not accessible, but foo4(Object...) applicable 25.23 + { 25.24 + B b = new B(); 25.25 + b.foo1(new B(), new B()); //error - A not accessible 25.26 + /* 7 : ok - A not accessible, but foo2(Object...) applicable 25.27 + * 8+ : error - A not accessible 25.28 + */ 25.29 + b.foo2(new B(), new B()); 25.30 + b.foo3(null, null); //error - A (inferred) not accessible 25.31 + b.foo4(null, null); //error - A not accesible 25.32 + /* 7 : ok - A not accessible, but foo4(Object...) applicable 25.33 + * 8+ : error - A not accessible 25.34 + */ 25.35 + b.foo4(new B(), new C()); 25.36 } 25.37 }
26.1 --- a/test/tools/javac/varargs/6313164/T6313164.out Wed Jun 25 14:21:02 2014 -0700 26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 26.3 @@ -1,6 +0,0 @@ 26.4 -T6313164.java:12:8: compiler.err.cant.apply.symbol: kindname.method, foo1, p1.A[], p1.B,p1.B, kindname.class, p1.B, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) 26.5 -T6313164.java:14:13: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) 26.6 -T6313164.java:15:13: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) 26.7 -- compiler.note.unchecked.filename: B.java 26.8 -- compiler.note.unchecked.recompile 26.9 -3 errors
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 27.2 +++ b/test/tools/javac/varargs/6313164/T6313164Source7.out Fri Jun 27 14:01:25 2014 -0700 27.3 @@ -0,0 +1,6 @@ 27.4 +- compiler.warn.source.no.bootclasspath: 1.7 27.5 +T6313164.java:14:10: compiler.err.cant.apply.symbol: kindname.method, foo1, p1.A[], p1.B,p1.B, kindname.class, p1.B, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) 27.6 +T6313164.java:19:15: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) 27.7 +T6313164.java:20:15: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) 27.8 +3 errors 27.9 +1 warning
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 28.2 +++ b/test/tools/javac/varargs/6313164/T6313164Source8AndHigher.out Fri Jun 27 14:01:25 2014 -0700 28.3 @@ -0,0 +1,6 @@ 28.4 +T6313164.java:14:15: compiler.err.cant.apply.symbol: kindname.method, foo1, p1.A[], p1.B,p1.B, kindname.class, p1.B, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) 28.5 +T6313164.java:18:15: compiler.err.cant.apply.symbol: kindname.method, foo2, p1.A[], p1.B,p1.B, kindname.class, p1.B, (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) 28.6 +T6313164.java:19:15: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) 28.7 +T6313164.java:20:15: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) 28.8 +T6313164.java:24:15: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164) 28.9 +5 errors
29.1 --- a/test/tools/javac/varargs/6313164/T7175433.java Wed Jun 25 14:21:02 2014 -0700 29.2 +++ b/test/tools/javac/varargs/6313164/T7175433.java Fri Jun 27 14:01:25 2014 -0700 29.3 @@ -1,31 +1,8 @@ 29.4 /* 29.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 29.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 29.7 - * 29.8 - * This code is free software; you can redistribute it and/or modify it 29.9 - * under the terms of the GNU General Public License version 2 only, as 29.10 - * published by the Free Software Foundation. 29.11 - * 29.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 29.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 29.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 29.15 - * version 2 for more details (a copy is included in the LICENSE file that 29.16 - * accompanied this code). 29.17 - * 29.18 - * You should have received a copy of the GNU General Public License version 29.19 - * 2 along with this work; if not, write to the Free Software Foundation, 29.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 29.21 - * 29.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 29.23 - * or visit www.oracle.com if you need additional information or have any 29.24 - * questions. 29.25 - */ 29.26 - 29.27 -/* 29.28 - * @test 29.29 + * @test /nodynamiccopyright/ 29.30 * @bug 7175433 6313164 29.31 * @summary Inference cleanup: add helper class to handle inference variables 29.32 - * 29.33 + * @compile/fail/ref=T7175433.out -XDrawDiagnostics T7175433.java 29.34 */ 29.35 29.36 import java.util.List; 29.37 @@ -34,26 +11,16 @@ 29.38 29.39 private class Foo { } 29.40 29.41 - <Z> List<Z> m(Object... o) { T7175433.assertTrue(true); return null; } 29.42 - <Z> List<Z> m(Foo... o) { T7175433.assertTrue(false); return null; } 29.43 + <Z> List<Z> m(Object... o) { return null; } 29.44 + <Z> List<Z> m(Foo... o) { return null; } 29.45 29.46 Foo getFoo() { return null; } 29.47 } 29.48 29.49 public class T7175433 { 29.50 29.51 - static int assertionCount; 29.52 - 29.53 - static void assertTrue(boolean b) { 29.54 - assertionCount++; 29.55 - if (!b) { 29.56 - throw new AssertionError(); 29.57 - } 29.58 - } 29.59 - 29.60 public static void main(String[] args) { 29.61 Bar b = new Bar(); 29.62 b.m(b.getFoo()); 29.63 - assertTrue(assertionCount == 1); 29.64 } 29.65 }
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 30.2 +++ b/test/tools/javac/varargs/6313164/T7175433.out Fri Jun 27 14:01:25 2014 -0700 30.3 @@ -0,0 +1,2 @@ 30.4 +T7175433.java:24:12: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: Bar.Foo, kindname.class, T7175433) 30.5 +1 error
31.1 --- a/test/tools/javac/varargs/6313164/p1/B.java Wed Jun 25 14:21:02 2014 -0700 31.2 +++ b/test/tools/javac/varargs/6313164/p1/B.java Fri Jun 27 14:01:25 2014 -0700 31.3 @@ -1,5 +1,5 @@ 31.4 /* 31.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 31.6 + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. 31.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 31.8 * 31.9 * This code is free software; you can redistribute it and/or modify it 31.10 @@ -23,13 +23,12 @@ 31.11 31.12 package p1; 31.13 31.14 +@SuppressWarnings("unchecked") 31.15 public class B extends A { 31.16 - public B() {} 31.17 public void foo1(A... args) { } 31.18 public void foo2(A... args) { } 31.19 public void foo2(Object... args) { } 31.20 public <X extends A> void foo3(X... args) { } 31.21 public <X extends A> void foo4(X... args) { } 31.22 public void foo4(Object... args) { } 31.23 - 31.24 }