1 package Analysis.SSJava;
3 import java.io.BufferedWriter;
4 import java.io.FileWriter;
5 import java.io.IOException;
6 import java.util.HashMap;
7 import java.util.HashSet;
8 import java.util.Iterator;
12 import IR.ClassDescriptor;
14 import IR.FieldDescriptor;
15 import IR.MethodDescriptor;
16 import IR.VarDescriptor;
18 public class FlowGraph {
22 Set<FlowNode> returnNodeSet;
25 Map<FlowNode, Set<FlowEdge>> mapFlowNodeToOutEdgeSet;
27 Map<NTuple<Location>, FlowNode> mapLocTupleToFlowNode;
28 Map<FlowNode, NTuple<Location>> mapFlowNodeToLocTuple;
30 // maps the composite representation of field/var descriptors to infer nodes
31 Map<NTuple<Descriptor>, FlowNode> mapDescTupleToInferNode;
33 // maps a paramter descriptor to its index
34 Map<Descriptor, Integer> mapParamDescToIdx;
36 // DS for the lattice generation
37 Map<Integer, FlowNode> mapIdxToFlowNode;
39 public static int interseed = 0;
43 public FlowGraph(MethodDescriptor md, Map<Descriptor, Integer> mapParamDescToIdx) {
45 this.mapFlowNodeToLocTuple = new HashMap<FlowNode, NTuple<Location>>();
46 this.mapLocTupleToFlowNode = new HashMap<NTuple<Location>, FlowNode>();
47 this.mapDescTupleToInferNode = new HashMap<NTuple<Descriptor>, FlowNode>();
48 this.mapParamDescToIdx = new HashMap<Descriptor, Integer>();
49 this.mapParamDescToIdx.putAll(mapParamDescToIdx);
50 this.returnNodeSet = new HashSet<FlowNode>();
51 this.mapIdxToFlowNode = new HashMap<Integer, FlowNode>();
52 this.mapFlowNodeToOutEdgeSet = new HashMap<FlowNode, Set<FlowEdge>>();
55 // create a node for 'this' varialbe
56 // NTuple<Descriptor> thisDescTuple = new NTuple<Descriptor>();
57 // thisDescTuple.add(md.getThis());
59 NTuple<Descriptor> thisVarTuple = new NTuple<Descriptor>();
60 thisVarTuple.add(md.getThis());
61 FlowNode thisNode = createNewFlowNode(thisVarTuple);
62 thisNode.setSkeleton(true);
63 thisVarNode = thisNode;
70 public Map<NTuple<Descriptor>, FlowNode> getMapDescTupleToInferNode() {
71 return mapDescTupleToInferNode;
74 public void setMapDescTupleToInferNode(Map<NTuple<Descriptor>, FlowNode> in) {
75 this.mapDescTupleToInferNode.putAll(in);
78 public Map<NTuple<Location>, FlowNode> getMapLocTupleToFlowNode() {
79 return mapLocTupleToFlowNode;
82 public void setMapLocTupleToFlowNode(Map<NTuple<Location>, FlowNode> in) {
83 this.mapLocTupleToFlowNode.putAll(in);
86 public void setReturnNodeSet(Set<FlowNode> in) {
87 this.returnNodeSet.addAll(in);
90 public void setThisVarNode(FlowNode thisVarNode) {
91 this.thisVarNode = thisVarNode;
94 public Map<Descriptor, Integer> getMapParamDescToIdx() {
95 return mapParamDescToIdx;
98 public FlowNode createIntermediateNode(MethodDescriptor md) {
100 NTuple<Descriptor> tuple = new NTuple<Descriptor>();
101 Descriptor interDesc = new InterDescriptor(LocationInference.INTERLOC + interseed);
102 tuple.add(interDesc);
105 NTuple<Location> locTuple = new NTuple<Location>();
106 Location interLoc = new Location(md, interDesc);
107 locTuple.add(interLoc);
109 FlowNode newNode = new FlowNode(locTuple);
110 newNode.setIntermediate(true);
112 mapDescTupleToInferNode.put(tuple, newNode);
113 // nodeSet.add(newNode);
115 System.out.println("create new intermediate node= " + newNode);
120 private void setupMapIdxToDesc() {
122 Set<Descriptor> descSet = mapParamDescToIdx.keySet();
123 for (Iterator iterator = descSet.iterator(); iterator.hasNext();) {
124 Descriptor paramDesc = (Descriptor) iterator.next();
125 int idx = mapParamDescToIdx.get(paramDesc);
126 NTuple<Descriptor> descTuple = new NTuple<Descriptor>();
127 descTuple.add(paramDesc);
128 FlowNode paramNode = getFlowNode(descTuple);
129 mapIdxToFlowNode.put(idx, paramNode);
130 paramNode.setSkeleton(true);
135 public int getNumParameters() {
136 return mapIdxToFlowNode.keySet().size();
139 public FlowNode getParamFlowNode(int idx) {
140 return mapIdxToFlowNode.get(idx);
143 public Set<FlowNode> getNodeSet() {
144 Set<FlowNode> set = new HashSet<FlowNode>();
145 set.addAll(mapDescTupleToInferNode.values());
149 public MethodDescriptor getMethodDescriptor() {
153 public boolean isParamDesc(Descriptor desc) {
155 if (mapParamDescToIdx.containsKey(desc)) {
156 int idx = mapParamDescToIdx.get(desc);
157 if (!md.isStatic() && idx == 0) {
166 public boolean hasEdge(NTuple<Descriptor> fromDescTuple, NTuple<Descriptor> toDescTuple) {
168 FlowNode fromNode = mapDescTupleToInferNode.get(fromDescTuple);
169 FlowNode toNode = mapDescTupleToInferNode.get(toDescTuple);
171 Set<FlowEdge> fromNodeOutEdgeSet = getOutEdgeSet(fromNode);
172 for (Iterator iterator = fromNodeOutEdgeSet.iterator(); iterator.hasNext();) {
173 FlowEdge flowEdge = (FlowEdge) iterator.next();
174 if (flowEdge.getDst().equals(toNode)) {
177 if (hasEdge(flowEdge.getDst().getDescTuple(), toDescTuple)) {
186 public Set<FlowEdge> getOutEdgeSetStartingFrom(FlowNode startNode) {
188 Descriptor prefixDesc = startNode.getCurrentDescTuple().get(0);
190 // returns the set of edges that share the same prefix of startNode
191 Set<FlowEdge> edgeSet = new HashSet<FlowEdge>();
193 for (Iterator<Set<FlowEdge>> iter = mapFlowNodeToOutEdgeSet.values().iterator(); iter.hasNext();) {
194 Set<FlowEdge> nodeEdgeSet = iter.next();
195 for (Iterator<FlowEdge> iter2 = nodeEdgeSet.iterator(); iter2.hasNext();) {
196 FlowEdge edge = iter2.next();
197 if (edge.getInitTuple().get(0).equals(prefixDesc)) {
206 public Set<FlowEdge> getOutEdgeSet(FlowNode node) {
207 if (!mapFlowNodeToOutEdgeSet.containsKey(node)) {
208 mapFlowNodeToOutEdgeSet.put(node, new HashSet<FlowEdge>());
210 return mapFlowNodeToOutEdgeSet.get(node);
213 public void addValueFlowEdge(NTuple<Descriptor> fromDescTuple, NTuple<Descriptor> toDescTuple) {
215 FlowNode fromNode = getFlowNode(fromDescTuple);
216 FlowNode toNode = getFlowNode(toDescTuple);
218 // System.out.println("create an edge from " + fromNode + " to " + toNode);
220 int fromTupleSize = fromDescTuple.size();
221 NTuple<Descriptor> curFromTuple = new NTuple<Descriptor>();
222 for (int i = 0; i < fromTupleSize; i++) {
223 Descriptor desc = fromDescTuple.get(i);
224 curFromTuple.add(desc);
225 int toTupleSize = toDescTuple.size();
226 NTuple<Descriptor> curToTuple = new NTuple<Descriptor>();
227 for (int k = 0; k < toTupleSize; k++) {
228 Descriptor toDesc = toDescTuple.get(k);
229 curToTuple.add(toDesc);
230 addFlowEdge(getFlowNode(curFromTuple), getFlowNode(curToTuple), fromDescTuple, toDescTuple);
234 // int fromTupleSize = fromDescTuple.size();
235 // NTuple<Descriptor> curTuple = new NTuple<Descriptor>();
236 // for (int i = 0; i < fromTupleSize; i++) {
237 // Descriptor desc = fromDescTuple.get(i);
238 // curTuple.add(desc);
239 // addFlowEdge(getFlowNode(curTuple), toNode, fromDescTuple, toDescTuple);
242 // int toTupleSize = toDescTuple.size();
243 // curTuple = new NTuple<Descriptor>();
244 // for (int i = 0; i < toTupleSize; i++) {
245 // Descriptor desc = toDescTuple.get(i);
246 // curTuple.add(desc);
247 // addFlowEdge(fromNode, getFlowNode(curTuple), fromDescTuple, toDescTuple);
252 private void addFlowEdge(FlowNode fromNode, FlowNode toNode, NTuple<Descriptor> initTuple,
253 NTuple<Descriptor> endTuple) {
255 FlowEdge edge = new FlowEdge(fromNode, toNode, initTuple, endTuple);
256 addOutEdge(fromNode, edge);
258 // System.out.println("add a new edge=" + edge);
261 private void addOutEdge(FlowNode fromNode, FlowEdge edge) {
262 if (!mapFlowNodeToOutEdgeSet.containsKey(fromNode)) {
263 mapFlowNodeToOutEdgeSet.put(fromNode, new HashSet<FlowEdge>());
265 mapFlowNodeToOutEdgeSet.get(fromNode).add(edge);
268 public FlowNode getFlowNode(NTuple<Descriptor> descTuple) {
269 if (!mapDescTupleToInferNode.containsKey(descTuple)) {
270 FlowNode node = createNewFlowNode(descTuple);
271 mapDescTupleToInferNode.put(descTuple, node);
273 return mapDescTupleToInferNode.get(descTuple);
276 public FlowNode getThisVarNode() {
280 public FlowNode createNewFlowNode(NTuple<Descriptor> tuple) {
282 NTuple<Location> locTuple = translateToLocationTuple(tuple);
283 if (!mapDescTupleToInferNode.containsKey(tuple)) {
285 FlowNode node = new FlowNode(locTuple);
286 mapDescTupleToInferNode.put(tuple, node);
287 // nodeSet.add(node);
289 mapLocTupleToFlowNode.put(getLocationTuple(node), node);
291 if (tuple.size() > 1) {
292 NTuple<Descriptor> baseTuple = tuple.subList(0, tuple.size() - 1);
293 getFlowNode(baseTuple).addFieldNode(node);
296 // System.out.println("Creating new node=" + node);
299 return mapDescTupleToInferNode.get(tuple);
304 public void addReturnFlowNode(NTuple<Descriptor> tuple) {
306 if (!mapDescTupleToInferNode.containsKey(tuple)) {
307 createNewFlowNode(tuple);
310 FlowNode node = mapDescTupleToInferNode.get(tuple);
311 node.setReturn(true);
313 returnNodeSet.add(node);
316 public Set<FlowNode> getReturnNodeSet() {
317 return returnNodeSet;
320 public Set<FlowNode> getLocalReachFlowNodeSetFrom(FlowNode fn) {
321 Set<FlowNode> set = new HashSet<FlowNode>();
322 recurLocalReachFlowNodeSet(fn, set);
326 private void recurLocalReachFlowNodeSet(FlowNode fn, Set<FlowNode> visited) {
328 Set<FlowEdge> outEdgeSet = getOutEdgeSet(fn);
329 for (Iterator iterator = outEdgeSet.iterator(); iterator.hasNext();) {
330 FlowEdge edge = (FlowEdge) iterator.next();
331 FlowNode dstNode = edge.getDst();
333 if (!visited.contains(dstNode)) {
334 visited.add(dstNode);
335 recurLocalReachFlowNodeSet(dstNode, visited);
341 private void getReachFlowNodeSetFrom(FlowNode fn, Set<FlowNode> visited) {
343 Set<FlowEdge> outEdgeSet = getOutEdgeSet(fn);
344 for (Iterator iterator = outEdgeSet.iterator(); iterator.hasNext();) {
345 FlowEdge edge = (FlowEdge) iterator.next();
347 if (fn.equals(getFlowNode(edge.getInitTuple()))) {
348 FlowNode dstNode = getFlowNode(edge.getEndTuple());
349 if (!visited.contains(dstNode)) {
350 visited.add(dstNode);
351 getReachFlowNodeSetFrom(dstNode, visited);
358 public Set<FlowNode> getReachFlowNodeSetFrom(FlowNode fn) {
359 Set<FlowNode> set = new HashSet<FlowNode>();
360 getReachFlowNodeSetFrom(fn, set);
364 // private void getReachFlowNodeSetFrom(FlowNode fn, Set<FlowNode> visited) {
366 // for (Iterator iterator = fn.getOutEdgeSet().iterator();
367 // iterator.hasNext();) {
368 // FlowEdge edge = (FlowEdge) iterator.next();
370 // if (fn.equals(getFlowNode(edge.getInitTuple()))) {
372 // FlowNode dstNode = getFlowNode(edge.getEndTuple());
374 // if (!visited.contains(dstNode)) {
375 // visited.add(dstNode);
376 // getReachFlowNodeSetFrom(dstNode, visited);
383 public Set<NTuple<Location>> getReachableFlowTupleSet(Set<NTuple<Location>> visited, FlowNode fn) {
385 Set<FlowEdge> outEdgeSet = getOutEdgeSet(fn);
387 for (Iterator iterator = outEdgeSet.iterator(); iterator.hasNext();) {
388 FlowEdge edge = (FlowEdge) iterator.next();
390 if (fn.getLocTuple().equals(edge.getInitTuple())) {
391 FlowNode dstNode = getFlowNode(edge.getEndTuple());
392 NTuple<Location> dstTuple = getLocationTuple(dstNode);
394 if (!visited.contains(dstTuple)) {
395 visited.add(dstTuple);
396 visited.addAll(getReachableFlowTupleSet(visited, dstNode));
404 public NTuple<Location> getLocationTuple(NTuple<Descriptor> descTuple) {
405 return getLocationTuple(getFlowNode(descTuple));
408 public NTuple<Location> translateToLocationTuple(NTuple<Descriptor> descTuple) {
410 NTuple<Location> locTuple = new NTuple<Location>();
411 ClassDescriptor cd = null;
413 Descriptor localDesc = descTuple.get(0);
415 if (localDesc instanceof InterDescriptor) {
416 Location interLoc = new Location(md, localDesc);
417 locTuple.add(interLoc);
418 } else if (localDesc.getSymbol().equals(LocationInference.TOPLOC)) {
419 Location topLoc = new Location(md, Location.TOP);
420 topLoc.setLocDescriptor(LocationInference.TOPDESC);
421 locTuple.add(topLoc);
422 } else if (localDesc.getSymbol().equals(LocationInference.GLOBALLOC)) {
423 Location globalLoc = new Location(md, LocationInference.GLOBALLOC);
424 globalLoc.setLocDescriptor(LocationInference.GLOBALDESC);
425 locTuple.add(globalLoc);
428 for (int i = 0; i < descTuple.size(); i++) {
429 Descriptor curDesc = descTuple.get(i);
432 loc = new Location(md, curDesc.getSymbol());
433 loc.setLocDescriptor(curDesc);
434 cd = ((VarDescriptor) curDesc).getType().getClassDesc();
436 loc = new Location(cd, curDesc.getSymbol());
437 loc.setLocDescriptor(curDesc);
439 if (curDesc instanceof FieldDescriptor) {
440 cd = ((FieldDescriptor) curDesc).getType().getClassDesc();
442 cd = ((LocationDescriptor) curDesc).getEnclosingClassDesc();
453 public NTuple<Location> getLocationTuple(FlowNode fn) {
455 if (!mapFlowNodeToLocTuple.containsKey(fn)) {
456 NTuple<Descriptor> descTuple = fn.getDescTuple();
457 NTuple<Location> locTuple = new NTuple<Location>();
458 ClassDescriptor cd = null;
460 Descriptor localDesc = fn.getDescTuple().get(0);
462 if (fn.isIntermediate()) {
463 Location interLoc = new Location(md, localDesc.getSymbol());
464 interLoc.setLocDescriptor(localDesc);
465 locTuple.add(interLoc);
466 } else if (localDesc.getSymbol().equals(LocationInference.TOPLOC)) {
467 Location topLoc = new Location(md, Location.TOP);
468 topLoc.setLocDescriptor(LocationInference.TOPDESC);
469 locTuple.add(topLoc);
470 } else if (localDesc.getSymbol().equals(LocationInference.GLOBALLOC)) {
471 Location globalLoc = new Location(md, LocationInference.GLOBALLOC);
472 globalLoc.setLocDescriptor(LocationInference.GLOBALDESC);
473 locTuple.add(globalLoc);
476 for (int i = 0; i < descTuple.size(); i++) {
477 Descriptor curDesc = descTuple.get(i);
480 loc = new Location(md, curDesc.getSymbol());
481 loc.setLocDescriptor(curDesc);
482 cd = ((VarDescriptor) curDesc).getType().getClassDesc();
484 loc = new Location(cd, curDesc.getSymbol());
485 loc.setLocDescriptor(curDesc);
487 if (curDesc instanceof FieldDescriptor) {
488 cd = ((FieldDescriptor) curDesc).getType().getClassDesc();
490 cd = ((LocationDescriptor) curDesc).getEnclosingClassDesc();
498 mapFlowNodeToLocTuple.put(fn, locTuple);
500 return mapFlowNodeToLocTuple.get(fn);
503 public Set<FlowNode> getIncomingFlowNodeSet(FlowNode node) {
504 Set<FlowNode> set = new HashSet<FlowNode>();
505 getIncomingFlowNodeSet(node, set);
509 public void getIncomingFlowNodeSet(FlowNode node, Set<FlowNode> visited) {
511 for (Iterator iterator = getNodeSet().iterator(); iterator.hasNext();) {
512 FlowNode curNode = (FlowNode) iterator.next();
513 Set<FlowEdge> edgeSet = getOutEdgeSet(curNode);
515 for (Iterator iterator2 = edgeSet.iterator(); iterator2.hasNext();) {
516 FlowEdge flowEdge = (FlowEdge) iterator2.next();
518 if (node.equals(getFlowNode(flowEdge.getEndTuple()))) {
519 FlowNode incomingNode = getFlowNode(flowEdge.getInitTuple());
521 if (!visited.contains(incomingNode)) {
522 visited.add(incomingNode);
523 getIncomingFlowNodeSet(incomingNode, visited);
531 public Set<NTuple<Location>> getIncomingFlowTupleSet(FlowNode fn) {
533 NTuple<Descriptor> dstTuple = fn.getDescTuple();
535 Set<NTuple<Location>> set = new HashSet<NTuple<Location>>();
537 ClassDescriptor cd = null;
539 for (Iterator iterator = getNodeSet().iterator(); iterator.hasNext();) {
540 FlowNode node = (FlowNode) iterator.next();
542 Set<FlowEdge> edgeSet = getOutEdgeSet(node);
543 for (Iterator iterator2 = edgeSet.iterator(); iterator2.hasNext();) {
544 FlowEdge flowEdge = (FlowEdge) iterator2.next();
545 if (dstTuple.equals(flowEdge.getEndTuple())) {
546 NTuple<Descriptor> initTuple = flowEdge.getInitTuple();
547 NTuple<Location> locTuple = new NTuple<Location>();
548 for (int i = 0; i < initTuple.size(); i++) {
549 Descriptor d = initTuple.get(i);
552 loc = new Location(md, d.getSymbol());
553 cd = ((VarDescriptor) d).getType().getClassDesc();
555 loc = new Location(cd, d.getSymbol());
556 cd = ((FieldDescriptor) d).getType().getClassDesc();
567 public boolean isParameter(NTuple<Descriptor> tuple) {
568 // return true if a descriptor tuple is started with a parameter descriptor
569 Descriptor firstIdxDesc = tuple.get(0);
570 return mapParamDescToIdx.containsKey(firstIdxDesc);
573 public int getParamIdx(NTuple<Descriptor> tuple) {
574 Descriptor firstIdxDesc = tuple.get(0);
575 return mapParamDescToIdx.get(firstIdxDesc);
578 public FlowGraph clone() {
579 FlowGraph clone = new FlowGraph(md, mapParamDescToIdx);
581 // clone.setNodeSet(getNodeSet());
582 clone.setMapLocTupleToFlowNode(getMapLocTupleToFlowNode());
583 clone.setMapFlowNodeToLocTuple(getMapFlowNodeToLocTuple());
584 clone.setMapDescTupleToInferNode(getMapDescTupleToInferNode());
586 clone.setMapFlowNodeToOutEdgeSet(getMapFlowNodeToOutEdgeSet());
587 clone.setReturnNodeSet(getReturnNodeSet());
588 clone.setThisVarNode(getThisVarNode());
593 public Map<FlowNode, NTuple<Location>> getMapFlowNodeToLocTuple() {
594 return mapFlowNodeToLocTuple;
597 public void setMapFlowNodeToLocTuple(Map<FlowNode, NTuple<Location>> in) {
598 this.mapFlowNodeToLocTuple.putAll(in);
601 public Map<FlowNode, Set<FlowEdge>> getMapFlowNodeToOutEdgeSet() {
602 return mapFlowNodeToOutEdgeSet;
605 public void setMapFlowNodeToOutEdgeSet(Map<FlowNode, Set<FlowEdge>> inMap) {
606 Set<FlowNode> keySet = inMap.keySet();
607 for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
608 FlowNode key = (FlowNode) iterator.next();
609 Set<FlowEdge> newEdgeSet = new HashSet<FlowEdge>();
610 newEdgeSet.addAll(inMap.get(key));
611 mapFlowNodeToOutEdgeSet.put(key, newEdgeSet);
615 private void drawEdges(FlowNode node, BufferedWriter bw, Set<FlowNode> addedNodeSet,
616 Set<FlowEdge> addedEdgeSet) throws IOException {
618 Set<FlowEdge> edgeSet = getOutEdgeSet(node);
620 for (Iterator<FlowEdge> iterator = edgeSet.iterator(); iterator.hasNext();) {
621 FlowEdge flowEdge = iterator.next();
623 FlowNode u = flowEdge.getSrc();
624 FlowNode v = flowEdge.getDst();
626 if (u.getLocTuple().equals(flowEdge.getInitTuple())
627 && v.getLocTuple().equals(flowEdge.getEndTuple())) {
628 // only draw an edge of the actual value flow
630 if (!addedEdgeSet.contains(flowEdge)) {
632 if (!addedNodeSet.contains(u)) {
636 if (!addedNodeSet.contains(v)) {
641 bw.write("" + u.getID() + " -> " + v.getID() + ";\n");
642 addedEdgeSet.add(flowEdge);
650 private void drawNode(FlowNode node, BufferedWriter bw) throws IOException {
651 bw.write(node.getID() + " [label=\"" + node.getPrettyID() + "\"]" + ";\n");
654 public void writeGraph() throws java.io.IOException {
658 public void writeGraph(String suffix) throws java.io.IOException {
660 String graphName = "flowgraph_" + md.toString() + suffix;
661 graphName = graphName.replaceAll("[\\W]", "");
663 BufferedWriter bw = new BufferedWriter(new FileWriter(graphName + ".dot"));
664 bw.write("digraph " + graphName + " {\n");
665 bw.write("compound=true;\n");
667 // then visit every flow node
669 // Iterator<FlowNode> iter = nodeSet.iterator();
670 Iterator<FlowNode> iter = getNodeSet().iterator();
672 Set<FlowEdge> addedEdgeSet = new HashSet<FlowEdge>();
673 Set<FlowNode> addedNodeSet = new HashSet<FlowNode>();
675 while (iter.hasNext()) {
676 FlowNode node = iter.next();
678 if (node.getLocTuple().size() == 1) {
679 // here, we just care about the local variable
680 if (node.getFieldNodeSet().size() > 0) {
681 drawSubgraph(node, bw, addedEdgeSet);
684 drawEdges(node, bw, addedNodeSet, addedEdgeSet);
693 public boolean constainsNode(FlowNode node) {
694 return getNodeSet().contains(node);
697 private void drawSubgraph(FlowNode node, BufferedWriter bw, Set<FlowEdge> addedSet)
700 bw.write("subgraph cluster_" + node.getID() + "{\n");
701 bw.write("label=\"" + node.getPrettyID() + "\";\n");
703 Set<FlowNode> fieldNodeSet = node.getFieldNodeSet();
704 for (Iterator iterator = fieldNodeSet.iterator(); iterator.hasNext();) {
705 FlowNode fieldNode = (FlowNode) iterator.next();
706 if (fieldNode.getFieldNodeSet().size() > 0) {
707 drawSubgraph(fieldNode, bw, addedSet);
709 Descriptor desc = fieldNode.getDescTuple().getLastElement();
710 if (desc instanceof VarDescriptor) {
711 VarDescriptor varDesc = (VarDescriptor) desc;
712 if (varDesc.getType().isPrimitive()) {
713 bw.write(fieldNode.getID() + " [label=\"" + fieldNode.getPrettyID() + "\"];\n");
715 } else if (desc instanceof FieldDescriptor) {
716 FieldDescriptor fieldDesc = (FieldDescriptor) desc;
717 if (fieldDesc.getType().isPrimitive()) {
718 bw.write(fieldNode.getID() + " [label=\"" + fieldNode.getPrettyID() + "\"];\n");