aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormfang <none@none>2014-06-27 14:01:25 -0700
committermfang <none@none>2014-06-27 14:01:25 -0700
commite4004974c526c5e1a089a0b481478653fae2692c (patch)
tree55914540e8e6716a6ae1f4c534eb81ea2ff7acc1
parent70a9ff421c6b8397bca0c9cd99d2e5e2d70aafbe (diff)
parent249a54dbcaca8a48ac989444c3eff97bf6272497 (diff)
Merge
-rw-r--r--.hgtags1
-rw-r--r--src/share/classes/com/sun/tools/javac/code/Source.java3
-rw-r--r--src/share/classes/com/sun/tools/javac/code/Symbol.java33
-rw-r--r--src/share/classes/com/sun/tools/javac/code/Types.java7
-rw-r--r--src/share/classes/com/sun/tools/javac/comp/Attr.java17
-rw-r--r--src/share/classes/com/sun/tools/javac/comp/Check.java2
-rw-r--r--src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java2
-rw-r--r--src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java4
-rw-r--r--src/share/classes/com/sun/tools/javac/comp/Resolve.java8
-rw-r--r--test/tools/javac/defaultMethods/static/StaticInvoke.java15
-rw-r--r--test/tools/javac/defaultMethods/static/StaticInvoke6.out3
-rw-r--r--test/tools/javac/defaultMethods/static/StaticInvoke7.out3
-rw-r--r--test/tools/javac/generics/wildcards/T8034147.java35
-rw-r--r--test/tools/javac/lambda/LambdaTestStrictFP.java70
-rw-r--r--test/tools/javac/lambda/LambdaTestStrictFPFlag.java76
-rw-r--r--test/tools/javac/lambda/LambdaTestStrictFPMethod.java65
-rw-r--r--test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.java24
-rw-r--r--test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.out2
-rw-r--r--test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.java33
-rw-r--r--test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.out2
-rw-r--r--test/tools/javac/missingSuperRecovery/MissingInterfaceTest.java15
-rw-r--r--test/tools/javac/missingSuperRecovery/MissingInterfaceTest.out3
-rw-r--r--test/tools/javac/missingSuperRecovery/MissingInterfaceTestDep.java26
-rw-r--r--test/tools/javac/processing/model/element/TestTypeParameterAnnotations.java189
-rw-r--r--test/tools/javac/varargs/6313164/T6313164.java24
-rw-r--r--test/tools/javac/varargs/6313164/T6313164.out6
-rw-r--r--test/tools/javac/varargs/6313164/T6313164Source7.out6
-rw-r--r--test/tools/javac/varargs/6313164/T6313164Source8AndHigher.out6
-rw-r--r--test/tools/javac/varargs/6313164/T7175433.java41
-rw-r--r--test/tools/javac/varargs/6313164/T7175433.out2
-rw-r--r--test/tools/javac/varargs/6313164/p1/B.java5
31 files changed, 573 insertions, 155 deletions
diff --git a/.hgtags b/.hgtags
index b498e329..df280161 100644
--- a/.hgtags
+++ b/.hgtags
@@ -289,3 +289,4 @@ b5c2375893e2bca1883e5571bd911b6f0b533bf4 jdk8u20-b13
d9e6bb92751956ab7f0a469e2f3228a4dc5bb05f jdk8u20-b16
b45fd486977d6cfe64c9947b7afd203c62ec4e98 jdk8u20-b17
a550336d045faa63ac4439d4901d9f36e0b634bf jdk8u20-b18
+c04d99e00268ed87cfbdf76beb1a0ea08abd9a9c jdk8u20-b19
diff --git a/src/share/classes/com/sun/tools/javac/code/Source.java b/src/share/classes/com/sun/tools/javac/code/Source.java
index 4216df5c..ab15d6db 100644
--- a/src/share/classes/com/sun/tools/javac/code/Source.java
+++ b/src/share/classes/com/sun/tools/javac/code/Source.java
@@ -233,6 +233,9 @@ public enum Source {
public boolean allowFunctionalInterfaceMostSpecific() {
return compareTo(JDK1_8) >= 0;
}
+ public boolean allowPostApplicabilityVarargsAccessCheck() {
+ return compareTo(JDK1_8) >= 0;
+ }
public static SourceVersion toSourceVersion(Source source) {
switch(source) {
case JDK1_2:
diff --git a/src/share/classes/com/sun/tools/javac/code/Symbol.java b/src/share/classes/com/sun/tools/javac/code/Symbol.java
index e3349ac3..9efd9f7b 100644
--- a/src/share/classes/com/sun/tools/javac/code/Symbol.java
+++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java
@@ -779,42 +779,41 @@ public abstract class Symbol extends AnnoConstruct implements Element {
@Override
public List<Attribute.Compound> getAnnotationMirrors() {
- return onlyTypeVariableAnnotations(owner.getRawTypeAttributes());
- }
-
- private List<Attribute.Compound> onlyTypeVariableAnnotations(
- List<Attribute.TypeCompound> candidates) {
- // Declaration annotations on TypeParameters are stored in type attributes
+ // Declaration annotations on type variables are stored in type attributes
+ // on the owner of the TypeVariableSymbol
+ List<Attribute.TypeCompound> candidates = owner.getRawTypeAttributes();
+ int index = owner.getTypeParameters().indexOf(this);
List<Attribute.Compound> res = List.nil();
for (Attribute.TypeCompound a : candidates) {
- if (a.position.type == TargetType.CLASS_TYPE_PARAMETER ||
- a.position.type == TargetType.METHOD_TYPE_PARAMETER)
+ if (isCurrentSymbolsAnnotation(a, index))
res = res.prepend(a);
}
- return res = res.reverse();
+ return res.reverse();
}
-
-
// Helper to getAnnotation[s]
@Override
public <A extends Annotation> Attribute.Compound getAttribute(Class<A> annoType) {
-
String name = annoType.getName();
// Declaration annotations on type variables are stored in type attributes
// on the owner of the TypeVariableSymbol
List<Attribute.TypeCompound> candidates = owner.getRawTypeAttributes();
+ int index = owner.getTypeParameters().indexOf(this);
for (Attribute.TypeCompound anno : candidates)
- if (anno.position.type == TargetType.CLASS_TYPE_PARAMETER ||
- anno.position.type == TargetType.METHOD_TYPE_PARAMETER)
- if (name.contentEquals(anno.type.tsym.flatName()))
- return anno;
+ if (isCurrentSymbolsAnnotation(anno, index) &&
+ name.contentEquals(anno.type.tsym.flatName()))
+ return anno;
return null;
}
-
+ //where:
+ boolean isCurrentSymbolsAnnotation(Attribute.TypeCompound anno, int index) {
+ return (anno.position.type == TargetType.CLASS_TYPE_PARAMETER ||
+ anno.position.type == TargetType.METHOD_TYPE_PARAMETER) &&
+ anno.position.parameter_index == index;
+ }
@Override
diff --git a/src/share/classes/com/sun/tools/javac/code/Types.java b/src/share/classes/com/sun/tools/javac/code/Types.java
index ecbdeb53..a38f7880 100644
--- a/src/share/classes/com/sun/tools/javac/code/Types.java
+++ b/src/share/classes/com/sun/tools/javac/code/Types.java
@@ -629,7 +629,7 @@ public class Types {
* (ii) perform functional interface bridge calculation.
*/
public ClassSymbol makeFunctionalInterfaceClass(Env<AttrContext> env, Name name, List<Type> targets, long cflags) {
- if (targets.isEmpty() || !isFunctionalInterface(targets.head)) {
+ if (targets.isEmpty()) {
return null;
}
Symbol descSym = findDescriptorSymbol(targets.head.tsym);
@@ -2300,7 +2300,7 @@ public class Types {
public Type visitType(Type t, Void ignored) {
// A note on wildcards: there is no good way to
// determine a supertype for a super bounded wildcard.
- return null;
+ return Type.noType;
}
@Override
@@ -2467,7 +2467,7 @@ public class Types {
return false;
return
t.isRaw() ||
- supertype(t) != null && isDerivedRaw(supertype(t)) ||
+ supertype(t) != Type.noType && isDerivedRaw(supertype(t)) ||
isDerivedRaw(interfaces(t));
}
@@ -3218,6 +3218,7 @@ public class Types {
return tvar.rank_field;
}
case ERROR:
+ case NONE:
return 0;
default:
throw new AssertionError();
diff --git a/src/share/classes/com/sun/tools/javac/comp/Attr.java b/src/share/classes/com/sun/tools/javac/comp/Attr.java
index 0e9e4397..41511dad 100644
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -2968,10 +2968,19 @@ public class Attr extends JCTree.Visitor {
if (checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK &&
pt != Type.recoveryType) {
//check that functional interface class is well-formed
- ClassSymbol csym = types.makeFunctionalInterfaceClass(env,
- names.empty, List.of(fExpr.targets.head), ABSTRACT);
- if (csym != null) {
- chk.checkImplementations(env.tree, csym, csym);
+ try {
+ /* Types.makeFunctionalInterfaceClass() may throw an exception
+ * when it's executed post-inference. See the listener code
+ * above.
+ */
+ ClassSymbol csym = types.makeFunctionalInterfaceClass(env,
+ names.empty, List.of(fExpr.targets.head), ABSTRACT);
+ if (csym != null) {
+ chk.checkImplementations(env.tree, csym, csym);
+ }
+ } catch (Types.FunctionDescriptorLookupError ex) {
+ JCDiagnostic cause = ex.getDiagnostic();
+ resultInfo.checkContext.report(env.tree, cause);
}
}
}
diff --git a/src/share/classes/com/sun/tools/javac/comp/Check.java b/src/share/classes/com/sun/tools/javac/comp/Check.java
index 7511ad54..b52f9af1 100644
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java
@@ -2679,7 +2679,7 @@ public class Check {
checkClassBounds(pos, seensofar, it);
}
Type st = types.supertype(type);
- if (st != null) checkClassBounds(pos, seensofar, st);
+ if (st != Type.noType) checkClassBounds(pos, seensofar, st);
}
/** Enter interface into into set.
diff --git a/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
index e9baf6bc..01c04ad3 100644
--- a/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
+++ b/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
@@ -930,7 +930,7 @@ public class DeferredAttr extends JCTree.Visitor {
LambdaReturnScanner() {
super(EnumSet.of(BLOCK, CASE, CATCH, DOLOOP, FOREACHLOOP,
- FORLOOP, RETURN, SYNCHRONIZED, SWITCH, TRY, WHILELOOP));
+ FORLOOP, IF, RETURN, SYNCHRONIZED, SWITCH, TRY, WHILELOOP));
}
}
diff --git a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
index e176e928..980843fc 100644
--- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
+++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
@@ -1994,7 +1994,11 @@ public class LambdaToMethod extends TreeTranslator {
// If instance access isn't needed, make it static.
// Interface instance methods must be default methods.
// Lambda methods are private synthetic.
+ // Inherit ACC_STRICT from the enclosing method, or, for clinit,
+ // from the class.
translatedSym.flags_field = SYNTHETIC | LAMBDA_METHOD |
+ owner.flags_field & STRICTFP |
+ owner.owner.flags_field & STRICTFP |
PRIVATE |
(thisReferenced? (inInterface? DEFAULT : 0) : STATIC);
diff --git a/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/src/share/classes/com/sun/tools/javac/comp/Resolve.java
index 1535e1d4..043833e5 100644
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java
+++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java
@@ -96,6 +96,7 @@ public class Resolve {
public final boolean varargsEnabled;
public final boolean allowMethodHandles;
public final boolean allowFunctionalInterfaceMostSpecific;
+ public final boolean checkVarargsAccessDuringResolution;
private final boolean debugResolve;
private final boolean compactMethodDiags;
final EnumSet<VerboseResolutionMode> verboseResolutionMode;
@@ -137,6 +138,8 @@ public class Resolve {
Target target = Target.instance(context);
allowMethodHandles = target.hasMethodHandles();
allowFunctionalInterfaceMostSpecific = source.allowFunctionalInterfaceMostSpecific();
+ checkVarargsAccessDuringResolution =
+ source.allowPostApplicabilityVarargsAccessCheck();
polymorphicSignatureScope = new Scope(syms.noSymbol);
inapplicableMethodException = new InapplicableMethodException(diags);
@@ -834,7 +837,10 @@ public class Resolve {
Warner warn) {
super.argumentsAcceptable(env, deferredAttrContext, argtypes, formals, warn);
//should we expand formals?
- if (deferredAttrContext.phase.isVarargsRequired()) {
+ if ((!checkVarargsAccessDuringResolution ||
+ (checkVarargsAccessDuringResolution &&
+ deferredAttrContext.mode == AttrMode.CHECK)) &&
+ deferredAttrContext.phase.isVarargsRequired()) {
//check varargs element type accessibility
varargsAccessible(env, types.elemtype(formals.last()),
deferredAttrContext.inferenceContext);
diff --git a/test/tools/javac/defaultMethods/static/StaticInvoke.java b/test/tools/javac/defaultMethods/static/StaticInvoke.java
new file mode 100644
index 00000000..368e35d6
--- /dev/null
+++ b/test/tools/javac/defaultMethods/static/StaticInvoke.java
@@ -0,0 +1,15 @@
+/* @test /nodynamiccopyright/
+ * @bug 8037385
+ * @summary Must not allow static interface method invocation in legacy code
+ * @compile -source 8 -Xlint:-options StaticInvoke.java
+ * @compile/fail/ref=StaticInvoke7.out -source 7 -Xlint:-options -XDrawDiagnostics StaticInvoke.java
+ * @compile/fail/ref=StaticInvoke6.out -source 6 -Xlint:-options -XDrawDiagnostics StaticInvoke.java
+ */
+import java.util.stream.Stream;
+
+class StaticInvoke {
+ void test() {
+ Stream.empty();
+ java.util.stream.Stream.empty();
+ }
+}
diff --git a/test/tools/javac/defaultMethods/static/StaticInvoke6.out b/test/tools/javac/defaultMethods/static/StaticInvoke6.out
new file mode 100644
index 00000000..947d3ab4
--- /dev/null
+++ b/test/tools/javac/defaultMethods/static/StaticInvoke6.out
@@ -0,0 +1,3 @@
+StaticInvoke.java:12:15: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.6
+StaticInvoke.java:13:32: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.6
+2 errors
diff --git a/test/tools/javac/defaultMethods/static/StaticInvoke7.out b/test/tools/javac/defaultMethods/static/StaticInvoke7.out
new file mode 100644
index 00000000..1a2f58db
--- /dev/null
+++ b/test/tools/javac/defaultMethods/static/StaticInvoke7.out
@@ -0,0 +1,3 @@
+StaticInvoke.java:12:15: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.7
+StaticInvoke.java:13:32: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.7
+2 errors
diff --git a/test/tools/javac/generics/wildcards/T8034147.java b/test/tools/javac/generics/wildcards/T8034147.java
new file mode 100644
index 00000000..4baade1e
--- /dev/null
+++ b/test/tools/javac/generics/wildcards/T8034147.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014, 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 8034147
+ * @summary javac crashes with a NullPointerException during bounds checking
+ * @compile T8034147.java
+ */
+
+class T8034147 {
+ static class One<X extends Two<? super X>> {}
+ static class Two<Y extends Three<? extends Y>> implements Three<Y> {}
+ interface Three<Z> {}
+}
diff --git a/test/tools/javac/lambda/LambdaTestStrictFP.java b/test/tools/javac/lambda/LambdaTestStrictFP.java
new file mode 100644
index 00000000..67e247e4
--- /dev/null
+++ b/test/tools/javac/lambda/LambdaTestStrictFP.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014, 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 8046060
+ * @summary Different results of floating point multiplication for lambda code block
+ */
+
+strictfp
+public class LambdaTestStrictFP {
+
+ static double fld = eval(() -> {
+ double x = Double.longBitsToDouble(0x1e7ee00000000000L);
+ double y = Double.longBitsToDouble(0x2180101010101010L);
+
+ return x * y;
+ });
+
+ public static void main(String args[]) {
+ double result = eval(() -> {
+ double x = Double.longBitsToDouble(0x1e7ee00000000000L);
+ double y = Double.longBitsToDouble(0x2180101010101010L);
+
+ return x * y;
+ });
+ {
+ double x = Double.longBitsToDouble(0x1e7ee00000000000L);
+ double y = Double.longBitsToDouble(0x2180101010101010L);
+
+ double z = x * y;
+ check(z, result, "method");
+ check(z, fld, "field");
+ }
+ }
+
+ private static void check(double expected, double got, String where) {
+ if (got != expected) {
+ throw new AssertionError(where + ": Non-strictfp " + got + " != " + expected);
+ }
+ }
+
+ private static double eval(Face arg) {
+ return arg.m();
+ }
+
+ private interface Face {
+ double m();
+ }
+}
diff --git a/test/tools/javac/lambda/LambdaTestStrictFPFlag.java b/test/tools/javac/lambda/LambdaTestStrictFPFlag.java
new file mode 100644
index 00000000..dc1cccd6
--- /dev/null
+++ b/test/tools/javac/lambda/LambdaTestStrictFPFlag.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014, 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 8046060
+ * @summary Different results of floating point multiplication for lambda code block
+ */
+
+import java.io.*;
+import java.net.URL;
+import com.sun.tools.classfile.*;
+import static com.sun.tools.classfile.AccessFlags.ACC_STRICT;
+
+public class LambdaTestStrictFPFlag {
+ public static void main(String[] args) throws Exception {
+ new LambdaTestStrictFPFlag().run();
+ }
+
+ void run() throws Exception {
+ ClassFile cf = getClassFile("LambdaTestStrictFPFlag$Test.class");
+ ConstantPool cp = cf.constant_pool;
+ boolean found = false;
+ for (Method meth: cf.methods) {
+ if (meth.getName(cp).startsWith("lambda$")) {
+ if ((meth.access_flags.flags & ACC_STRICT) == 0) {
+ throw new Exception("strict flag missing from lambda");
+ }
+ found = true;
+ }
+ }
+ if (!found) {
+ throw new Exception("did not find lambda method");
+ }
+ }
+
+ ClassFile getClassFile(String name) throws IOException, ConstantPoolException {
+ URL url = getClass().getResource(name);
+ InputStream in = url.openStream();
+ try {
+ return ClassFile.read(in);
+ } finally {
+ in.close();
+ }
+ }
+
+ class Test {
+ strictfp void test() {
+ Face itf = () -> { };
+ }
+ }
+
+ interface Face {
+ void m();
+ }
+}
diff --git a/test/tools/javac/lambda/LambdaTestStrictFPMethod.java b/test/tools/javac/lambda/LambdaTestStrictFPMethod.java
new file mode 100644
index 00000000..e8a03ebc
--- /dev/null
+++ b/test/tools/javac/lambda/LambdaTestStrictFPMethod.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, 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 8046060
+ * @summary Different results of floating point multiplication for lambda code block
+ */
+
+public class LambdaTestStrictFPMethod {
+
+ public static void main(String args[]) {
+ new LambdaTestStrictFPMethod().test();
+ }
+
+ strictfp void test() {
+ double result = eval(() -> {
+ double x = Double.longBitsToDouble(0x1e7ee00000000000L);
+ double y = Double.longBitsToDouble(0x2180101010101010L);
+
+ return x * y;
+ });
+ {
+ double x = Double.longBitsToDouble(0x1e7ee00000000000L);
+ double y = Double.longBitsToDouble(0x2180101010101010L);
+
+ double z = x * y;
+ check(z, result, "method");
+ }
+ }
+
+ strictfp void check(double expected, double got, String where) {
+ if (got != expected) {
+ throw new AssertionError(where + ": Non-strictfp " + got + " != " + expected);
+ }
+ }
+
+ static double eval(Face arg) {
+ return arg.m();
+ }
+
+ interface Face {
+ double m();
+ }
+}
diff --git a/test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.java b/test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.java
new file mode 100644
index 00000000..51895dc3
--- /dev/null
+++ b/test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.java
@@ -0,0 +1,24 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8038182
+ * @summary javac crash with FunctionDescriptorLookupError for invalid functional interface
+ * @compile/fail/ref=CrashFunctionDescriptorExceptionTest.out -XDrawDiagnostics CrashFunctionDescriptorExceptionTest.java
+ */
+
+class CrashFunctionDescriptorExceptionTest {
+
+ @SuppressWarnings("unchecked")
+ void m () {
+ bar((B b) -> {});
+ }
+
+ <E extends A<E>> void bar(I<E> i) {}
+
+ class A<E> {}
+
+ class B<E> extends A<E> {}
+
+ interface I<E extends A<E>> {
+ void foo(E e);
+ }
+}
diff --git a/test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.out b/test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.out
new file mode 100644
index 00000000..19f5569a
--- /dev/null
+++ b/test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.out
@@ -0,0 +1,2 @@
+CrashFunctionDescriptorExceptionTest.java:12:13: compiler.err.prob.found.req: (compiler.misc.no.suitable.functional.intf.inst: CrashFunctionDescriptorExceptionTest.I<CrashFunctionDescriptorExceptionTest.B>)
+1 error
diff --git a/test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.java b/test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.java
new file mode 100644
index 00000000..07f14efc
--- /dev/null
+++ b/test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.java
@@ -0,0 +1,33 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8042759
+ * @summary Lambda returning implicitly-typed lambdas considered pertinent to applicability
+ * @compile/fail/ref=ImplicitLambdaConsideredForApplicabilityTest.out -XDrawDiagnostics ImplicitLambdaConsideredForApplicabilityTest.java
+ */
+
+abstract class ImplicitLambdaConsideredForApplicabilityTest {
+ interface A {
+ B m(int a, int b);
+ }
+
+ interface C {
+ String m(int a, int b);
+ }
+
+ interface B {
+ int m(int c);
+ }
+
+ abstract void foo(A a);
+
+ abstract void foo(C c);
+
+ void bar() {
+ foo((int a, int b) -> {
+ if(a < b)
+ return c -> 0;
+ else
+ return c -> 0;
+ });
+ }
+}
diff --git a/test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.out b/test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.out
new file mode 100644
index 00000000..d62ac05b
--- /dev/null
+++ b/test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.out
@@ -0,0 +1,2 @@
+ImplicitLambdaConsideredForApplicabilityTest.java:26:9: compiler.err.ref.ambiguous: foo, kindname.method, foo(ImplicitLambdaConsideredForApplicabilityTest.A), ImplicitLambdaConsideredForApplicabilityTest, kindname.method, foo(ImplicitLambdaConsideredForApplicabilityTest.C), ImplicitLambdaConsideredForApplicabilityTest
+1 error
diff --git a/test/tools/javac/missingSuperRecovery/MissingInterfaceTest.java b/test/tools/javac/missingSuperRecovery/MissingInterfaceTest.java
new file mode 100644
index 00000000..d71df066
--- /dev/null
+++ b/test/tools/javac/missingSuperRecovery/MissingInterfaceTest.java
@@ -0,0 +1,15 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8036007
+ * @summary javac crashes when encountering an unresolvable interface
+ * @build MissingInterfaceTestDep
+ * @clean Closeable
+ * @compile/fail/ref=MissingInterfaceTest.out -XDrawDiagnostics MissingInterfaceTest.java
+ */
+
+public class MissingInterfaceTest {
+ void test(MissingInterfaceTestDep s) {
+ s.call();
+ s.another();
+ }
+}
diff --git a/test/tools/javac/missingSuperRecovery/MissingInterfaceTest.out b/test/tools/javac/missingSuperRecovery/MissingInterfaceTest.out
new file mode 100644
index 00000000..0956ba6f
--- /dev/null
+++ b/test/tools/javac/missingSuperRecovery/MissingInterfaceTest.out
@@ -0,0 +1,3 @@
+MissingInterfaceTest.java:12:10: compiler.err.cant.access: Closeable, (compiler.misc.class.file.not.found: Closeable)
+MissingInterfaceTest.java:13:10: compiler.err.cant.resolve.location.args: kindname.method, another, , , (compiler.misc.location.1: kindname.variable, s, MissingInterfaceTestDep)
+2 errors
diff --git a/test/tools/javac/missingSuperRecovery/MissingInterfaceTestDep.java b/test/tools/javac/missingSuperRecovery/MissingInterfaceTestDep.java
new file mode 100644
index 00000000..b8379d9f
--- /dev/null
+++ b/test/tools/javac/missingSuperRecovery/MissingInterfaceTestDep.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+public class MissingInterfaceTestDep implements Intermediate {}
+interface Intermediate extends Closeable { }
+interface Closeable {}
diff --git a/test/tools/javac/processing/model/element/TestTypeParameterAnnotations.java b/test/tools/javac/processing/model/element/TestTypeParameterAnnotations.java
index d0b5cc8e..1b6e26f4 100644
--- a/test/tools/javac/processing/model/element/TestTypeParameterAnnotations.java
+++ b/test/tools/javac/processing/model/element/TestTypeParameterAnnotations.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8011027
+ * @bug 8011027 8046916
* @library /tools/javac/lib
* @build JavacTestingAbstractProcessor TestTypeParameterAnnotations
* @compile -processor TestTypeParameterAnnotations -proc:only TestTypeParameterAnnotations.java
@@ -33,10 +33,16 @@ import java.util.*;
import java.lang.annotation.*;
import javax.annotation.processing.*;
import javax.lang.model.element.*;
-import javax.lang.model.util.*;
import javax.tools.*;
-public class TestTypeParameterAnnotations<@Foo @Bar @Baz T> extends JavacTestingAbstractProcessor {
+@ExpectedTypeParameterAnnotations(typeParameterName="T1",
+ annotations={"Foo1", "Bar1", "Baz1"})
+@ExpectedTypeParameterAnnotations(typeParameterName="T2", annotations={})
+@ExpectedTypeParameterAnnotations(typeParameterName="T3",
+ annotations={"Foo2", "Bar2", "Baz2"})
+@ExpectedTypeParameterAnnotations(typeParameterName="T4", annotations={})
+public class TestTypeParameterAnnotations<@Foo1 @Bar1 @Baz1 T1, T2, @Foo2 @Bar2 @Baz2 T3, T4> extends
+ JavacTestingAbstractProcessor {
int round = 0;
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
@@ -74,82 +80,69 @@ public class TestTypeParameterAnnotations<@Foo @Bar @Baz T> extends JavacTesting
int check(Element e, List<? extends TypeParameterElement> typarams) {
if (typarams.isEmpty())
return 0;
- if (typarams.size() != 1)
- return 0;
- for (TypeParameterElement tpe: typarams) {
- boolean b1 = checkAnnotationMirrors(tpe, tpe.getAnnotationMirrors());
- boolean b2 = checkAnnotationMirrors(tpe, elements.getAllAnnotationMirrors(tpe));
- boolean b3 = checkGetAnnotation(tpe);
- boolean b4 = checkGetAnnotations(tpe);
- return b1 && b2 && b3 && b4 ? 1 : 0;
+ for (TypeParameterElement tpe : typarams) {
+ ExpectedTypeParameterAnnotations expected = null;
+ for (ExpectedTypeParameterAnnotations a : e.getAnnotationsByType(ExpectedTypeParameterAnnotations.class)) {
+ if (tpe.getSimpleName().contentEquals(a.typeParameterName())) {
+ expected = a;
+ break;
+ }
+ }
+ if (expected == null) {
+ throw new IllegalStateException("Does not have expected values annotation.");
+ }
+ checkAnnotationMirrors(tpe, tpe.getAnnotationMirrors(), expected);
+ checkAnnotationMirrors(tpe, elements.getAllAnnotationMirrors(tpe), expected);
+ checkGetAnnotation(tpe, expected);
+ checkGetAnnotations(tpe, expected);
}
- return 0;
+
+ return typarams.size();
}
- boolean checkAnnotationMirrors(TypeParameterElement tpe, List<? extends AnnotationMirror> l) {
- if (l.size() != 3) {
- error("To few annotations, got " + l.size() +
- ", should be 3", tpe);
- return false;
- }
+ void checkAnnotationMirrors(TypeParameterElement tpe, List<? extends AnnotationMirror> l, ExpectedTypeParameterAnnotations expected) {
+ String[] expectedAnnotations = expected.annotations();
- AnnotationMirror m = l.get(0);
- if (!m.getAnnotationType().asElement().equals(elements.getTypeElement("Foo"))) {
- error("Wrong type of annotation, was expecting @Foo", m.getAnnotationType().asElement());
- return false;
- }
- m = l.get(1);
- if (!m.getAnnotationType().asElement().equals(elements.getTypeElement("Bar"))) {
- error("Wrong type of annotation, was expecting @Bar", m.getAnnotationType().asElement());
- return false;
+ if (l.size() != expectedAnnotations.length) {
+ error("Incorrect number of annotations, got " + l.size() +
+ ", should be " + expectedAnnotations.length, tpe);
+ return ;
}
- m = l.get(2);
- if (!m.getAnnotationType().asElement().equals(elements.getTypeElement("Baz"))) {
- error("Wrong type of annotation, was expecting @Baz", m.getAnnotationType().asElement());
- return false;
+
+ for (int i = 0; i < expectedAnnotations.length; i++) {
+ AnnotationMirror m = l.get(i);
+ if (!m.getAnnotationType().asElement().equals(elements.getTypeElement(expectedAnnotations[i]))) {
+ error("Wrong type of annotation, was expecting @Foo", m.getAnnotationType().asElement());
+ return ;
+ }
}
- return true;
}
- boolean checkGetAnnotation(TypeParameterElement tpe) {
- Foo f = tpe.getAnnotation(Foo.class);
- if (f == null)
- error("Expecting @Foo to be present in getAnnotation()", tpe);
-
- Bar b = tpe.getAnnotation(Bar.class);
- if (b == null)
- error("Expecting @Bar to be present in getAnnotation()", tpe);
+ void checkGetAnnotation(TypeParameterElement tpe, ExpectedTypeParameterAnnotations expected) {
+ List<String> expectedAnnotations = Arrays.asList(expected.annotations());
- Baz z = tpe.getAnnotation(Baz.class);
- if (z == null)
- error("Expecting @Baz to be present in getAnnotation()", tpe);
+ for (Class<? extends Annotation> c : ALL_ANNOTATIONS) {
+ Object a = tpe.getAnnotation(c);
- return f != null &&
- b != null &&
- z != null;
+ if (a != null ^ expectedAnnotations.indexOf(c.getName()) != (-1)) {
+ error("Unexpected behavior for " + c.getName(), tpe);
+ return ;
+ }
+ }
}
- boolean checkGetAnnotations(TypeParameterElement tpe) {
- Foo[] f = tpe.getAnnotationsByType(Foo.class);
- if (f.length != 1) {
- error("Expecting 1 @Foo to be present in getAnnotationsByType()", tpe);
- return false;
- }
+ void checkGetAnnotations(TypeParameterElement tpe, ExpectedTypeParameterAnnotations expected) {
+ List<String> expectedAnnotations = Arrays.asList(expected.annotations());
- Bar[] b = tpe.getAnnotationsByType(Bar.class);
- if (b.length != 1) {
- error("Expecting 1 @Bar to be present in getAnnotationsByType()", tpe);
- return false;
- }
+ for (Class<? extends Annotation> c : ALL_ANNOTATIONS) {
+ Object[] a = tpe.getAnnotationsByType(c);
- Baz[] z = tpe.getAnnotationsByType(Baz.class);
- if (z.length != 1) {
- error("Expecting 1 @Baz to be present in getAnnotationsByType()", tpe);
- return false;
+ if (a.length > 0 ^ expectedAnnotations.indexOf(c.getName()) != (-1)) {
+ error("Unexpected behavior for " + c.getName(), tpe);
+ return ;
+ }
}
-
- return true;
}
void note(String msg) {
@@ -168,23 +161,71 @@ public class TestTypeParameterAnnotations<@Foo @Bar @Baz T> extends JavacTesting
messager.printMessage(Diagnostic.Kind.ERROR, msg);
}
- // additional generic elements to test
- <@Foo @Bar @Baz X> X m(X x) { return x; }
-
- interface Intf<@Foo @Bar @Baz X> { X m() ; }
+ Class<? extends Annotation>[] ALL_ANNOTATIONS = new Class[] {
+ Foo1.class, Bar1.class, Baz1.class,
+ Foo2.class, Bar2.class, Baz2.class,
+ };
- class Class<@Foo @Bar @Baz X> {
- <@Foo @Bar @Baz Y> Class() { }
+ // additional generic elements to test
+ @ExpectedTypeParameterAnnotations(typeParameterName="W",
+ annotations={"Foo1", "Bar1", "Baz1"})
+ @ExpectedTypeParameterAnnotations(typeParameterName="X", annotations={})
+ @ExpectedTypeParameterAnnotations(typeParameterName="Y",
+ annotations={"Foo2", "Bar2", "Baz2"})
+ @ExpectedTypeParameterAnnotations(typeParameterName="Z", annotations={})
+ <@Foo1 @Bar1 @Baz1 W, X, @Foo2 @Bar2 @Baz2 Y, Z> X m(X x) { return x; }
+
+ @ExpectedTypeParameterAnnotations(typeParameterName="W",
+ annotations={"Foo1", "Bar1", "Baz1"})
+ @ExpectedTypeParameterAnnotations(typeParameterName="X", annotations={})
+ @ExpectedTypeParameterAnnotations(typeParameterName="Y",
+ annotations={"Foo2", "Bar2", "Baz2"})
+ @ExpectedTypeParameterAnnotations(typeParameterName="Z", annotations={})
+ interface Intf<@Foo1 @Bar1 @Baz1 W, X, @Foo2 @Bar2 @Baz2 Y, Z> { X m() ; }
+
+ @ExpectedTypeParameterAnnotations(typeParameterName="W",
+ annotations={"Foo1", "Bar1", "Baz1"})
+ @ExpectedTypeParameterAnnotations(typeParameterName="X", annotations={})
+ @ExpectedTypeParameterAnnotations(typeParameterName="Y",
+ annotations={"Foo2", "Bar2", "Baz2"})
+ @ExpectedTypeParameterAnnotations(typeParameterName="Z", annotations={})
+ class Clazz<@Foo1 @Bar1 @Baz1 W, X, @Foo2 @Bar2 @Baz2 Y, Z> {
+ @ExpectedTypeParameterAnnotations(typeParameterName="W",
+ annotations={"Foo1", "Bar1", "Baz1"})
+ @ExpectedTypeParameterAnnotations(typeParameterName="X", annotations={})
+ @ExpectedTypeParameterAnnotations(typeParameterName="Y",
+ annotations={"Foo2", "Bar2", "Baz2"})
+ @ExpectedTypeParameterAnnotations(typeParameterName="Z", annotations={})
+ <@Foo1 @Bar1 @Baz1 W, X, @Foo2 @Bar2 @Baz2 Y, Z> Clazz() { }
}
- final int expect = 5; // top level class, plus preceding examples
+ final int expect = 5 * 4; // top level class, plus preceding examples, 4 type variables each
}
@Target(ElementType.TYPE_PARAMETER)
-@interface Foo {}
+@interface Foo1 {}
+
+@Target(ElementType.TYPE_PARAMETER)
+@interface Bar1 {}
@Target(ElementType.TYPE_PARAMETER)
-@interface Bar {}
+@interface Baz1 {}
@Target(ElementType.TYPE_PARAMETER)
-@interface Baz {}
+@interface Foo2 {}
+
+@Target(ElementType.TYPE_PARAMETER)
+@interface Bar2 {}
+
+@Target(ElementType.TYPE_PARAMETER)
+@interface Baz2 {}
+
+@Repeatable(ExpectedTypeParameterAnnotationsCollection.class)
+@interface ExpectedTypeParameterAnnotations {
+ public String typeParameterName();
+ public String[] annotations();
+}
+
+@interface ExpectedTypeParameterAnnotationsCollection {
+ public ExpectedTypeParameterAnnotations[] value();
+}
diff --git a/test/tools/javac/varargs/6313164/T6313164.java b/test/tools/javac/varargs/6313164/T6313164.java
index 3e828453..7df40d0f 100644
--- a/test/tools/javac/varargs/6313164/T6313164.java
+++ b/test/tools/javac/varargs/6313164/T6313164.java
@@ -1,18 +1,26 @@
/*
* @test /nodynamiccopyright/
- * @bug 6313164
+ * @bug 6313164 8036953
* @author mcimadamore
* @summary javac generates code that fails byte code verification for the varargs feature
- * @compile/fail/ref=T6313164.out -XDrawDiagnostics T6313164.java
+ * @compile/fail/ref=T6313164Source7.out -source 7 -XDrawDiagnostics T6313164.java
+ * @compile/fail/ref=T6313164Source8AndHigher.out -XDrawDiagnostics T6313164.java
*/
import p1.*;
class T6313164 {
- { B b = new B();
- b.foo1(new B(), new B()); //error - A not accesible
- b.foo2(new B(), new B()); //ok - A not accessible, but foo2(Object...) applicable
- b.foo3(null, null); //error - A (inferred) not accesible
- b.foo4(null, null); //error - A (inferred in 15.12.2.8 - no resolution backtrack) not accesible
- b.foo4(new B(), new C()); //ok - A (inferred in 15.12.2.7) not accessible, but foo4(Object...) applicable
+ {
+ B b = new B();
+ b.foo1(new B(), new B()); //error - A not accessible
+ /* 7 : ok - A not accessible, but foo2(Object...) applicable
+ * 8+ : error - A not accessible
+ */
+ b.foo2(new B(), new B());
+ b.foo3(null, null); //error - A (inferred) not accessible
+ b.foo4(null, null); //error - A not accesible
+ /* 7 : ok - A not accessible, but foo4(Object...) applicable
+ * 8+ : error - A not accessible
+ */
+ b.foo4(new B(), new C());
}
}
diff --git a/test/tools/javac/varargs/6313164/T6313164.out b/test/tools/javac/varargs/6313164/T6313164.out
deleted file mode 100644
index 7b2de272..00000000
--- a/test/tools/javac/varargs/6313164/T6313164.out
+++ /dev/null
@@ -1,6 +0,0 @@
-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)
-T6313164.java:14:13: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
-T6313164.java:15:13: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
-- compiler.note.unchecked.filename: B.java
-- compiler.note.unchecked.recompile
-3 errors
diff --git a/test/tools/javac/varargs/6313164/T6313164Source7.out b/test/tools/javac/varargs/6313164/T6313164Source7.out
new file mode 100644
index 00000000..8c12e727
--- /dev/null
+++ b/test/tools/javac/varargs/6313164/T6313164Source7.out
@@ -0,0 +1,6 @@
+- compiler.warn.source.no.bootclasspath: 1.7
+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)
+T6313164.java:19:15: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
+T6313164.java:20:15: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
+3 errors
+1 warning
diff --git a/test/tools/javac/varargs/6313164/T6313164Source8AndHigher.out b/test/tools/javac/varargs/6313164/T6313164Source8AndHigher.out
new file mode 100644
index 00000000..0257a5d5
--- /dev/null
+++ b/test/tools/javac/varargs/6313164/T6313164Source8AndHigher.out
@@ -0,0 +1,6 @@
+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)
+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)
+T6313164.java:19:15: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
+T6313164.java:20:15: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
+T6313164.java:24:15: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: p1.A, kindname.class, T6313164)
+5 errors
diff --git a/test/tools/javac/varargs/6313164/T7175433.java b/test/tools/javac/varargs/6313164/T7175433.java
index b4627eb7..4384cf5d 100644
--- a/test/tools/javac/varargs/6313164/T7175433.java
+++ b/test/tools/javac/varargs/6313164/T7175433.java
@@ -1,31 +1,8 @@
/*
- * Copyright (c) 2012, 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
+ * @test /nodynamiccopyright/
* @bug 7175433 6313164
* @summary Inference cleanup: add helper class to handle inference variables
- *
+ * @compile/fail/ref=T7175433.out -XDrawDiagnostics T7175433.java
*/
import java.util.List;
@@ -34,26 +11,16 @@ class Bar {
private class Foo { }
- <Z> List<Z> m(Object... o) { T7175433.assertTrue(true); return null; }
- <Z> List<Z> m(Foo... o) { T7175433.assertTrue(false); return null; }
+ <Z> List<Z> m(Object... o) { return null; }
+ <Z> List<Z> m(Foo... o) { return null; }
Foo getFoo() { return null; }
}
public class T7175433 {
- static int assertionCount;
-
- static void assertTrue(boolean b) {
- assertionCount++;
- if (!b) {
- throw new AssertionError();
- }
- }
-
public static void main(String[] args) {
Bar b = new Bar();
b.m(b.getFoo());
- assertTrue(assertionCount == 1);
}
}
diff --git a/test/tools/javac/varargs/6313164/T7175433.out b/test/tools/javac/varargs/6313164/T7175433.out
new file mode 100644
index 00000000..598f3bb5
--- /dev/null
+++ b/test/tools/javac/varargs/6313164/T7175433.out
@@ -0,0 +1,2 @@
+T7175433.java:24:12: compiler.err.prob.found.req: (compiler.misc.inaccessible.varargs.type: Bar.Foo, kindname.class, T7175433)
+1 error
diff --git a/test/tools/javac/varargs/6313164/p1/B.java b/test/tools/javac/varargs/6313164/p1/B.java
index 38ec371c..ebe7ba99 100644
--- a/test/tools/javac/varargs/6313164/p1/B.java
+++ b/test/tools/javac/varargs/6313164/p1/B.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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
@@ -23,13 +23,12 @@
package p1;
+@SuppressWarnings("unchecked")
public class B extends A {
- public B() {}
public void foo1(A... args) { }
public void foo2(A... args) { }
public void foo2(Object... args) { }
public <X extends A> void foo3(X... args) { }
public <X extends A> void foo4(X... args) { }
public void foo4(Object... args) { }
-
}