Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8251107: [lworld] test lworld-values/TopInterfaceNegativeTest.java is failing #139

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1818,7 +1818,7 @@ public Boolean visitClassType(ClassType t, Type s) {
// Sidecast
if (s.hasTag(CLASS)) {
if ((s.tsym.flags() & INTERFACE) != 0) {
return ((t.tsym.flags() & FINAL) == 0)
return (dynamicTypeMayImplementAdditionalInterfaces(t.tsym))
? sideCast(t, s, warnStack.head)
: sideCastFinal(t, s, warnStack.head);
} else if ((t.tsym.flags() & INTERFACE) != 0) {
@@ -4616,7 +4616,7 @@ private boolean sideCastFinal(Type from, Type to, Warner warn) {
to = from;
from = target;
}
Assert.check((from.tsym.flags() & FINAL) != 0);
Assert.check(!dynamicTypeMayImplementAdditionalInterfaces(from.tsym));
Type t1 = asSuper(from, to.tsym);
if (t1 == null) return false;
Type t2 = to;
@@ -4628,6 +4628,10 @@ private boolean sideCastFinal(Type from, Type to, Warner warn) {
return true;
}

private boolean dynamicTypeMayImplementAdditionalInterfaces(TypeSymbol tsym) {
return (tsym.flags() & FINAL) == 0 && !tsym.isReferenceProjection();
}

private boolean giveWarning(Type from, Type to) {
List<Type> bounds = to.isCompound() ?
directSupertypes(to) : List.of(to);