/* * (non-Javadoc) * * @see * edu.umd.cs.findbugs.classfile.IAnalysisEngine#analyze(edu.umd.cs.findbugs * .classfile.IAnalysisCache, java.lang.Object) */ public LoadedFieldSet analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor) throws CheckedAnalysisException { MethodGen methodGen = getMethodGen(analysisCache, descriptor); 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); } } return loadedFieldSet; }