mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-28 15:51:02 +00:00
8210483: AssertionError in DeferredAttr at setOverloadKind caused by JDK-8203679
Reviewed-by: mcimadamore, vromero
This commit is contained in:
parent
4e74846da8
commit
7afa8e42b6
@ -280,8 +280,9 @@ public class ArgumentAttr extends JCTree.Visitor {
|
||||
if (!res.kind.isResolutionError()) {
|
||||
tree.sym = res;
|
||||
}
|
||||
if (res.kind.isResolutionTargetError() ||
|
||||
res.type != null && res.type.hasTag(FORALL) ||
|
||||
if (res.kind.isResolutionTargetError()) {
|
||||
tree.setOverloadKind(JCMemberReference.OverloadKind.ERROR);
|
||||
} else if (res.type != null && res.type.hasTag(FORALL) ||
|
||||
(res.flags() & Flags.VARARGS) != 0 ||
|
||||
(TreeInfo.isStaticSelector(exprTree, tree.name.table.names) &&
|
||||
exprTree.type.isRaw() && !exprTree.type.hasTag(ARRAY))) {
|
||||
|
||||
@ -169,7 +169,7 @@ public class DeferredAttr extends JCTree.Visitor {
|
||||
@Override
|
||||
public void setOverloadKind(OverloadKind overloadKind) {
|
||||
OverloadKind previous = t.getOverloadKind();
|
||||
if (previous == null) {
|
||||
if (previous == null || previous == OverloadKind.ERROR) {
|
||||
t.setOverloadKind(overloadKind);
|
||||
} else {
|
||||
Assert.check(previous == overloadKind);
|
||||
@ -1240,7 +1240,7 @@ public class DeferredAttr extends JCTree.Visitor {
|
||||
Type descType = types.findDescriptorType(pt);
|
||||
List<Type> freeArgVars = inferenceContext.freeVarsIn(descType.getParameterTypes());
|
||||
if (freeArgVars.nonEmpty() &&
|
||||
tree.getOverloadKind() == JCMemberReference.OverloadKind.OVERLOADED) {
|
||||
tree.getOverloadKind() != JCMemberReference.OverloadKind.UNOVERLOADED) {
|
||||
stuckVars.addAll(freeArgVars);
|
||||
depVars.addAll(inferenceContext.freeVarsIn(descType.getReturnType()));
|
||||
}
|
||||
@ -1305,7 +1305,7 @@ public class DeferredAttr extends JCTree.Visitor {
|
||||
@Override
|
||||
public void visitReference(JCMemberReference tree) {
|
||||
super.visitReference(tree);
|
||||
if (tree.getOverloadKind() == JCMemberReference.OverloadKind.OVERLOADED) {
|
||||
if (tree.getOverloadKind() != JCMemberReference.OverloadKind.UNOVERLOADED) {
|
||||
stuck = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2217,7 +2217,8 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
|
||||
|
||||
public enum OverloadKind {
|
||||
OVERLOADED,
|
||||
UNOVERLOADED
|
||||
UNOVERLOADED,
|
||||
ERROR
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Google LLC. 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 8210483
|
||||
* @summary AssertionError in DeferredAttr at setOverloadKind caused by JDK-8203679
|
||||
* @compile/fail/ref=MethodRefStuck.out -XDrawDiagnostics MethodRefStuck.java
|
||||
*/
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public abstract class MethodRefStuck {
|
||||
public static void main(Stream<String> xs, Optional<String> x) {
|
||||
xs.map(
|
||||
c -> {
|
||||
return new I(x.map(c::equals));
|
||||
});
|
||||
}
|
||||
|
||||
static class I {
|
||||
I(boolean i) {}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
MethodRefStuck.java:38:18: compiler.err.cant.apply.symbol: kindname.constructor, I, boolean, java.util.Optional<java.lang.Boolean>, kindname.class, MethodRefStuck.I, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: U, java.util.Optional<U>, boolean))
|
||||
1 error
|
||||
Loading…
x
Reference in New Issue
Block a user