OpenJDK / amber / amber
changeset 52962:c4892c86354a amber-demo
delta applying patch that renamed __match to match
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/Tokens.java Thu Nov 01 17:45:42 2018 +0100 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/Tokens.java Fri Nov 02 17:21:11 2018 -0400 @@ -145,8 +145,8 @@ INT("int", Tag.NAMED), INTERFACE("interface"), LONG("long", Tag.NAMED), - MATCH("match", Tag.NAMED), - MATCHES("matches", Tag.NAMED), + MATCH("__match", Tag.NAMED), + MATCHES("__matches", Tag.NAMED), NATIVE("native"), NEW("new"), PACKAGE("package"),
--- a/test/langtools/tools/javac/patterns/BindingsTest1.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/BindingsTest1.java Fri Nov 02 17:21:11 2018 -0400 @@ -1,6 +1,6 @@ /* * @test - * @summary Basic tests for bindings from matches + * @summary Basic tests for bindings from __matches * @compile BindingsTest1.java * @run main BindingsTest1 */ @@ -15,34 +15,34 @@ // Test for (e matches P).T = { binding variables in P } - if (o1 matches String s) { + if (o1 __matches String s) { s.length(); } // Test for e1 && e2.T = union(e1.T, e2.T) - if (o1 matches String s && o2 matches Integer in) { + if (o1 __matches String s && o2 __matches Integer in) { s.length(); in.intValue(); } // Test for e1 && e2.F = intersect(e1.F, e2.F) - if (!(o1 matches String s) && !(o1 matches String s)) { + if (!(o1 __matches String s) && !(o1 __matches String s)) { } else { s.length(); } // test for e1&&e2 - include e1.T in e2 - if (o1 matches String s && s.length()>0) { + if (o1 __matches String s && s.length()>0) { System.out.print("done"); } // Test for (e1 || e2).T = intersect(e1.T, e2.T) - if (o1 matches String s || o3 matches String s){ + if (o1 __matches String s || o3 __matches String s){ System.out.println(s); // ? } // Test for (e1 || e2).F = union(e1.F, e2.F) - if (!(o1 matches String s) || !(o3 matches Integer in)){ + if (!(o1 __matches String s) || !(o3 __matches Integer in)){ } else { s.length(); i.intValue(); @@ -50,62 +50,62 @@ // Test for e1||e2 - include e1.F in e2 - if (!(o1 matches String s) || s.length()>0) { + if (!(o1 __matches String s) || s.length()>0) { System.out.println("done"); } // Test for (e1 ? e2 : e3).T contains intersect(e2.T, e3.T) - if (Ktrue() ? o2 matches Integer x : o2 matches Integer x) { + if (Ktrue() ? o2 __matches Integer x : o2 __matches Integer x) { x.intValue(); } // Test for (e1 ? e2 : e3).T contains intersect(e1.T, e3.T) - if (o1 matches String s ? true : o1 matches String s) { + if (o1 __matches String s ? true : o1 __matches String s) { s.length(); } // Test for (e1 ? e2 : e3).T contains intersect(e1.F, e2.T) - if (!(o1 matches String s) ? (o1 matches String s) : true) { + if (!(o1 __matches String s) ? (o1 __matches String s) : true) { s.length(); } // Test for (e1 ? e2 : e3).F contains intersect(e2.F, e3.F) - if (Ktrue() ? !(o2 matches Integer x) : !(o2 matches Integer x)){ + if (Ktrue() ? !(o2 __matches Integer x) : !(o2 __matches Integer x)){ } else { x.intValue(); } // Test for (e1 ? e2 : e3).F contains intersect(e1.T, e3.F) - if (o1 matches String s ? true : !(o1 matches String s)){ + if (o1 __matches String s ? true : !(o1 __matches String s)){ } else { s.length(); } // Test for (e1 ? e2 : e3).F contains intersect(e1.F, e2.F) - if (!(o1 matches String s) ? !(o1 matches String s) : true){ + if (!(o1 __matches String s) ? !(o1 __matches String s) : true){ } else { s.length(); } // Test for e1 ? e2: e3 - include e1.T in e2 - if (o1 matches String s ? s.length()>0 : false) { + if (o1 __matches String s ? s.length()>0 : false) { System.out.println("done"); } // Test for e1 ? e2 : e3 - include e1.F in e3 - if (!(o1 matches String s) ? false : s.length()>0){ + if (!(o1 __matches String s) ? false : s.length()>0){ System.out.println("done"); } // Test for (!e).T = e.F - if (!(!(o1 matches String s) || !(o3 matches Integer in))){ + if (!(!(o1 __matches String s) || !(o3 __matches Integer in))){ s.length(); i.intValue(); } // Test for (!e).F = e.T - if (!(o1 matches String s)) { + if (!(o1 __matches String s)) { } else { s.length();
--- a/test/langtools/tools/javac/patterns/BindingsTest2.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/BindingsTest2.java Fri Nov 02 17:21:11 2018 -0400 @@ -12,103 +12,103 @@ Object o3 = "there"; - if (Ktrue() ? o2 matches Integer x : o2 matches String x) { + if (Ktrue() ? o2 __matches Integer x : o2 __matches String x) { x.intValue(); } - if (Ktrue() ? o2 matches Integer x : true) { + if (Ktrue() ? o2 __matches Integer x : true) { x.intValue(); } - if (o1 matches String s ? true : true) { + if (o1 __matches String s ? true : true) { s.length(); } - if (o1 matches String s ? true : o2 matches Integer s) { + if (o1 __matches String s ? true : o2 __matches Integer s) { s.length(); } - if (o1 matches String s ? true : o2 matches Integer i) { + if (o1 __matches String s ? true : o2 __matches Integer i) { s.length(); } // Test for (e1 ? e2 : e3).T contains intersect(e1.F, e2.T) - if (!(o1 matches String s) ? true : true) { + if (!(o1 __matches String s) ? true : true) { s.length(); } - if (!(o1 matches String s) ? (o2 matches Integer s) : true) { + if (!(o1 __matches String s) ? (o2 __matches Integer s) : true) { s.length(); } - if (!(o1 matches String s) ? (o2 matches Integer i) : true) { + if (!(o1 __matches String s) ? (o2 __matches Integer i) : true) { s.length(); i.intValue(); } - if (!(o1 matches String s) ? (o1 matches String s2) : true) { + if (!(o1 __matches String s) ? (o1 __matches String s2) : true) { s.length(); s2.length(); } // Test for (e1 ? e2 : e3).F contains intersect(e2.F, e3.F) - if (Ktrue() ? !(o2 matches Integer x) : !(o1 matches String x)){ + if (Ktrue() ? !(o2 __matches Integer x) : !(o1 __matches String x)){ } else { x.intValue(); } - if (Ktrue() ? !(o2 matches Integer x) : !(o1 matches String s)){ + if (Ktrue() ? !(o2 __matches Integer x) : !(o1 __matches String s)){ } else { x.intValue(); } - if (Ktrue() ? !(o2 matches Integer x) : !(o2 matches Integer x1)){ + if (Ktrue() ? !(o2 __matches Integer x) : !(o2 __matches Integer x1)){ } else { x.intValue(); x1.intValue(); } - if (Ktrue() ? !(o2 matches Integer x) : false){ + if (Ktrue() ? !(o2 __matches Integer x) : false){ } else { x.intValue(); } // Test for (e1 ? e2 : e3).F contains intersect(e1.T, e3.F) - if (o1 matches String s ? true : !(o2 matches Integer s)){ + if (o1 __matches String s ? true : !(o2 __matches Integer s)){ } else { s.length(); } - if (o1 matches String s ? true : !(o2 matches Integer i)){ + if (o1 __matches String s ? true : !(o2 __matches Integer i)){ } else { s.length(); i.intValue(); } - if (o1 matches String s ? true : !(o2 matches String s1)){ + if (o1 __matches String s ? true : !(o2 __matches String s1)){ } else { s.length(); s1.length(); } // Test for (e1 ? e2 : e3).F contains intersect(e1.F, e2.F) - if (!(o1 matches String s) ? !(o1 matches String s1) : true){ + if (!(o1 __matches String s) ? !(o1 __matches String s1) : true){ } else { s.length(); s1.length(); } - if (!(o1 matches String s) ? !(o2 matches Integer s) : true){ + if (!(o1 __matches String s) ? !(o2 __matches Integer s) : true){ } else { s.length(); } - if (!(o1 matches String s) ? !(o2 matches Integer i) : true){ + if (!(o1 __matches String s) ? !(o2 __matches Integer i) : true){ } else { s.length(); i.intValue(); } // Test for e1 ? e2: e3 - include e1.T in e2 - if (o1 matches String s ? false : s.length()>0) { + if (o1 __matches String s ? false : s.length()>0) { System.out.println("done"); } - if (o1 matches String s ? false : s.intValue!=0) { + if (o1 __matches String s ? false : s.intValue!=0) { System.out.println("done"); } // Test for e1 ? e2 : e3 - include e1.F in e3 - if (!(o1 matches String s) ? s.length()>0 : false){ + if (!(o1 __matches String s) ? s.length()>0 : false){ System.out.println("done"); } - if (!(o1 matches String s) ? s.intValue>0 : false){ + if (!(o1 __matches String s) ? s.intValue>0 : false){ System.out.println("done"); }
--- a/test/langtools/tools/javac/patterns/BindingsTest2.out Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/BindingsTest2.out Fri Nov 02 17:21:11 2018 -0400 @@ -2,11 +2,11 @@ BindingsTest2.java:16:13: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:19:13: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:23:13: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) -BindingsTest2.java:25:33: compiler.err.match.binding.exists.with.different.type +BindingsTest2.java:25:35: compiler.err.match.binding.exists.with.different.type BindingsTest2.java:26:13: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:29:13: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:34:13: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) -BindingsTest2.java:36:36: compiler.err.match.binding.exists.with.different.type +BindingsTest2.java:36:38: compiler.err.match.binding.exists.with.different.type BindingsTest2.java:37:13: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:40:13: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:41:13: compiler.err.cant.resolve.location: kindname.variable, i, , , (compiler.misc.location: kindname.class, BindingsTest2, null) @@ -18,7 +18,7 @@ BindingsTest2.java:60:13: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:61:13: compiler.err.cant.resolve.location: kindname.variable, x1, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:65:13: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, BindingsTest2, null) -BindingsTest2.java:69:33: compiler.err.match.binding.exists.with.different.type +BindingsTest2.java:69:35: compiler.err.match.binding.exists.with.different.type BindingsTest2.java:71:13: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:75:13: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:76:13: compiler.err.cant.resolve.location: kindname.variable, i, , , (compiler.misc.location: kindname.class, BindingsTest2, null) @@ -26,12 +26,12 @@ BindingsTest2.java:81:13: compiler.err.cant.resolve.location: kindname.variable, s1, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:86:13: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:87:13: compiler.err.cant.resolve.location: kindname.variable, s1, , , (compiler.misc.location: kindname.class, BindingsTest2, null) -BindingsTest2.java:89:36: compiler.err.match.binding.exists.with.different.type +BindingsTest2.java:89:38: compiler.err.match.binding.exists.with.different.type BindingsTest2.java:91:13: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:95:13: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) BindingsTest2.java:96:13: compiler.err.cant.resolve.location: kindname.variable, i, , , (compiler.misc.location: kindname.class, BindingsTest2, null) -BindingsTest2.java:100:43: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) -BindingsTest2.java:103:43: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) -BindingsTest2.java:108:38: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) -BindingsTest2.java:111:38: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) +BindingsTest2.java:100:45: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) +BindingsTest2.java:103:45: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) +BindingsTest2.java:108:40: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) +BindingsTest2.java:111:40: compiler.err.cant.resolve.location: kindname.variable, s, , , (compiler.misc.location: kindname.class, BindingsTest2, null) 36 errors
--- a/test/langtools/tools/javac/patterns/CastConversionMatch.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/CastConversionMatch.java Fri Nov 02 17:21:11 2018 -0400 @@ -31,7 +31,7 @@ public class CastConversionMatch { public static void main(String [] args) { Object o = 42; - if (o matches int s) { + if (o __matches int s) { System.out.println("Okay"); } else { throw new AssertionError("broken");
--- a/test/langtools/tools/javac/patterns/ConstantPatternTest1.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/ConstantPatternTest1.java Fri Nov 02 17:21:11 2018 -0400 @@ -36,21 +36,21 @@ // Simple literal constant pattern - if (i matches 42) { + if (i __matches 42) { message(); } else { throw new AssertionError("Broken"); } // Simple constant expression pattern - if (i matches 41+1) { + if (i __matches 41+1) { message(); } else { throw new AssertionError("Broken"); } // Constant expression pattern using a final local - if (i matches constantInt) { + if (i __matches constantInt) { message(); } else { throw new AssertionError("Broken"); @@ -151,21 +151,21 @@ // Simple literal constant pattern - if (d matches 42.0) { + if (d __matches 42.0) { message(); } else { throw new AssertionError("Broken"); } // Simple constant expression pattern - if (d matches 41.0+1.0) { + if (d __matches 41.0+1.0) { message(); } else { throw new AssertionError("Broken"); } // Constant expression pattern using a final local - if (d matches constant) { + if (d __matches constant) { message(); } else { throw new AssertionError("Broken"); @@ -261,21 +261,21 @@ final String hello = "Hello"; // Simple literal constant pattern - if (s matches "Hello") { + if (s __matches "Hello") { message(); } else { throw new AssertionError("Broken"); } // Simple constant expression pattern - if (s matches "Hell"+"o") { + if (s __matches "Hell"+"o") { message(); } else { throw new AssertionError("Broken"); } // Constant expression pattern using a final local - if (s matches hello) { + if (s __matches hello) { message(); } else { throw new AssertionError("Broken"); @@ -389,23 +389,23 @@ Object obj = "Hello"; - if (obj matches "Hello") { + if (obj __matches "Hello") { message(); } else { throw new AssertionError("Broken"); } - if (obj matches null) { + if (obj __matches null) { throw new AssertionError("Broken"); } obj = 42; - if (obj matches 42) { + if (obj __matches 42) { message(); } else { throw new AssertionError("Broken"); } - if (obj matches var x) { - if (obj matches 42) { + if (obj __matches var x) { + if (obj __matches 42) { message(); } else { throw new AssertionError("Broken"); @@ -414,15 +414,15 @@ throw new AssertionError("Broken"); } - if (obj matches 42) { - if (obj matches var x) { + if (obj __matches 42) { + if (obj __matches var x) { message(); } } - if (obj matches null) { + if (obj __matches null) { throw new AssertionError("Broken"); } - if (null matches "Hello") { + if (null __matches "Hello") { throw new AssertionError("Broken"); }
--- a/test/langtools/tools/javac/patterns/DuplicateBindingTest.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/DuplicateBindingTest.java Fri Nov 02 17:21:11 2018 -0400 @@ -12,7 +12,7 @@ if (args != null) { int s; - if (args[0] matches String s) { // NOT OK. Redef same scope. + if (args[0] __matches String s) { // NOT OK. Redef same scope. } int k; switch(args[0]) { @@ -27,4 +27,4 @@ } } } -} +} \ No newline at end of file
--- a/test/langtools/tools/javac/patterns/DuplicateBindingTest.out Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/DuplicateBindingTest.out Fri Nov 02 17:21:11 2018 -0400 @@ -1,4 +1,4 @@ -DuplicateBindingTest.java:15:33: compiler.err.already.defined: kindname.variable, s, kindname.method, main(java.lang.String[]) +DuplicateBindingTest.java:15:35: compiler.err.already.defined: kindname.variable, s, kindname.method, main(java.lang.String[]) DuplicateBindingTest.java:19:22: compiler.err.already.defined: kindname.variable, k, kindname.method, main(java.lang.String[]) DuplicateBindingTest.java:21:22: compiler.err.already.defined: kindname.variable, args, kindname.method, main(java.lang.String[]) DuplicateBindingTest.java:18:19: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer)
--- a/test/langtools/tools/javac/patterns/EnsureTypesOrderTest.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/EnsureTypesOrderTest.java Fri Nov 02 17:21:11 2018 -0400 @@ -5,9 +5,9 @@ * @compile/fail/ref=EnsureTypesOrderTest.out -XDrawDiagnostics EnsureTypesOrderTest.java */ public class EnsureTypesOrderTest { - public static void main(String [] args) { - if (args matches String s) { - System.out.println("Broken"); - } - } -} + public static void main(String [] args) { + if (args __matches String s) { + System.out.println("Broken"); + } + } +} \ No newline at end of file
--- a/test/langtools/tools/javac/patterns/ExamplesFromProposal.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/ExamplesFromProposal.java Fri Nov 02 17:21:11 2018 -0400 @@ -103,7 +103,7 @@ public static void main(String[] args) { Object x = new Integer(42); - if (x matches Integer i) { + if (x __matches Integer i) { // can use i here System.out.println(i.intValue()); } @@ -111,19 +111,19 @@ Object obj = getSomething(); String formatted = "unknown"; - if (obj matches Integer i) { + if (obj __matches Integer i) { formatted = String.format("int %d", i); } - else if (obj matches Byte b) { + else if (obj __matches Byte b) { formatted = String.format("byte %d", b); } - else if (obj matches Long l) { + else if (obj __matches Long l) { formatted = String.format("long %d", l); } - else if (obj matches Double d) { + else if (obj __matches Double d) { formatted = String.format("double %f", d); } - else if (obj matches String s) { + else if (obj __matches String s) { formatted = String.format("String %s", s); } System.out.println(formatted); @@ -189,19 +189,19 @@ x = "Hello"; - if (x matches String s1) { + if (x __matches String s1) { System.out.println(s1); } - if (x matches String s1 && s1.length() > 0) { + if (x __matches String s1 && s1.length() > 0) { System.out.println(s1); } - if (x matches String s1) { + if (x __matches String s1) { System.out.println(s1 + " is a string"); } else { System.out.println("not a string"); } - if (!(x matches String s1)) { + if (!(x __matches String s1)) { System.out.println("not a string"); } else { System.out.println(s1 + " is a string");
--- a/test/langtools/tools/javac/patterns/ImpossibleTypeTest.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/ImpossibleTypeTest.java Fri Nov 02 17:21:11 2018 -0400 @@ -10,10 +10,10 @@ int in = 42; Integer i = 42; - if (i matches String s ) { + if (i __matches String s ) { System.out.println("Broken"); } - if (i matches Undefined u ) { + if (i __matches Undefined u ) { System.out.println("Broken"); } }
--- a/test/langtools/tools/javac/patterns/ImpossibleTypeTest.out Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/ImpossibleTypeTest.out Fri Nov 02 17:21:11 2018 -0400 @@ -1,3 +1,3 @@ ImpossibleTypeTest.java:13:13: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Integer, java.lang.String) -ImpossibleTypeTest.java:16:23: compiler.err.cant.resolve.location: kindname.class, Undefined, , , (compiler.misc.location: kindname.class, ImpossibleTypeTest, null) +ImpossibleTypeTest.java:16:25: compiler.err.cant.resolve.location: kindname.class, Undefined, , , (compiler.misc.location: kindname.class, ImpossibleTypeTest, null) 2 errors
--- a/test/langtools/tools/javac/patterns/MatchBindingScopeTest.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/MatchBindingScopeTest.java Fri Nov 02 17:21:11 2018 -0400 @@ -11,18 +11,18 @@ static Object o2 = i; public static void main(String[] args) { - - if (o1 matches String j && j.length() == 5) { // OK + + if (o1 __matches String j && j.length() == 5) { // OK System.out.println(j); // OK } else { System.out.println(j); // NOT OK } // NOT OK, name reused. - if (o1 matches String j && o2 matches Integer j) { + if (o1 __matches String j && o2 __matches Integer j) { } - if (o1 matches String j && j.length() == 5 && o2 matches Integer k && k == 42) { // OK + if (o1 __matches String j && j.length() == 5 && o2 __matches Integer k && k == 42) { // OK System.out.println(j); // OK System.out.println(k); // OK } else { @@ -30,29 +30,29 @@ System.out.println(k); // NOT OK } - if (o1 matches String j || j.length() == 5) { // NOT OK + if (o1 __matches String j || j.length() == 5) { // NOT OK System.out.println(j); // NOT OK } - if (o1 matches String j || o2 matches Integer j) { // NOT OK, types differ + if (o1 __matches String j || o2 __matches Integer j) { // NOT OK, types differ System.out.println(j); // NOT OK } else { System.out.println(j); // NOT OK. } - while (o1 matches String j && j.length() == 5) { // OK + while (o1 __matches String j && j.length() == 5) { // OK System.out.println(j); // OK } - while (o1 matches String j || true) { + while (o1 __matches String j || true) { System.out.println(j); // Not OK } - for (; o1 matches String j; j.length()) { // OK + for (; o1 __matches String j; j.length()) { // OK System.out.println(j); // OK } - for (; o1 matches String j || true; j.length()) { // NOT OK + for (; o1 __matches String j || true; j.length()) { // NOT OK System.out.println(j); // Not OK } @@ -65,11 +65,11 @@ break; } - int x = o1 matches String j ? + int x = o1 __matches String j ? j.length() : // OK. j.length(); // NOT OK. - x = !(o1 matches String j) ? + x = !(o1 __matches String j) ? j.length() : // NOT OK. j.length(); // OK. }
--- a/test/langtools/tools/javac/patterns/MatchBindingScopeTest.out Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/MatchBindingScopeTest.out Fri Nov 02 17:21:11 2018 -0400 @@ -1,15 +1,15 @@ MatchBindingScopeTest.java:18:32: compiler.err.cant.resolve.location: kindname.variable, j, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null) -MatchBindingScopeTest.java:22:47: compiler.err.already.defined: kindname.variable, j, kindname.method, main(java.lang.String[]) -MatchBindingScopeTest.java:22:33: compiler.err.match.binding.exists +MatchBindingScopeTest.java:22:51: compiler.err.already.defined: kindname.variable, j, kindname.method, main(java.lang.String[]) +MatchBindingScopeTest.java:22:35: compiler.err.match.binding.exists MatchBindingScopeTest.java:29:32: compiler.err.cant.resolve.location: kindname.variable, j, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null) MatchBindingScopeTest.java:30:32: compiler.err.cant.resolve.location: kindname.variable, k, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null) -MatchBindingScopeTest.java:33:36: compiler.err.cant.resolve.location: kindname.variable, j, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null) +MatchBindingScopeTest.java:33:38: compiler.err.cant.resolve.location: kindname.variable, j, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null) MatchBindingScopeTest.java:34:32: compiler.err.cant.resolve.location: kindname.variable, j, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null) -MatchBindingScopeTest.java:37:33: compiler.err.match.binding.exists.with.different.type +MatchBindingScopeTest.java:37:35: compiler.err.match.binding.exists.with.different.type MatchBindingScopeTest.java:38:32: compiler.err.cant.resolve.location: kindname.variable, j, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null) MatchBindingScopeTest.java:40:32: compiler.err.cant.resolve.location: kindname.variable, j, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null) MatchBindingScopeTest.java:48:32: compiler.err.cant.resolve.location: kindname.variable, j, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null) -MatchBindingScopeTest.java:55:45: compiler.err.cant.resolve.location: kindname.variable, j, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null) +MatchBindingScopeTest.java:55:47: compiler.err.cant.resolve.location: kindname.variable, j, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null) MatchBindingScopeTest.java:56:32: compiler.err.cant.resolve.location: kindname.variable, j, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null) MatchBindingScopeTest.java:64:21: compiler.err.cant.resolve.location: kindname.variable, x, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null) MatchBindingScopeTest.java:70:23: compiler.err.cant.resolve.location: kindname.variable, j, , , (compiler.misc.location: kindname.class, MatchBindingScopeTest, null)
--- a/test/langtools/tools/javac/patterns/MatchesToken.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/MatchesToken.java Fri Nov 02 17:21:11 2018 -0400 @@ -4,16 +4,16 @@ */ public class MatchesToken { public void test(Object o) { - final int matches = 1; - boolean b1 = matches matches matches; - boolean b2 = o matches matches; - boolean b3 = matches matches Integer i; - boolean b4 = (matches matches matches) matches true; + final int __matches = 1; + boolean b1 = __matches __matches __matches; + boolean b2 = o __matches __matches; + boolean b3 = __matches __matches Integer i; + boolean b4 = (__matches __matches __matches) __matches true; } private void test() { - I1 i1 = (int matches) -> {}; - I2 i2 = (int matches, int other) -> {}; + I1 i1 = (int __matches) -> {}; + I2 i2 = (int __matches, int other) -> {}; } interface I1 {
--- a/test/langtools/tools/javac/patterns/NestingMatchAndMatches.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/NestingMatchAndMatches.java Fri Nov 02 17:21:11 2018 -0400 @@ -11,24 +11,24 @@ Object o = "Hello"; //Nested matches - if ((o matches String s) matches boolean b) { + if ((o __matches String s) __matches boolean b) { System.out.println("String!"); } else { throw new AssertionError("broken"); } - if ((o matches String s) matches false) { + if ((o __matches String s) __matches false) { throw new AssertionError("broken"); } else { System.out.println("String "); } - if ((o matches String s) matches true) { + if ((o __matches String s) __matches true) { System.out.println("String!"); } else { throw new AssertionError("broken"); } - boolean b = (o matches String s) ? (s matches "Hello") : false; + boolean b = (o __matches String s) ? (s __matches "Hello") : false; if (b) { System.out.println("yes!"); @@ -39,13 +39,13 @@ //matches inside a match switch (o) { case String s: - if (s matches String t) { + if (s __matches String t) { System.out.println(s+"-"+t); } } switch (o) { case String s: - if (o matches Integer t) { + if (o __matches Integer t) { System.out.println(s+"-"+t); throw new AssertionError("broken"); } else { @@ -107,7 +107,7 @@ case String s: switch (o2) { case String t: - if (t matches String u) { + if (t __matches String u) { System.out.println(s+"-"+t+"--"+u); } else { throw new AssertionError("broken");
--- a/test/langtools/tools/javac/patterns/NullsInPatterns.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/NullsInPatterns.java Fri Nov 02 17:21:11 2018 -0400 @@ -29,29 +29,29 @@ import java.util.List; public class NullsInPatterns { - + public static void main(String[] args) { - if (null matches List t) { + if (null __matches List t) { throw new AssertionError("broken"); } else { System.out.println("null does not match List type pattern"); } - if (null matches List<Integer> l) { + if (null __matches List<Integer> l) { throw new AssertionError("broken"); } else { System.out.println("null does not match List<Integer> type pattern"); } - if (null matches List<?> l) { + if (null __matches List<?> l) { throw new AssertionError("broken"); } else { System.out.println("null does not match List<?> type pattern"); } - if (null matches var x) { + if (null __matches var x) { System.out.println("null matches var type pattern"); } else { throw new AssertionError("broken"); } - if (null matches null) { + if (null __matches null) { System.out.println("null matches null constant pattern"); } else { throw new AssertionError("broken");
--- a/test/langtools/tools/javac/patterns/PatternMatchPosTest.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/PatternMatchPosTest.java Fri Nov 02 17:21:11 2018 -0400 @@ -61,7 +61,7 @@ SourcePositions sp = trees.getSourcePositions(); TreePath dataPath = trees.getPath(data); String text = dataPath.getCompilationUnit().getSourceFile().getCharContent(true).toString(); - + new TreeScanner<Void, Void>() { boolean print; @Override @@ -117,9 +117,9 @@ class PatternMatchPosTestData { void data(Object o) { - if (o matches 1) { } - if (o matches var s) { } - if (o matches String s) { } + if (o __matches 1) { } + if (o __matches var s) { } + if (o __matches String s) { } switch (o) { case 1: break; case String s: break;
--- a/test/langtools/tools/javac/patterns/PatternMatchPosTest.out Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/PatternMatchPosTest.out Fri Nov 02 17:21:11 2018 -0400 @@ -1,14 +1,14 @@ -(o matches 1) -o matches 1 +(o __matches 1) +o __matches 1 o 1 1 -(o matches var s) -o matches var s +(o __matches var s) +o __matches var s o var s -(o matches String s) -o matches String s +(o __matches String s) +o __matches String s o String s String
--- a/test/langtools/tools/javac/patterns/PatternTypeTest1.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/PatternTypeTest1.java Fri Nov 02 17:21:11 2018 -0400 @@ -34,7 +34,7 @@ String s = "Hello"; Object o = i; - if (o matches var j) { + if (o __matches var j) { System.out.println("Match all"); } else { throw new AssertionError("Broken");
--- a/test/langtools/tools/javac/patterns/PatternTypeTest2.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/PatternTypeTest2.java Fri Nov 02 17:21:11 2018 -0400 @@ -34,7 +34,7 @@ String s = "Hello"; Object o = i; - if (o matches Integer j) { + if (o __matches Integer j) { System.out.println("It's an Integer"); } else { throw new AssertionError("Broken");
--- a/test/langtools/tools/javac/patterns/PatternVariablesAreFinal.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/PatternVariablesAreFinal.java Fri Nov 02 17:21:11 2018 -0400 @@ -6,7 +6,7 @@ public class PatternVariablesAreFinal { public static void main(String[] args) { Object o = 32; - if (o matches String s) { + if (o __matches String s) { s = "hello again"; System.out.println(s); }
--- a/test/langtools/tools/javac/patterns/PatternVariablesAreFinal2.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/PatternVariablesAreFinal2.java Fri Nov 02 17:21:11 2018 -0400 @@ -6,7 +6,7 @@ public class PatternVariablesAreFinal2 { public static void main(String[] args) { Object o = "42"; - if (o matches String s) { + if (o __matches String s) { new Object() { void run() { System.err.println(s); } }.run();
--- a/test/langtools/tools/javac/patterns/UncheckedWarningOnMatchesTest.java Thu Nov 01 17:45:42 2018 +0100 +++ b/test/langtools/tools/javac/patterns/UncheckedWarningOnMatchesTest.java Fri Nov 02 17:21:11 2018 -0400 @@ -11,7 +11,7 @@ public static void main(String [] args) { Object o = new ArrayList<UncheckedWarningOnMatchesTest>(); - if (o matches ArrayList<Integer> ai) { // unchecked conversion + if (o __matches ArrayList<Integer> ai) { // unchecked conversion System.out.println("Blah"); } switch (o) { @@ -20,4 +20,4 @@ break; } } -} +} \ No newline at end of file