void verifyBytecode(Result<Iterable<? extends JavaFileObject>> result) { boolean lastInlined = false; boolean hasCode = false; int gapsCount = 0; for (int i = 0; i < ca.ordinal() + 1 ; i++) {
lastInlined = stmts[i].canInline;
hasCode = hasCode || !stmts[i].empty; if (lastInlined && hasCode) {
hasCode = false;
gapsCount++;
}
} if (!lastInlined) {
gapsCount++;
}
try (InputStream is = result.get().iterator().next().openInputStream()) {
ClassFile cf = ClassFile.read(is); if (cf == null) {
fail("Classfile not found: " + result.compilationInfo()); return;
}
Method test_method = null; for (Method m : cf.methods) { if (m.getName(cf.constant_pool).equals("test")) {
test_method = m; break;
}
}
if (test_method == null) {
fail("Method test() not found in class Test" + result.compilationInfo()); return;
}
Code_attribute code = null; for (Attribute a : test_method.attributes) { if (a.getName(cf.constant_pool).equals(Attribute.Code)) {
code = (Code_attribute)a; break;
}
}
if (code == null) {
fail("Code attribute not found in method test()"); return;
}
int actualGapsCount = 0; for (int i = 0; i < code.exception_table_length ; i++) { int catchType = code.exception_table[i].catch_type; if (catchType == 0) { //any
actualGapsCount++;
}
}
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.