Get DCHECK back to EncodedStaticFieldValueIterator
This is a follow-up of
https://android-review.googlesource.com/#/c/185000/
Change-Id: Ia7311ab948712324f92814e4d415a0a78d16bb84
diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc
index 4e15e80..b1a0538 100644
--- a/runtime/dex_file.cc
+++ b/runtime/dex_file.cc
@@ -2210,22 +2210,47 @@
EncodedStaticFieldValueIterator::EncodedStaticFieldValueIterator(
const DexFile& dex_file,
const DexFile::ClassDef& class_def)
- : EncodedStaticFieldValueIterator(dex_file, nullptr, nullptr,
- nullptr, class_def) {
+ : EncodedStaticFieldValueIterator(dex_file,
+ nullptr,
+ nullptr,
+ nullptr,
+ class_def,
+ -1,
+ kByte) {
}
EncodedStaticFieldValueIterator::EncodedStaticFieldValueIterator(
- const DexFile& dex_file, Handle<mirror::DexCache>* dex_cache,
- Handle<mirror::ClassLoader>* class_loader, ClassLinker* linker,
+ const DexFile& dex_file,
+ Handle<mirror::DexCache>* dex_cache,
+ Handle<mirror::ClassLoader>* class_loader,
+ ClassLinker* linker,
const DexFile::ClassDef& class_def)
+ : EncodedStaticFieldValueIterator(dex_file,
+ dex_cache, class_loader,
+ linker,
+ class_def,
+ -1,
+ kByte) {
+ DCHECK(dex_cache_ != nullptr);
+ DCHECK(class_loader_ != nullptr);
+}
+
+EncodedStaticFieldValueIterator::EncodedStaticFieldValueIterator(
+ const DexFile& dex_file,
+ Handle<mirror::DexCache>* dex_cache,
+ Handle<mirror::ClassLoader>* class_loader,
+ ClassLinker* linker,
+ const DexFile::ClassDef& class_def,
+ size_t pos,
+ ValueType type)
: dex_file_(dex_file),
dex_cache_(dex_cache),
class_loader_(class_loader),
linker_(linker),
array_size_(),
- pos_(-1),
- type_(kByte) {
- ptr_ = dex_file_.GetEncodedStaticFieldValuesArray(class_def);
+ pos_(pos),
+ type_(type) {
+ ptr_ = dex_file.GetEncodedStaticFieldValuesArray(class_def);
if (ptr_ == nullptr) {
array_size_ = 0;
} else {