188 handle.invoke(this, impl);
189 } catch(Error | RuntimeException x) {
190 throw x;
191 } catch(Throwable t) {
192 throw new RuntimeException(t);
193 }
194 }
195 }
196
197 static String prepare(String produced, boolean eraseSensitiveInfo) {
198 if (eraseSensitiveInfo) {
199 // Erase sensitive information before comparing:
200 // comparing line numbers is too fragile, so we just erase them
201 // out before comparing. We also erase the hash-like names of
202 // synthetic frames introduced by lambdas & method handles
203 return produced.replaceAll(":[1-9][0-9]*\\)", ":00)")
204 .replaceAll("-internal/", "/").replaceAll("-ea/", "/")
205 .replaceAll("java.base@(\\d+\\.){0,3}(\\d+)/", "java.base/")
206 .replaceAll("/[0-9]+\\.run", "/xxxxxxxx.run")
207 .replaceAll("/[0-9]+\\.invoke", "/xxxxxxxx.invoke")
208 .replaceAll("DirectMethodHandle\\$Holder", "LambdaForm\\$DMH")
209 .replaceAll("DMH\\.invoke", "DMH/xxxxxxxx.invoke")
210 .replaceAll("\\$[0-9]+", "\\$??");
211 } else {
212 return produced;
213 }
214 }
215
216
217 public static void main(String[] args) {
218 test(new TestCase1());
219 test(new TestCase2());
220 test(new TestCase3());
221 test(new TestCase4());
222 }
223
224 public static void invoke(Runnable run) {
225 run.run();
226 }
227
228 static final class Recorder {
229 boolean found; // stop recording after main
|
188 handle.invoke(this, impl);
189 } catch(Error | RuntimeException x) {
190 throw x;
191 } catch(Throwable t) {
192 throw new RuntimeException(t);
193 }
194 }
195 }
196
197 static String prepare(String produced, boolean eraseSensitiveInfo) {
198 if (eraseSensitiveInfo) {
199 // Erase sensitive information before comparing:
200 // comparing line numbers is too fragile, so we just erase them
201 // out before comparing. We also erase the hash-like names of
202 // synthetic frames introduced by lambdas & method handles
203 return produced.replaceAll(":[1-9][0-9]*\\)", ":00)")
204 .replaceAll("-internal/", "/").replaceAll("-ea/", "/")
205 .replaceAll("java.base@(\\d+\\.){0,3}(\\d+)/", "java.base/")
206 .replaceAll("/[0-9]+\\.run", "/xxxxxxxx.run")
207 .replaceAll("/[0-9]+\\.invoke", "/xxxxxxxx.invoke")
208 // DMHs may or may not be pre-generated, making frames differ
209 .replaceAll("DirectMethodHandle\\$Holder", "LambdaForm\\$DMH")
210 .replaceAll("DMH\\.invoke", "DMH/xxxxxxxx.invoke")
211 // invoke frames may or may not have basic method type
212 // information encoded for diagnostic purposes
213 .replaceAll("xx\\.invoke([A-Za-z]*)_[A-Z]+_[A-Z]", "xx.invoke$1")
214 .replaceAll("\\$[0-9]+", "\\$??");
215 } else {
216 return produced;
217 }
218 }
219
220
221 public static void main(String[] args) {
222 test(new TestCase1());
223 test(new TestCase2());
224 test(new TestCase3());
225 test(new TestCase4());
226 }
227
228 public static void invoke(Runnable run) {
229 run.run();
230 }
231
232 static final class Recorder {
233 boolean found; // stop recording after main
|