publicstaticvoid main(String[] args) {
System.loadLibrary(args[0]);
System.out.println("JNI Type is: " + GetJniType()); long expect_ptr_id = GetId(PtrCls.class, "doNothingPtr");
DbgPrint(String.format("expected_ptr_id is 0x%x", expect_ptr_id)); if (expect_ptr_id % 4 != 0) { thrownew Error("ID " + expect_ptr_id + " is not aligned!");
} else {
System.out.println("pointer ID looks like a pointer!");
}
SetToIndexIds();
System.out.println("JNI Type is: " + GetJniType()); long expect_idx_id = GetId(IdxCls.class, "doNothingIdx");
DbgPrint(String.format("expected_idx_id is 0x%x", expect_idx_id)); if (expect_idx_id % 2 != 1) { thrownew Error("ID " + expect_ptr_id + " is not odd!");
} else {
System.out.println("index ID looks like an index!");
} long again_ptr_id = GetId(PtrCls.class, "doNothingPtr"); if (expect_ptr_id != again_ptr_id) { thrownew Error( "Got different id values for same method. " + expect_ptr_id + " vs " + again_ptr_id);
} else {
System.out.println("pointer ID remains a pointer!");
} long well_known_id = GetMethodId(false, Consumer.class, "accept", "(Ljava/lang/Object;)V");
DbgPrint(String.format("well_known_id is 0x%x", well_known_id)); if (well_known_id % 2 != 1) { thrownew Error("WKC ID " + well_known_id + " is not odd!");
} else {
System.out.println("index WKC ID looks like an index!");
}
}
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.