8007464: Add graph inference support
Add support for more aggressive type-inference scheme Reviewed-by: jjg
This commit is contained in:
parent
9bdfca5e56
commit
1ec5dfafe0
@ -221,7 +221,7 @@ public enum Source {
|
|||||||
public boolean allowIntersectionTypesInCast() {
|
public boolean allowIntersectionTypesInCast() {
|
||||||
return compareTo(JDK1_8) >= 0;
|
return compareTo(JDK1_8) >= 0;
|
||||||
}
|
}
|
||||||
public boolean allowEarlyReturnConstraints() {
|
public boolean allowGraphInference() {
|
||||||
return compareTo(JDK1_8) >= 0;
|
return compareTo(JDK1_8) >= 0;
|
||||||
}
|
}
|
||||||
public boolean allowStructuralMostSpecific() {
|
public boolean allowStructuralMostSpecific() {
|
||||||
|
@ -4152,7 +4152,9 @@ public class Attr extends JCTree.Visitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Type capture(Type type) {
|
private Type capture(Type type) {
|
||||||
return types.capture(type);
|
//do not capture free types
|
||||||
|
return resultInfo.checkContext.inferenceContext().free(type) ?
|
||||||
|
type : types.capture(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateTypeAnnotations(JCTree tree) {
|
private void validateTypeAnnotations(JCTree tree) {
|
||||||
|
@ -234,7 +234,7 @@ public class DeferredAttr extends JCTree.Visitor {
|
|||||||
dt.speculativeCache.put(deferredAttrContext.msym, speculativeTree, deferredAttrContext.phase);
|
dt.speculativeCache.put(deferredAttrContext.msym, speculativeTree, deferredAttrContext.phase);
|
||||||
return speculativeTree.type;
|
return speculativeTree.type;
|
||||||
case CHECK:
|
case CHECK:
|
||||||
Assert.check(dt.mode == AttrMode.SPECULATIVE);
|
Assert.check(dt.mode != null);
|
||||||
return attr.attribTree(dt.tree, dt.env, resultInfo);
|
return attr.attribTree(dt.tree, dt.env, resultInfo);
|
||||||
}
|
}
|
||||||
Assert.error();
|
Assert.error();
|
||||||
@ -242,6 +242,13 @@ public class DeferredAttr extends JCTree.Visitor {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DeferredTypeCompleter dummyCompleter = new DeferredTypeCompleter() {
|
||||||
|
public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
|
||||||
|
Assert.check(deferredAttrContext.mode == AttrMode.CHECK);
|
||||||
|
return dt.tree.type = Type.noType;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The 'mode' in which the deferred type is to be type-checked
|
* The 'mode' in which the deferred type is to be type-checked
|
||||||
*/
|
*/
|
||||||
@ -382,7 +389,7 @@ public class DeferredAttr extends JCTree.Visitor {
|
|||||||
if (!progress) {
|
if (!progress) {
|
||||||
//remove all variables that have already been instantiated
|
//remove all variables that have already been instantiated
|
||||||
//from the list of stuck variables
|
//from the list of stuck variables
|
||||||
inferenceContext.solveAny(inferenceContext.freeVarsIn(List.from(stuckVars)));
|
inferenceContext.solveAny(List.from(stuckVars), warn);
|
||||||
inferenceContext.notifyChange();
|
inferenceContext.notifyChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -431,7 +438,15 @@ public class DeferredAttr extends JCTree.Visitor {
|
|||||||
return true;
|
return true;
|
||||||
case CHECK:
|
case CHECK:
|
||||||
if (stuckVars.nonEmpty()) {
|
if (stuckVars.nonEmpty()) {
|
||||||
|
//stuck expression - see if we can propagate
|
||||||
|
if (deferredAttrContext.parent != emptyDeferredAttrContext &&
|
||||||
|
Type.containsAny(deferredAttrContext.parent.inferenceContext.inferencevars, List.from(stuckVars))) {
|
||||||
|
deferredAttrContext.parent.deferredAttrNodes.add(this);
|
||||||
|
dt.check(resultInfo, List.<Type>nil(), dummyCompleter);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dt.check(resultInfo, stuckVars, basicCompleter);
|
dt.check(resultInfo, stuckVars, basicCompleter);
|
||||||
return true;
|
return true;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1999, 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. Oracle designates this
|
||||||
|
* particular file as subject to the "Classpath" exception as provided
|
||||||
|
* by Oracle in the LICENSE file that accompanied this code.
|
||||||
|
*
|
||||||
|
* 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 com.sun.tools.javac.util;
|
||||||
|
|
||||||
|
/** <p><b>This is NOT part of any supported API.
|
||||||
|
* If you write code that depends on this, you do so at your own risk.
|
||||||
|
* This code and its internal interfaces are subject to change or
|
||||||
|
* deletion without notice.</b>
|
||||||
|
*/
|
||||||
|
public class GraphUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is a basic abstract class for representing a node.
|
||||||
|
* A node is associated with a given data.
|
||||||
|
*/
|
||||||
|
public static abstract class Node<D> {
|
||||||
|
public final D data;
|
||||||
|
|
||||||
|
public Node(D data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Iterable<? extends Node<D>> getDependencies();
|
||||||
|
|
||||||
|
public abstract String printDependency(Node<D> to);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return data.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class specialized Node, by adding elements that are required in order
|
||||||
|
* to perform Tarjan computation of strongly connected components.
|
||||||
|
*/
|
||||||
|
public static abstract class TarjanNode<D> extends Node<D> implements Comparable<TarjanNode<D>> {
|
||||||
|
int index = -1;
|
||||||
|
int lowlink;
|
||||||
|
boolean active;
|
||||||
|
|
||||||
|
public TarjanNode(D data) {
|
||||||
|
super(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Iterable<? extends TarjanNode<D>> getDependencies();
|
||||||
|
|
||||||
|
public int compareTo(TarjanNode<D> o) {
|
||||||
|
return (index < o.index) ? -1 : (index == o.index) ? 0 : 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tarjan's algorithm to determine strongly connected components of a
|
||||||
|
* directed graph in linear time. Works on TarjanNode.
|
||||||
|
*/
|
||||||
|
public static <D, N extends TarjanNode<D>> List<? extends List<? extends N>> tarjan(Iterable<? extends N> nodes) {
|
||||||
|
ListBuffer<List<N>> cycles = ListBuffer.lb();
|
||||||
|
ListBuffer<N> stack = ListBuffer.lb();
|
||||||
|
int index = 0;
|
||||||
|
for (N node: nodes) {
|
||||||
|
if (node.index == -1) {
|
||||||
|
index += tarjan(node, index, stack, cycles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cycles.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <D, N extends TarjanNode<D>> int tarjan(N v, int index, ListBuffer<N> stack, ListBuffer<List<N>> cycles) {
|
||||||
|
v.index = index;
|
||||||
|
v.lowlink = index;
|
||||||
|
index++;
|
||||||
|
stack.prepend(v);
|
||||||
|
v.active = true;
|
||||||
|
for (TarjanNode<D> nd: v.getDependencies()) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
N n = (N)nd;
|
||||||
|
if (n.index == -1) {
|
||||||
|
tarjan(n, index, stack, cycles);
|
||||||
|
v.lowlink = Math.min(v.lowlink, n.lowlink);
|
||||||
|
} else if (stack.contains(n)) {
|
||||||
|
v.lowlink = Math.min(v.lowlink, n.index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (v.lowlink == v.index) {
|
||||||
|
N n;
|
||||||
|
ListBuffer<N> cycle = ListBuffer.lb();
|
||||||
|
do {
|
||||||
|
n = stack.remove();
|
||||||
|
n.active = false;
|
||||||
|
cycle.add(n);
|
||||||
|
} while (n != v);
|
||||||
|
cycles.add(cycle.toList());
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debugging: dot representation of a set of connected nodes. The resulting
|
||||||
|
* dot representation will use {@code Node.toString} to display node labels
|
||||||
|
* and {@code Node.printDependency} to display edge labels. The resulting
|
||||||
|
* representation is also customizable with a graph name and a header.
|
||||||
|
*/
|
||||||
|
public static <D> String toDot(Iterable<? extends TarjanNode<D>> nodes, String name, String header) {
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
buf.append(String.format("digraph %s {\n", name));
|
||||||
|
buf.append(String.format("label = \"%s\";\n", header));
|
||||||
|
//dump nodes
|
||||||
|
for (TarjanNode<D> n : nodes) {
|
||||||
|
buf.append(String.format("%s [label = \"%s\"];\n", n.hashCode(), n.toString()));
|
||||||
|
}
|
||||||
|
//dump arcs
|
||||||
|
for (TarjanNode<D> from : nodes) {
|
||||||
|
for (TarjanNode<D> to : from.getDependencies()) {
|
||||||
|
buf.append(String.format("%s -> %s [label = \" %s \"];\n",
|
||||||
|
from.hashCode(), to.hashCode(), from.printDependency(to)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buf.append("}\n");
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
T6758789b.java:16:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<X>
|
T6758789b.java:16:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<java.lang.Object>
|
||||||
T6758789b.java:16:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo<X>, T6758789a.Foo, kindname.class, T6758789a
|
T6758789b.java:16:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo<X>, T6758789a.Foo, kindname.class, T6758789a
|
||||||
- compiler.err.warnings.and.werror
|
- compiler.err.warnings.and.werror
|
||||||
1 error
|
1 error
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.inferred.do.not.conform.to.upper.bounds: compiler.misc.type.captureof: 1, ?, T6799605<compiler.misc.type.captureof: 1, ?>)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
|
T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.incompatible.eq.upper.bounds: T, compiler.misc.type.captureof: 1, ?, T6799605<T>)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
|
||||||
T6799605.java:18:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 2, ?, compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
|
T6799605.java:18:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 2, ?, compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
|
||||||
T6799605.java:19:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,T6799605<compiler.misc.type.captureof: 3, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 3, ?, compiler.misc.type.captureof: 3, ?,compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?))}
|
T6799605.java:19:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,T6799605<compiler.misc.type.captureof: 3, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 3, ?, compiler.misc.type.captureof: 3, ?,compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?))}
|
||||||
3 errors
|
3 errors
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
// key: compiler.err.prob.found.req
|
// key: compiler.err.prob.found.req
|
||||||
// key: compiler.misc.cant.apply.diamond.1
|
// key: compiler.misc.cant.apply.diamond.1
|
||||||
// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
|
// key: compiler.misc.incompatible.eq.upper.bounds
|
||||||
// key: compiler.misc.diamond
|
// key: compiler.misc.diamond
|
||||||
|
|
||||||
class CantApplyDiamond1<X> {
|
class CantApplyDiamond1<X> {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
// key: compiler.err.cant.apply.symbol
|
// key: compiler.err.cant.apply.symbol
|
||||||
// key: compiler.misc.inferred.do.not.conform.to.eq.bounds
|
// key: compiler.misc.inferred.do.not.conform.to.eq.bounds
|
||||||
|
// options: -source 7 -Xlint:-options
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
// key: compiler.err.cant.apply.symbol
|
// key: compiler.err.cant.apply.symbol
|
||||||
// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
|
// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
|
||||||
|
// options: -source 7 -Xlint:-options
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,7 +24,7 @@
|
|||||||
// key: compiler.misc.where.fresh.typevar
|
// key: compiler.misc.where.fresh.typevar
|
||||||
// key: compiler.misc.where.description.typevar
|
// key: compiler.misc.where.description.typevar
|
||||||
// key: compiler.err.prob.found.req
|
// key: compiler.err.prob.found.req
|
||||||
// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
|
// key: compiler.misc.inconvertible.types
|
||||||
// options: -XDdiags=where,simpleNames
|
// options: -XDdiags=where,simpleNames
|
||||||
// run: simple
|
// run: simple
|
||||||
|
|
||||||
@ -33,5 +33,5 @@ import java.util.*;
|
|||||||
class WhereFreshTvar {
|
class WhereFreshTvar {
|
||||||
<T extends List<T>> T m() {}
|
<T extends List<T>> T m() {}
|
||||||
|
|
||||||
{ List<String> ls = m(); }
|
{ Object o = (List<String>)m(); }
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
T7015430.java:41:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
|
T7015430.java:41:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
|
||||||
T7015430.java:41:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
|
T7015430.java:41:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
|
||||||
T7015430.java:50:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
|
T7015430.java:50:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
|
||||||
T7015430.java:50:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
|
T7015430.java:50:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
|
||||||
T7015430.java:68:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
|
T7015430.java:68:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
|
||||||
T7015430.java:68:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
|
T7015430.java:68:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
|
||||||
T7015430.java:77:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
|
T7015430.java:77:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
|
||||||
T7015430.java:77:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
|
T7015430.java:77:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
|
||||||
T7015430.java:104:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
|
T7015430.java:104:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
|
||||||
T7015430.java:104:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
|
T7015430.java:104:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
|
||||||
T7015430.java:113:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
|
T7015430.java:113:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
|
||||||
T7015430.java:113:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
|
T7015430.java:113:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
|
||||||
T7015430.java:41:14: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
|
T7015430.java:41:14: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
|
||||||
T7015430.java:68:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
|
T7015430.java:68:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
T7151802.java:14:31: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get1, Z, T7151802.Foo, kindname.class, T7151802
|
T7151802.java:14:31: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get1, Z, T7151802.Foo, kindname.class, T7151802
|
||||||
T7151802.java:22:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<Z>
|
T7151802.java:22:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<java.lang.Object>
|
||||||
T7151802.java:22:30: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get3, T7151802.Foo<Z>, T7151802.Foo, kindname.class, T7151802
|
T7151802.java:22:30: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get3, T7151802.Foo<Z>, T7151802.Foo, kindname.class, T7151802
|
||||||
T7151802.java:30:36: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get5, compiler.misc.no.args, compiler.misc.no.args, kindname.class, T7151802
|
T7151802.java:30:36: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get5, compiler.misc.no.args, compiler.misc.no.args, kindname.class, T7151802
|
||||||
T7151802.java:38:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<java.lang.String>
|
T7151802.java:38:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<java.lang.String>
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
Neg06.java:16:37: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number))
|
Neg06.java:16:37: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number))
|
||||||
1 error
|
1 error
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,10 +23,11 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 6278587
|
* @bug 6278587 8007464
|
||||||
* @summary Inference broken for subtypes of subtypes of F-bounded types
|
* @summary Inference broken for subtypes of subtypes of F-bounded types
|
||||||
* @author Peter von der Ah\u00e9
|
* @author Peter von der Ah\u00e9
|
||||||
* @compile/fail T6278587Neg.java
|
* @compile/fail -source 7 T6278587Neg.java
|
||||||
|
* @compile T6278587Neg.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public abstract class T6278587Neg {
|
public abstract class T6278587Neg {
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
T6638712d.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, U,java.util.List<java.util.List<U>>, int,java.util.List<java.util.List<java.lang.String>>, kindname.class, T6638712d, (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.String, java.lang.Integer)
|
T6638712d.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, U,java.util.List<java.util.List<U>>, int,java.util.List<java.util.List<java.lang.String>>, kindname.class, T6638712d, (compiler.misc.incompatible.eq.lower.bounds: U, java.lang.String, java.lang.Integer)
|
||||||
1 error
|
1 error
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Boolean,java.lang.Object)
|
T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Boolean,java.lang.Object)
|
||||||
1 error
|
1 error
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* @test /nodynamiccopyright/
|
* @test /nodynamiccopyright/
|
||||||
* @bug 7154127
|
* @bug 7154127 8007464
|
||||||
* @summary Inference cleanup: remove bound check analysis from visitors in Types.java
|
* @summary Inference cleanup: remove bound check analysis from visitors in Types.java
|
||||||
* @compile/fail/ref=T7154127.out -XDrawDiagnostics T7154127.java
|
* @compile/fail/ref=T7154127.out -Xlint:-options -source 7 -XDrawDiagnostics T7154127.java
|
||||||
|
* @compile T7154127.java
|
||||||
*/
|
*/
|
||||||
class T7154127 {
|
class T7154127 {
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
T7154127.java:19:49: compiler.err.prob.found.req: (compiler.misc.incompatible.upper.bounds: Y, T7154127.B<U>,T7154127.D)
|
T7154127.java:20:49: compiler.err.prob.found.req: (compiler.misc.incompatible.upper.bounds: Y, T7154127.B<U>,T7154127.D)
|
||||||
1 error
|
1 error
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
T7177306a.java:13:34: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List<E>
|
T7177306a.java:13:34: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List<java.lang.Object>
|
||||||
T7177306a.java:13:33: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, java.util.List<E>, java.util.List, kindname.class, T7177306a
|
T7177306a.java:13:33: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, java.util.List<E>, java.util.List, kindname.class, T7177306a
|
||||||
T7177306a.java:13:33: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7177306a, T7177306a<java.lang.Object>
|
T7177306a.java:13:33: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7177306a, T7177306a<java.lang.Object>
|
||||||
- compiler.err.warnings.and.werror
|
- compiler.err.warnings.and.werror
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* @test /nodynamiccopyright/
|
* @test /nodynamiccopyright/
|
||||||
* @bug 7177306
|
* @bug 7177306 8007464
|
||||||
* @summary Regression: unchecked method call does not erase return type
|
* @summary Regression: unchecked method call does not erase return type
|
||||||
* @compile/fail/ref=T7177306e.out -XDrawDiagnostics T7177306e.java
|
* @compile/fail/ref=T7177306e.out -source 7 -Xlint:-options -XDrawDiagnostics T7177306e.java
|
||||||
|
* @compile/fail T7177306e.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
T7177306e.java:15:9: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.util.List<?>, java.util.List<compiler.misc.type.captureof: 1, ?>)
|
T7177306e.java:16:9: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.util.List<?>, java.util.List<compiler.misc.type.captureof: 1, ?>)
|
||||||
1 error
|
1 error
|
||||||
|
@ -23,11 +23,12 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @ bug
|
* @bug 8007464
|
||||||
* @summary Negative regression test from odersky
|
* @summary Negative regression test from odersky
|
||||||
* @author odersky
|
* @author odersky
|
||||||
*
|
*
|
||||||
* @compile/fail BadTest4.java
|
* @compile/fail -source 7 BadTest4.java
|
||||||
|
* @compile BadTest4.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class BadTest4 {
|
class BadTest4 {
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
TargetType14.java:20:29: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.Integer, java.lang.String)
|
TargetType14.java:20:29: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.lower.bounds: X, java.lang.Integer, java.lang.String)
|
||||||
1 error
|
1 error
|
||||||
|
@ -1,10 +1,33 @@
|
|||||||
/*
|
/*
|
||||||
* @test /nodynamiccopyright/
|
* 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 8003280
|
* @bug 8003280
|
||||||
* @summary Add lambda tests
|
* @summary Add lambda tests
|
||||||
* complex case of lambda return type that depends on generic method
|
* complex case of lambda return type that depends on generic method
|
||||||
* inference variable
|
* inference variable
|
||||||
* @compile/fail/ref=TargetType20.out -XDrawDiagnostics TargetType20.java
|
* @compile -XDrawDiagnostics TargetType20.java
|
||||||
*/
|
*/
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
TargetType20.java:19:10: compiler.err.cant.apply.symbol: kindname.method, call, TargetType20.SAM2<Z>,TargetType20.SAM2<Z>, @428,@459, kindname.class, TargetType20.Test, (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.String, java.lang.String,java.lang.Object)
|
|
||||||
1 error
|
|
@ -1,3 +1,2 @@
|
|||||||
TargetType28.java:20:32: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.Number, java.lang.Number,java.lang.String)
|
TargetType28.java:20:32: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String,X, java.lang.Object,java.lang.Number)
|
||||||
TargetType28.java:21:33: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.Number, java.lang.Number,java.lang.Integer)
|
1 error
|
||||||
2 errors
|
|
||||||
|
@ -1,9 +1,32 @@
|
|||||||
/*
|
/*
|
||||||
* @test /nodynamiccopyright/
|
* 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 8003280
|
* @bug 8003280
|
||||||
* @summary Add lambda tests
|
* @summary Add lambda tests
|
||||||
* bad stuck check for method reference leads to javac crash
|
* bad stuck check for method reference leads to javac crash
|
||||||
* @compile/fail/ref=TargetType50.out -XDrawDiagnostics TargetType50.java
|
* @compile TargetType50.java
|
||||||
*/
|
*/
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -17,7 +40,7 @@ class TargetType50 {
|
|||||||
static <Z> Sink<Z> make() { return null; }
|
static <Z> Sink<Z> make() { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
<Y, S extends Sink<Y>> List<Y> m(Factory<S> factory) { }
|
<Y, S extends Sink<Y>> List<Y> m(Factory<S> factory) { return null; }
|
||||||
|
|
||||||
void test() {
|
void test() {
|
||||||
List<?> l1 = m(Sink::new);
|
List<?> l1 = m(Sink::new);
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
TargetType50.java:25:28: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: TargetType50.Sink<java.lang.Object>, TargetType50.Sink<java.lang.String>)
|
|
||||||
TargetType50.java:26:28: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: TargetType50.Sink<java.lang.Object>, TargetType50.Sink<java.lang.String>)
|
|
||||||
2 errors
|
|
@ -23,7 +23,9 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @summary smoke test for combinator-like stuck analysis
|
* @bug 8005244
|
||||||
|
* @summary Implement overload resolution as per latest spec EDR
|
||||||
|
* smoke test for combinator-like stuck analysis
|
||||||
* @author Maurizio Cimadamore
|
* @author Maurizio Cimadamore
|
||||||
* @compile TargetType51.java
|
* @compile TargetType51.java
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* @test /nodynamiccopyright/
|
* @test /nodynamiccopyright/
|
||||||
* @summary uncatched sam conversion failure exception lead to javac crash
|
* @bug 8005244
|
||||||
|
* @summary Implement overload resolution as per latest spec EDR
|
||||||
|
* uncatched sam conversion failure exception lead to javac crash
|
||||||
* @compile/fail/ref=TargetType52.out -XDrawDiagnostics TargetType52.java
|
* @compile/fail/ref=TargetType52.out -XDrawDiagnostics TargetType52.java
|
||||||
*/
|
*/
|
||||||
class TargetType52 {
|
class TargetType52 {
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
TargetType52.java:15:9: compiler.err.cant.apply.symbol: kindname.method, m, TargetType52.FI<? extends java.lang.CharSequence,? extends java.util.ArrayList<? extends java.lang.CharSequence>>, @444, kindname.class, TargetType52, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.no.suitable.functional.intf.inst: TargetType52.FI<java.lang.CharSequence,java.util.ArrayList<? extends java.lang.CharSequence>>))
|
TargetType52.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, TargetType52.FI<? extends java.lang.CharSequence,? extends java.util.ArrayList<? extends java.lang.CharSequence>>, @525, kindname.class, TargetType52, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.no.suitable.functional.intf.inst: TargetType52.FI<java.lang.CharSequence,java.util.ArrayList<? extends java.lang.CharSequence>>))
|
||||||
1 error
|
1 error
|
||||||
|
47
langtools/test/tools/javac/lambda/TargetType53.java
Normal file
47
langtools/test/tools/javac/lambda/TargetType53.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* 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 8007464
|
||||||
|
* @summary Add graph inference support
|
||||||
|
* smoke test for graph inference
|
||||||
|
* @ignore awaits stream API: 800NNNN
|
||||||
|
* @compile TargetType53.java
|
||||||
|
*/
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.*;
|
||||||
|
import java.util.function.*;
|
||||||
|
|
||||||
|
class TargetType53 {
|
||||||
|
|
||||||
|
<P> List<List<P>> perm(List<P> l) { return null; }
|
||||||
|
|
||||||
|
void g(List<List<UnaryOperator<IntStream>>> l) { }
|
||||||
|
|
||||||
|
void test() {
|
||||||
|
List<List<UnaryOperator<IntStream>>> l =
|
||||||
|
perm(Arrays.asList(s -> s.sorted()));
|
||||||
|
g(perm(Arrays.asList(s -> s.sorted())));
|
||||||
|
}
|
||||||
|
}
|
45
langtools/test/tools/javac/lambda/TargetType54.java
Normal file
45
langtools/test/tools/javac/lambda/TargetType54.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* 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 8007464
|
||||||
|
* @summary Add graph inference support
|
||||||
|
* smoke test for graph inference
|
||||||
|
* @ignore awaits stream API: 800NNNN
|
||||||
|
* @compile TargetType54.java
|
||||||
|
*/
|
||||||
|
import java.util.stream.*;
|
||||||
|
import java.util.*;
|
||||||
|
import static java.util.stream.Collectors.*;
|
||||||
|
|
||||||
|
class TargetType54 {
|
||||||
|
void test(Stream<Integer> si) {
|
||||||
|
List<Integer> l1 = si.collect(toList());
|
||||||
|
List<Integer> l2 = si.collect(toCollection(ArrayList::new));
|
||||||
|
m(si.collect(toList()));
|
||||||
|
m(si.collect(toCollection(ArrayList::new)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void m(List<Integer> l) { }
|
||||||
|
}
|
42
langtools/test/tools/javac/lambda/TargetType55.java
Normal file
42
langtools/test/tools/javac/lambda/TargetType55.java
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* 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 8007464
|
||||||
|
* @summary Add graph inference
|
||||||
|
* support smoke test for graph inference
|
||||||
|
* @compile TargetType55.java
|
||||||
|
*/
|
||||||
|
import java.util.function.*;
|
||||||
|
|
||||||
|
class TargetType55 {
|
||||||
|
|
||||||
|
<R> void m(Function<Integer, R> collector) { }
|
||||||
|
|
||||||
|
<T, D> Function<T, Integer> g(D d, BinaryOperator<D> reducer) { return null; }
|
||||||
|
|
||||||
|
public void test() {
|
||||||
|
m(g((Integer)null, (x,y)->1));
|
||||||
|
}
|
||||||
|
}
|
40
langtools/test/tools/javac/lambda/TargetType56.java
Normal file
40
langtools/test/tools/javac/lambda/TargetType56.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* 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 8007464
|
||||||
|
* @summary Add graph inference support
|
||||||
|
* smoke test for graph inference
|
||||||
|
* @compile TargetType56.java
|
||||||
|
*/
|
||||||
|
class TargetType56 {
|
||||||
|
<Z> Z m(Z z) { return null; }
|
||||||
|
|
||||||
|
void test() {
|
||||||
|
double d1 = m(1);
|
||||||
|
double d2 = m((Integer)null);
|
||||||
|
double d3 = m(m(1));
|
||||||
|
double d4 = m(m((Integer)null));
|
||||||
|
}
|
||||||
|
}
|
20
langtools/test/tools/javac/lambda/TargetType57.java
Normal file
20
langtools/test/tools/javac/lambda/TargetType57.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* @test /nodynamiccopyright/
|
||||||
|
* @bug 8007464
|
||||||
|
* @summary Add graph inference support
|
||||||
|
* more smoke tests for graph inference
|
||||||
|
* @compile/fail/ref=TargetType57.out -XDrawDiagnostics TargetType57.java
|
||||||
|
*/
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.*;
|
||||||
|
|
||||||
|
class TargetType57 {
|
||||||
|
|
||||||
|
void test(List<Integer> list) {
|
||||||
|
m(list, s -> s.intValue(), s -> s.nonExistentMethod());
|
||||||
|
}
|
||||||
|
|
||||||
|
<U, R, S_IN, S_OUT> R m(List<S_IN> list,
|
||||||
|
Function<S_IN, S_OUT> f1,
|
||||||
|
Function<S_OUT, R> f2) { return null; }
|
||||||
|
}
|
2
langtools/test/tools/javac/lambda/TargetType57.out
Normal file
2
langtools/test/tools/javac/lambda/TargetType57.out
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
TargetType57.java:14:42: compiler.err.cant.resolve.location.args: kindname.method, nonExistentMethod, , , (compiler.misc.location.1: kindname.variable, s, java.lang.Integer)
|
||||||
|
1 error
|
46
langtools/test/tools/javac/lambda/TargetType58.java
Normal file
46
langtools/test/tools/javac/lambda/TargetType58.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* 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 8007464
|
||||||
|
* @summary Add graph inference support
|
||||||
|
* more smoke tests for graph inference
|
||||||
|
* @ignore awaits stream API: 800NNNN
|
||||||
|
* @compile TargetType58.java
|
||||||
|
*/
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.*;
|
||||||
|
import java.util.stream.*;
|
||||||
|
|
||||||
|
class TargetType58 {
|
||||||
|
|
||||||
|
void test(List<Integer> li) {
|
||||||
|
g(li, s -> s.substream(200), Collections.emptyList());
|
||||||
|
}
|
||||||
|
|
||||||
|
<T, U, S_OUT extends Stream<U>,
|
||||||
|
I extends Iterable<U>> Collection<U> g(Collection<T> coll, Function<Stream<T>, S_OUT> f, I i) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
49
langtools/test/tools/javac/lambda/TargetType59.java
Normal file
49
langtools/test/tools/javac/lambda/TargetType59.java
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* 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 8007464
|
||||||
|
* @summary Add graph inference support
|
||||||
|
* more smoke tests for graph inference
|
||||||
|
* @ignore awaits stream API: 800NNNN
|
||||||
|
* @compile TargetType59.java
|
||||||
|
*/
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.*;
|
||||||
|
import java.util.stream.*;
|
||||||
|
|
||||||
|
class TargetType59 {
|
||||||
|
|
||||||
|
<T, R> Collector<T, R> m(Supplier<? extends R> supplier, BiConsumer<R, T> accumulator) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
<T, C extends Collection<T>> Collector<T,C> test1(Supplier<C> collectionFactory) {
|
||||||
|
return m(collectionFactory, Collection::add);
|
||||||
|
}
|
||||||
|
|
||||||
|
Collector<String, StringBuilder> test2(Supplier<StringBuilder> sb) {
|
||||||
|
return m(sb, StringBuilder::append);
|
||||||
|
}
|
||||||
|
}
|
47
langtools/test/tools/javac/lambda/TargetType61.java
Normal file
47
langtools/test/tools/javac/lambda/TargetType61.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* 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 8007464
|
||||||
|
* @summary Add graph inference support
|
||||||
|
* check that new wildcards inference strategy doesn't run into 7190296
|
||||||
|
* @compile TargetType61.java
|
||||||
|
*/
|
||||||
|
class TargetType61 {
|
||||||
|
|
||||||
|
interface Stream<T> {
|
||||||
|
void forEach(Sink<? super T> sink);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Sink<T> {
|
||||||
|
void put(T t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean add(CharSequence s) { return false; }
|
||||||
|
|
||||||
|
public void addAll(Stream<? extends CharSequence> stream) {
|
||||||
|
stream.forEach(this::add);
|
||||||
|
stream.forEach(e -> { add(e); });
|
||||||
|
}
|
||||||
|
}
|
46
langtools/test/tools/javac/lambda/TargetType62.java
Normal file
46
langtools/test/tools/javac/lambda/TargetType62.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* 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 8007464
|
||||||
|
* @summary Add graph inference support
|
||||||
|
* check that new wildcards inference strategy doesn't run into 7190296
|
||||||
|
* @ignore awaits stream API: 800NNNN
|
||||||
|
* @compile TargetType62.java
|
||||||
|
*/
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.*;
|
||||||
|
import java.util.stream.*;
|
||||||
|
|
||||||
|
class TargetType61 {
|
||||||
|
|
||||||
|
Collector test(Function<Integer, Integer> classifier) {
|
||||||
|
return g(classifier, TreeMap::new, m(HashSet::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
<R> Collector<Integer, R> m(Supplier<R> s) { return null; }
|
||||||
|
|
||||||
|
<T, K, D, M extends Map<K, D>>
|
||||||
|
Collector<T, M> g(Function<T, K> classifier, Supplier<M> mapFactory, Collector<T, D> downstream) { return null; }
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user