1 19 20 package edu.umd.cs.findbugs.ba.type; 21 22 import java.util.Collection ; 23 24 import edu.umd.cs.findbugs.ba.CFG; 25 import edu.umd.cs.findbugs.ba.Dataflow; 26 import edu.umd.cs.findbugs.ba.DataflowAnalysisException; 27 import edu.umd.cs.findbugs.ba.Edge; 28 import edu.umd.cs.findbugs.ba.Location; 29 30 public class TypeDataflow extends Dataflow<TypeFrame, TypeAnalysis> { 31 public static class LocationAndFactPair { 32 public final Location location; 33 public final TypeFrame frame; 34 35 LocationAndFactPair(Location location, TypeFrame frame) { 36 this.location = location; 37 this.frame = frame; 38 } 39 } 40 41 public TypeDataflow(CFG cfg, TypeAnalysis analysis) { 42 super(cfg, analysis); 43 } 44 45 public TypeFrame getFactAtLocation(Location loc) throws DataflowAnalysisException { 46 return getAnalysis().getFactAtLocation(loc); 47 } 48 49 public TypeFrame getFactAfterLocation(Location loc) throws DataflowAnalysisException { 50 return getAnalysis().getFactAfterLocation(loc); 51 } 52 53 public ExceptionSet getEdgeExceptionSet(Edge edge) { 54 return getAnalysis().getEdgeExceptionSet(edge); 55 } 56 57 public LocationAndFactPair getLocationAndFactForInstruction(int pc) { 58 Collection <Location> locations = getCFG().getLocationsContainingInstructionWithOffset(pc); 59 60 LocationAndFactPair result = null; 61 62 for (Location location : locations) { 64 try { 65 TypeFrame frame = getFactAtLocation(location); 66 if (frame.isValid()) { 67 result = new LocationAndFactPair(location, frame); 68 break; 69 } 70 } catch (DataflowAnalysisException e) { 71 } 73 } 74 75 return result; 76 } 77 } 78 79 | Popular Tags |