if (methodGen == null) {
return null;
}
InstructionList il = methodGen.getInstructionList();
LoadedFieldSet loadedFieldSet = new LoadedFieldSet(methodGen);
ConstantPoolGen cpg = getConstantPoolGen(analysisCache, descriptor.getClassDescriptor());
for (InstructionHandle handle = il.getStart(); handle != null; handle = handle.getNext()) {
Instruction ins = handle.getInstruction();
short opcode = ins.getOpcode();
try {
if (opcode == Constants.INVOKESTATIC) {
INVOKESTATIC inv = (INVOKESTATIC) ins;
if (Hierarchy.isInnerClassAccess(inv, cpg)) {
InnerClassAccess access = Hierarchy.getInnerClassAccess(inv, cpg);
/*
* if (access == null) {
* System.out.println("Missing inner class access in " +
* SignatureConverter.convertMethodSignature(methodGen)
* + " at " + inv); }
*/
if (access != null) {
if (access.isLoad()) {
loadedFieldSet.addLoad(handle, access.getField());
} else {
loadedFieldSet.addStore(handle, access.getField());
}
}
}
} else if (fieldInstructionOpcodeSet.get(opcode)) {
boolean isLoad = (opcode == Constants.GETFIELD || opcode == Constants.GETSTATIC);
XField field = Hierarchy.findXField((FieldInstruction) ins, cpg);
if (field != null) {
if (isLoad) {
loadedFieldSet.addLoad(handle, field);
} else {
loadedFieldSet.addStore(handle, field);
}
}
}
} catch (ClassNotFoundException e) {
AnalysisContext.currentAnalysisContext().getLookupFailureCallback().reportMissingClass(e);