1 /*
   2  * @test
   3  * @summary Pattern variables are final so should be allowed to be referenced in an inner class
   4  * @run main PatternVariablesAreFinal2
   5  */
   6 public class PatternVariablesAreFinal2 {
   7     public static void main(String[] args) {
   8         Object o = "42";
   9         if (o instanceof String s) {
  10             new Object() {
  11                 void run() { System.err.println(s); }
  12             }.run();
  13         }
  14     }
  15 }