+ if (!(e instanceof CPRefEnt)) continue;
+ CPRefEnt ce = (CPRefEnt) e;
+ if(e1s[i] == 0 || e1s[i] >= usedSlots) throw new ClassFile.ClassReadExn("invalid cp index");
+ ce.e1 = entriesByIndex[e1s[i]];
+ if(ce.e1 == null) throw new ClassFile.ClassReadExn("invalid cp index");
+ if(ce.tag != 7 && ce.tag != 8) {
+ if(e2s[i] == 0 || e2s[i] >= usedSlots) throw new ClassFile.ClassReadExn("invalid cp index");
+ ce.e2 = entriesByIndex[e2s[i]];
+ if(ce.e2 == null) throw new ClassFile.ClassReadExn("invalid cp index");
+ }
+ switch(ce.tag) {
+ case 7:
+ case 8:
+ if(!(ce.e1 instanceof Utf8Ent)) throw new ClassFile.ClassReadExn("expected a utf8 ent");
+ break;
+ case 9:
+ case 10:
+ case 11:
+ if(!(ce.e1 instanceof CPRefEnt) || ((CPRefEnt)ce.e1).tag != 7)
+ throw new ClassFile.ClassReadExn("expected a type ent");
+ if(!(ce.e2 instanceof CPRefEnt) || ((CPRefEnt)ce.e2).tag != 12)
+ throw new ClassFile.ClassReadExn("expected a name and type ent");
+ break;
+ case 12:
+ if(!(ce.e1 instanceof Utf8Ent)) throw new ClassFile.ClassReadExn("expected a utf8 ent");
+ if(!(ce.e2 instanceof Utf8Ent)) throw new ClassFile.ClassReadExn("expected a utf8 ent");
+ break;
+ }
+ }
+ for(int i=1; i<usedSlots; i++) {
+ Ent e = entriesByIndex[i];
+ entries.put(e.key(), e);
+ if (e instanceof LongEnt) i++;