129 errors++;
130 }
131
132 int errors;
133
134 /**
135 * Annotation used to provide the set of names expected in the LVT attribute.
136 */
137 @Retention(RetentionPolicy.RUNTIME)
138 @interface Expect {
139 String[] value();
140 }
141
142 /*
143 * ---------- Test cases ---------------------------------------------------
144 */
145
146 @Expect({ "o", "s" })
147 static class Pattern_Simple {
148 public static void test(Object o) {
149 if (o instanceof String s) {}
150 }
151 }
152
153 @Expect({ "s" })
154 static class Pattern_Lambda {
155 public static void test(Object o) {
156 if (o instanceof String s) {
157 Runnable r = () -> {
158 s.length();
159 };
160 }
161 }
162 }
163
164 }
165
|
129 errors++;
130 }
131
132 int errors;
133
134 /**
135 * Annotation used to provide the set of names expected in the LVT attribute.
136 */
137 @Retention(RetentionPolicy.RUNTIME)
138 @interface Expect {
139 String[] value();
140 }
141
142 /*
143 * ---------- Test cases ---------------------------------------------------
144 */
145
146 @Expect({ "o", "s" })
147 static class Pattern_Simple {
148 public static void test(Object o) {
149 if (o instanceof String s) {
150 s.length();
151 }
152 }
153 }
154
155 @Expect({ "s" })
156 static class Pattern_Lambda {
157 public static void test(Object o) {
158 if (o instanceof String s) {
159 Runnable r = () -> {
160 s.length();
161 };
162 }
163 }
164 }
165
166 }
167
|