private static SDGNode convertNode(SDGBuilder sdg, PDGNode node) { Operation op = null; Kind kind = null; int[] allocNodes = null; switch (node.getKind()) { case ACTUAL_IN: op = Operation.ACTUAL_IN; kind = Kind.ACTUAL_IN; break; case ACTUAL_OUT: op = Operation.ACTUAL_OUT; kind = Kind.ACTUAL_OUT; break; case CALL: op = Operation.CALL; kind = Kind.CALL; if (sdg.cfg.computeInterference) { TIntSet allocNodesAsSet = sdg.getAllocationNodes(node); if (allocNodesAsSet != null) { allocNodes = allocNodesAsSet.toArray(); } } break; case ENTRY: op = Operation.ENTRY; kind = Kind.ENTRY; break; case EXIT: op = Operation.EXIT; kind = Kind.EXIT; break; case EXPRESSION: op = Operation.ASSIGN; kind = Kind.EXPRESSION; break; case FOLDED: op = Operation.COMPOUND; kind = Kind.FOLDED; break; case FORMAL_IN: op = Operation.FORMAL_IN; kind = Kind.FORMAL_IN; break; case FORMAL_OUT: op = Operation.FORMAL_OUT; kind = Kind.FORMAL_OUT; break; case HREAD: op = Operation.REFERENCE; kind = Kind.EXPRESSION; break; case HWRITE: op = Operation.MODIFY; kind = Kind.EXPRESSION; break; case JOIN: op = Operation.COMPOUND; kind = Kind.JOIN; break; case NEW: op = Operation.DECLARATION; kind = Kind.NORMAL; break; case NORMAL: op = Operation.COMPOUND; kind = Kind.NORMAL; break; case PHI: op = Operation.ASSIGN; kind = Kind.EXPRESSION; break; case PREDICATE: op = Operation.IF; kind = Kind.PREDICATE; break; case SYNCHRONIZATION: op = Operation.MONITOR; kind = Kind.SYNCHRONIZATION; break; default: throw new IllegalStateException("Unknown node kind: " + node.getKind().name()); } SourceLocation sloc = node.getSourceLocation(); SDGNode sn = new SecurityNode( node.getId(), op, node.getLabel(), node.getPdgId(), node.getType(), sloc.getSourceFile(), sloc.getStartRow(), sloc.getStartColumn(), sloc.getEndRow(), sloc.getEndColumn(), node.getBytecodeName(), node.getBytecodeIndex()); if (node.getKind() == PDGNode.Kind.ENTRY) { PDG pdg = sdg.getPDGforId(node.getPdgId()); IMethod im = pdg.getMethod(); if (im != null) { IClass cls = im.getDeclaringClass(); if (cls != null) { String clsLoader = cls.getClassLoader().toString(); sn.setClassLoader(clsLoader); } } } if (allocNodes != null) { sn.setAllocationSites(allocNodes); } if (node.getAliasDataSources() != null) { sn.setAliasDataSources(node.getAliasDataSources()); } assert sn.getKind() == kind; return sn; }