privatestatic Path makeCopy(Recording recording) throws IOException {
Path p = recording.getDestination(); if (p == null) {
File directory = new File("."); // FIXME: Must come up with a way to give human-readable name // this will at least not clash when running parallel.
ProcessHandle h = ProcessHandle.current();
p = new File(directory.getAbsolutePath(), "recording-" + recording.getId() + "-pid" + h.pid() + ".jfr").toPath();
recording.dump(p);
} return p;
}
publicstaticvoid hasAnnotation(ValueDescriptor field, Class<? extends java.lang.annotation.Annotation> annotationClass) throws Exception {
AnnotationElement a = getAnnotation(field, annotationClass); if (a == null) { thrownew Exception("Expected " + annotationClass.getSimpleName() + " on field " + field.getName());
}
}
publicstaticvoid assertAnnotation(ValueDescriptor field, Class<? extends java.lang.annotation.Annotation> annotationClass, String value) throws Exception {
AnnotationElement a = getAnnotation(field, annotationClass);
Object v = a.getValue("value"); if (!v.equals(value)) { thrownew Exception("Expected " + annotationClass.getSimpleName() + " on field " + field.getName() + " to have value " + value + ", but got " + v);
}
}
// candidate for moving into API publicstatic AnnotationElement getAnnotation(ValueDescriptor v, Class<?> clazz) throws Exception { for (AnnotationElement a : v.getAnnotationElements()) { if (a.getTypeName().equals(clazz.getName())) { return a;
}
}
thrownew Exception("Could not find annotation " + clazz.getName());
}
// candidate for moving into API publicstatic AnnotationElement getAnnotationByName(EventType t, String name) throws Exception { for (AnnotationElement a : t.getAnnotationElements()) { if (a.getTypeName().equals(name)) { return a;
}
} thrownew Exception("Could not find annotation '" + name + " in type " + t.getName());
}
// candidate for moving into API publicstatic SettingDescriptor getSetting(EventType type, String name) { for (SettingDescriptor s : type.getSettingDescriptors()) { if (s.getName().equals(name)) { return s;
}
} thrownew IllegalArgumentException("Could not setting with name " + name);
}
publicstaticvoid hasEvent(List<RecordedEvent> events, String name) throws IOException { if (!containsEvent(events, name)) {
Asserts.fail("Missing event " + name + " in recording " + events.toString());
}
}
publicstaticvoid hasNotEvent(List<RecordedEvent> events, String name) throws IOException { if (containsEvent(events, name)) {
Asserts.fail("Rercording should not contain event " + name + " " + events.toString());
}
}
privatestaticboolean containsEvent(List<RecordedEvent> events, String name) { for (RecordedEvent event : events) { if (event.getEventType().getName().equals(name)) { returntrue;
}
} returnfalse;
}
publicstaticvoid assertFrame(RecordedEvent event, Class<?> expectedClass, String expectedMethodName) {
RecordedStackTrace stackTrace = event.getStackTrace();
Asserts.assertNotNull(stackTrace, "Missing stack trace"); for (RecordedFrame frame : stackTrace.getFrames()) { if (frame.isJavaFrame()) {
RecordedMethod method = frame.getMethod();
RecordedClass type = method.getType(); if (expectedClass.getName().equals(type.getName())) { if (expectedMethodName.equals(method.getName())) { return;
}
}
}
}
Asserts.fail("Expected " + expectedClass.getName() + "::"+ expectedMethodName + " in stack trace");
}
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.31Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.