Usages of

com.ibm.wala.types.TypeName.isClassType()
public static final String sourceFileName(TypeName name) { assert (name.isClassType()); String source = name.toString(); if (source.indexOf('$') > 0) { // remove inner classes stuff source = source.substring(0, source.indexOf('$')); } // remove 'L' source = source.substring(1); source = source + ".java"; return source; }
private CompletedSignatures getCompletedSignatures(List<SourceOrSink> pois) { IClassHierarchy cha = callGraph.getClassHierarchy(); int noOverall = 0; int noMatched = 0; Map<SourceOrSink, JavaMethodSignature> completedSigs = new HashMap<SourceOrSink, JavaMethodSignature>(); List<SourceOrSink> unmatched = new LinkedList<SourceOrSink>(); for (SourceOrSink poi : pois) { String declaringClass = poi.getDeclaringClass(); String incompleteSelector = poi.getMethod(); IClass c = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Primordial, declaringClass.replaceAll(";", ""))); if (c == null) { throw new RuntimeException(declaringClass); } boolean matched = false; for (IMethod m : c.getAllMethods()) { TypeName retTypeName = m.getSelector().getDescriptor().getReturnType(); String retType = m.getSelector().getDescriptor().getReturnType().toString(); String completedSelector = incompleteSelector + retType; if (retTypeName.isClassType() || (retTypeName.isArrayType() && retTypeName.getInnermostElementType().isClassType())) { completedSelector += ";"; } if (m.getSelector().toString().equals(completedSelector)) { completedSigs.put(poi, JavaMethodSignature.fromString(m.getSignature())); noMatched++; matched = true; break; } } if (!matched) { unmatched.add(poi); for (IMethod m : c.getAllMethods()) { System.out.println(m.getSignature()); } } noOverall++; } return new CompletedSignatures(completedSigs, noMatched, noOverall, unmatched); }
protected CompletedSignatures getCompletedSignatures(List<SourceOrSink> pois) { int noOverall = 0; int noMatched = 0; Map<SourceOrSink, MethodReference> completedSigs = new HashMap<SourceOrSink, MethodReference>(); List<SourceOrSink> unmatched = new LinkedList<SourceOrSink>(); for (SourceOrSink poi : pois) { String declaringClass = poi.getDeclaringClass(); String incompleteSelector = poi.getMethod(); IClass c = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Primordial, declaringClass.replaceAll(";", ""))); if (c == null) { throw new RuntimeException(declaringClass); } boolean matched = false; for (IMethod m : c.getAllMethods()) { TypeName retTypeName = m.getSelector().getDescriptor().getReturnType(); String retType = m.getSelector().getDescriptor().getReturnType().toString(); String completedSelector = incompleteSelector + retType; if (retTypeName.isClassType() || (retTypeName.isArrayType() && retTypeName.getInnermostElementType().isClassType())) { completedSelector += ";"; } if (m.getSelector().toString().equals(completedSelector)) { completedSigs.put(poi, m.getReference()); noMatched++; matched = true; break; } } if (!matched) { unmatched.add(poi); for (IMethod m : c.getAllMethods()) { System.out.println(m.getSignature()); } } noOverall++; } return new CompletedSignatures(completedSigs, noMatched, noOverall, unmatched); }
protected CompletedSignatures getCompletedSignatures(List<SourceOrSink> pois) { int noOverall = 0; int noMatched = 0; Map<SourceOrSink, MethodReference> completedSigs = new HashMap<SourceOrSink, MethodReference>(); List<SourceOrSink> unmatched = new LinkedList<SourceOrSink>(); for (SourceOrSink poi : pois) { String declaringClass = poi.getDeclaringClass(); String incompleteSelector = poi.getMethod(); IClass c = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Primordial, declaringClass.replaceAll(";", ""))); if (c == null) { throw new RuntimeException(declaringClass); } boolean matched = false; for (IMethod m : c.getAllMethods()) { TypeName retTypeName = m.getSelector().getDescriptor().getReturnType(); String retType = m.getSelector().getDescriptor().getReturnType().toString(); String completedSelector = incompleteSelector + retType; if (retTypeName.isClassType() || (retTypeName.isArrayType() && retTypeName.getInnermostElementType().isClassType())) { completedSelector += ";"; } if (m.getSelector().toString().equals(completedSelector)) { completedSigs.put(poi, m.getReference()); noMatched++; matched = true; break; } } if (!matched) { unmatched.add(poi); for (IMethod m : c.getAllMethods()) { System.out.println(m.getSignature()); } } noOverall++; } return new CompletedSignatures(completedSigs, noMatched, noOverall, unmatched); }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes