Usages of

com.ibm.wala.types.TypeName.isPrimitiveType()
private void addAllAppropriateParameterNodesFrom(Set<SDGNode> start, AnnotationType type, Set<SDGNode> base) { LinkedList<SDGNode> toDo = new LinkedList<SDGNode>(); toDo.addAll(start); Set<SDGNode> visited = new HashSet<SDGNode>(); // add all parameter nodes of right type and reachable by PS edges while (!toDo.isEmpty()) { SDGNode next = toDo.poll(); visited.add(next); TypeName paramName = TypeName.findOrCreate(next.getType()); /** annotate root parameters if their type is either primitive (non-void!) or they have no fields (like e.g. types assumed to be immutable) */ if (paramName.isPrimitiveType() && !TypeReference.VoidName.equals(paramName) || !hasFields(next)) { base.add(next); } else if (isParameterNodeOfKind(next, type)) { base.add(next); } for (SDGEdge e : sdg.getOutgoingEdgesOfKind(next, SDGEdge.Kind.PARAMETER_STRUCTURE)) { SDGNode succNode = e.getTarget(); if (!visited.contains(succNode)) { toDo.add(succNode); } } } }
private String toString(TypeName tn) { String result; if (tn.isPrimitiveType()) { if (tn == TypeReference.BooleanName) { result = "boolean"; } else if (tn == TypeReference.ByteName) { result = "byte"; } else if (tn == TypeReference.CharName) { result = "char"; } else if (tn == TypeReference.DoubleName) { result = "double"; } else if (tn == TypeReference.FloatName) { result = "float"; } else if (tn == TypeReference.IntName) { result = "int"; } else if (tn == TypeReference.LongName) { result = "long"; } else if (tn == TypeReference.ShortName) { result = "short"; } else if (tn == TypeReference.VoidName) { result = "void"; } else { throw new UnsupportedOperationException(); } } else { result = tn.toString().substring(1); } return result; }
public static final String type2string(TypeName tName) { if (tName.isArrayType()) { return type2string(tName.getInnermostElementType()) + "[]"; } if (tName.isPrimitiveType()) { switch (tName.toString().charAt(0)) { case 'Z': return "boolean"; case 'S': return "short"; case 'J': return "long"; case 'I': return "int"; case 'F': return "float"; case 'D': return "double"; case 'C': return "char"; case 'B': return "byte"; default: return tName.toString(); } } else { StringBuilder test = new StringBuilder(tName.toString().replace('/', '.')); // remove 'L' in front of object type test.deleteCharAt(0); return test.toString(); } }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes