use of com.mebigfatguy.fbcontrib.utils.FQField in project fb-contrib by mebigfatguy.
the class UnrelatedCollectionContents method checkAdd.
/**
* processes an add into a collection, by processing all the super classes/interfaces of an object and removing the possible set of parent classes that have
* been seen so far, by doing what amounts to a intersection of what has been seen before, and this occurance.
*
* @param colItm
* the collection that is being added to
* @param addItm
* the added item
* @throws ClassNotFoundException
* if a super class is not found
*/
private void checkAdd(final OpcodeStack.Item colItm, final OpcodeStack.Item addItm) throws ClassNotFoundException {
int reg = colItm.getRegisterNumber();
if (reg == -1) {
XField field = colItm.getXField();
if (field == null) {
return;
}
Set<SourceLineAnnotation> sla = memberSourceLineAnnotations.get(field.getName());
if (sla == null) {
sla = new HashSet<>();
memberSourceLineAnnotations.put(field.getName(), sla);
}
sla.add(SourceLineAnnotation.fromVisitedInstruction(this));
FQField fqField = new FQField(field.getClassName(), field.getName(), field.getSignature());
Set<String> commonSupers = memberCollections.get(fqField);
if (commonSupers == null) {
commonSupers = new HashSet<>();
memberCollections.put(fqField, commonSupers);
addNewItem(commonSupers, addItm);
} else {
mergeItem(commonSupers, sla, addItm);
}
} else {
Integer regNumber = Integer.valueOf(reg);
Set<SourceLineAnnotation> pcs = localSourceLineAnnotations.get(regNumber);
if (pcs == null) {
pcs = new HashSet<>();
localSourceLineAnnotations.put(regNumber, pcs);
}
pcs.add(SourceLineAnnotation.fromVisitedInstruction(this, getPC()));
Set<String> commonSupers = localCollections.get(regNumber);
if (commonSupers == null) {
commonSupers = new HashSet<>();
localCollections.put(Integer.valueOf(reg), commonSupers);
addNewItem(commonSupers, addItm);
Integer scopeEnd = Integer.valueOf(RegisterUtils.getLocalVariableEndRange(getMethod().getLocalVariableTable(), reg, getNextPC()));
BitSet regs = localScopeEnds.get(scopeEnd);
if (regs == null) {
regs = new BitSet();
localScopeEnds.put(scopeEnd, regs);
}
regs.set(regNumber);
} else {
mergeItem(commonSupers, pcs, addItm);
}
}
}
Aggregations