In the last document sent by Brian, there is a notion of static Pattern.

Here is an example of static patterns
  switch(o) {
    case String.matcher("(a*)(b*)", matcher -> ...
    case Integer.parseInt(var value) -> ...
  }

The first pattern, check if o is an instance of a String that match the regex 
"(a)(b)" and provides the Matcher to retrieve the matching groups.
The second pattern, check if o is an instance of a String and can be parsed as 
an integer and bind that integer to value.

The first pattern correspond to an instance method inside java.lang.String, 
while the second pattern correspond to a static method inside java.lang.Integer.

One problem is that while it's obvious that the first pattern starts by 
checking if o is an instanceof String,
it's far less clear from a user POV that the second pattern does exactly the 
same thing and does not check if o is an instance of Integer.

So should we support the form of the second pattern, a static Pattern linked to 
a static method ?
Or should we restrict ourselves to static patterns that are expressed as 
instance method ?

regards,
Rémi


Reply via email to