-
Bug
-
Resolution: Fixed
-
P4
-
None
-
generic
-
generic
While compiling the following:
// ---
public class X {
public static void main(String [] args) {
if (args __matches String s) {
System.out.println("Broken");
}
}
}
// ---
javac complains:
/home/srikanth/tmp/X.java:3: error: incompatible types: String cannot be converted to String[]
if (args __matches String s) {
^
1 error
The relevant types appear transposed: It should say String [] cannot be converted to String
// ---
public class X {
public static void main(String [] args) {
if (args __matches String s) {
System.out.println("Broken");
}
}
}
// ---
javac complains:
/home/srikanth/tmp/X.java:3: error: incompatible types: String cannot be converted to String[]
if (args __matches String s) {
^
1 error
The relevant types appear transposed: It should say String [] cannot be converted to String