Skip to content
Permalink
Browse files
8260566: Pattern type X is a subtype of expression type Y message is …
…incorrect

Reviewed-by: jlahoda, tvaleev
  • Loading branch information
lgxbslgx authored and Vicente Romero committed Jan 29, 2021
1 parent b2e582a commit 739bbd03c552f22981dd3e967a39287fd35b2903
@@ -3956,7 +3956,7 @@ public void visitTypeTest(JCInstanceOf tree) {
clazztype = tree.pattern.type;
if (types.isSubtype(exprtype, clazztype) &&
!exprtype.isErroneous() && !clazztype.isErroneous()) {
log.error(tree.pos(), Errors.InstanceofPatternNoSubtype(clazztype, exprtype));
log.error(tree.pos(), Errors.InstanceofPatternNoSubtype(exprtype, clazztype));
}
JCBindingPattern pattern = (JCBindingPattern) tree.pattern;
typeTree = pattern.var.vartype;
@@ -1413,7 +1413,7 @@ compiler.err.instanceof.reifiable.not.safe=\

# 0: type, 1: type
compiler.err.instanceof.pattern.no.subtype=\
pattern type {0} is a subtype of expression type {1}
expression type {0} is a subtype of pattern type {1}

# 0: symbol
compiler.misc.varargs.trustme.on.non.varargs.meth=\
@@ -1,5 +1,5 @@
NoSubtypeCheck.java:10:24: compiler.err.instanceof.pattern.no.subtype: java.lang.Object, java.lang.Object
NoSubtypeCheck.java:12:24: compiler.err.instanceof.pattern.no.subtype: java.lang.Object, java.lang.String
NoSubtypeCheck.java:12:24: compiler.err.instanceof.pattern.no.subtype: java.lang.String, java.lang.Object
NoSubtypeCheck.java:13:24: compiler.err.instanceof.pattern.no.subtype: java.lang.String, java.lang.String
NoSubtypeCheck.java:14:24: compiler.err.instanceof.pattern.no.subtype: NoSubtypeCheck.List<java.lang.String>, NoSubtypeCheck.List<java.lang.String>
NoSubtypeCheck.java:16:22: compiler.err.cant.resolve.location: kindname.variable, undef, , , (compiler.misc.location: kindname.class, NoSubtypeCheck, null)
@@ -1,3 +1,3 @@
NullsInPatterns.java:12:18: compiler.err.instanceof.pattern.no.subtype: java.util.List, compiler.misc.type.null
NullsInPatterns.java:23:18: compiler.err.instanceof.pattern.no.subtype: java.util.List<?>, compiler.misc.type.null
NullsInPatterns.java:12:18: compiler.err.instanceof.pattern.no.subtype: compiler.misc.type.null, java.util.List
NullsInPatterns.java:23:18: compiler.err.instanceof.pattern.no.subtype: compiler.misc.type.null, java.util.List<?>
2 errors

0 comments on commit 739bbd0

Please sign in to comment.