Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit 739bbd0

Browse files
lgxbslgxVicente Romero
authored and
Vicente Romero
committedJan 29, 2021
8260566: Pattern type X is a subtype of expression type Y message is incorrect
Reviewed-by: jlahoda, tvaleev
1 parent b2e582a commit 739bbd0

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed
 

‎src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3956,7 +3956,7 @@ public void visitTypeTest(JCInstanceOf tree) {
39563956
clazztype = tree.pattern.type;
39573957
if (types.isSubtype(exprtype, clazztype) &&
39583958
!exprtype.isErroneous() && !clazztype.isErroneous()) {
3959-
log.error(tree.pos(), Errors.InstanceofPatternNoSubtype(clazztype, exprtype));
3959+
log.error(tree.pos(), Errors.InstanceofPatternNoSubtype(exprtype, clazztype));
39603960
}
39613961
JCBindingPattern pattern = (JCBindingPattern) tree.pattern;
39623962
typeTree = pattern.var.vartype;

‎src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ compiler.err.instanceof.reifiable.not.safe=\
14131413

14141414
# 0: type, 1: type
14151415
compiler.err.instanceof.pattern.no.subtype=\
1416-
pattern type {0} is a subtype of expression type {1}
1416+
expression type {0} is a subtype of pattern type {1}
14171417

14181418
# 0: symbol
14191419
compiler.misc.varargs.trustme.on.non.varargs.meth=\

‎test/langtools/tools/javac/patterns/NoSubtypeCheck.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
NoSubtypeCheck.java:10:24: compiler.err.instanceof.pattern.no.subtype: java.lang.Object, java.lang.Object
2-
NoSubtypeCheck.java:12:24: compiler.err.instanceof.pattern.no.subtype: java.lang.Object, java.lang.String
2+
NoSubtypeCheck.java:12:24: compiler.err.instanceof.pattern.no.subtype: java.lang.String, java.lang.Object
33
NoSubtypeCheck.java:13:24: compiler.err.instanceof.pattern.no.subtype: java.lang.String, java.lang.String
44
NoSubtypeCheck.java:14:24: compiler.err.instanceof.pattern.no.subtype: NoSubtypeCheck.List<java.lang.String>, NoSubtypeCheck.List<java.lang.String>
55
NoSubtypeCheck.java:16:22: compiler.err.cant.resolve.location: kindname.variable, undef, , , (compiler.misc.location: kindname.class, NoSubtypeCheck, null)
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
NullsInPatterns.java:12:18: compiler.err.instanceof.pattern.no.subtype: java.util.List, compiler.misc.type.null
2-
NullsInPatterns.java:23:18: compiler.err.instanceof.pattern.no.subtype: java.util.List<?>, compiler.misc.type.null
1+
NullsInPatterns.java:12:18: compiler.err.instanceof.pattern.no.subtype: compiler.misc.type.null, java.util.List
2+
NullsInPatterns.java:23:18: compiler.err.instanceof.pattern.no.subtype: compiler.misc.type.null, java.util.List<?>
33
2 errors

0 commit comments

Comments
 (0)
This repository has been archived.