Usages of

com.ibm.wala.types.TypeName.isArrayType()
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); }
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); }
public static String getStandartMethodSignature(IMethod method) { StringBuffer result = new StringBuffer(); // O pacote do m��todo ser�� null se ele estiver no pacote padr��o Atom methodPackage = method.getDeclaringClass().getName().getPackage(); if (methodPackage != null) { result.append(method.getDeclaringClass().getName().getPackage().toString().replaceAll("/", ".")); result.append("."); } result.append(method.getDeclaringClass().getName().getClassName()); result.append("."); if (method.isInit()) result.append(method.getDeclaringClass().getName().getClassName()); else result.append(method.getName()); result.append("("); for (int i = 0; i < method.getSelector().getDescriptor().getNumberOfParameters(); i++) { TypeName type = method.getSelector().getDescriptor().getParameters()[i]; if (type.getPackage() != null) { result.append(type.getPackage().toString().replaceAll("/", ".")); result.append("."); } result.append(ScenarioAnalyzerUtil.convertTypeSignatureToName(type.getClassName().toString())); if (type.isArrayType()) { int j = 0; while (type.toString().charAt(j++) == '[') result.append("[]"); } result.append(","); } if (result.charAt(result.length() - 1) == ',') result.deleteCharAt(result.length() - 1); return result + ")"; }
/* * @see com.ibm.wala.classLoader.IClassLoader#lookupClass(com.ibm.wala.types.TypeName) */ @SuppressWarnings("unused") @Override public IClass lookupClass(TypeName className) { if (className == null) { throw new IllegalArgumentException("className is null"); } if (DEBUG_LEVEL > 1) { System.err.println(this + ": lookupClass " + className); } // treat arrays specially: if (className.isArrayType()) { return arrayClassLoader.lookupClass(className, this, cha); } // try delegating first. IClassLoader parent = getParent(); if (parent != null) { IClass result = parent.lookupClass(className); if (result != null) { return result; } } // delegating failed. Try our own namespace. IClass result = loadedClasses.get(className); return result; }
public static String getStandartMethodSignature(IMethod method) { StringBuffer result = new StringBuffer(); Atom methodPackage = method.getDeclaringClass().getName().getPackage(); if (methodPackage != null) { result.append(method.getDeclaringClass().getName().getPackage().toString().replaceAll("/", ".")); result.append("."); } result.append(method.getDeclaringClass().getName().getClassName()); result.append("."); if (method.isInit()) result.append(method.getDeclaringClass().getName().getClassName()); else result.append(method.getName()); result.append("("); for (int i = 0; i < method.getSelector().getDescriptor().getNumberOfParameters(); i++) { TypeName type = method.getSelector().getDescriptor().getParameters()[i]; if (type.getPackage() != null) { result.append(type.getPackage().toString().replaceAll("/", ".")); result.append("."); } result.append(convertTypeSignatureToName(type.getClassName().toString())); if (type.isArrayType()) { int j = 0; while (type.toString().charAt(j++) == '[') result.append("[]"); } result.append(","); } if (result.charAt(result.length() - 1) == ',') result.deleteCharAt(result.length() - 1); return result + ")"; }
/* * @see com.ibm.wala.classLoader.IClassLoader#lookupClass(com.ibm.wala.types.TypeName) */ public IClass lookupClass(TypeName className) { if (className == null) { throw new IllegalArgumentException("className is null"); } if (DEBUG_LEVEL > 1) { System.err.println(this + ": lookupClass " + className); } // treat arrays specially: if (className.isArrayType()) { return arrayClassLoader.lookupClass(className, this, cha); } // try delegating first. IClassLoader parent = getParent(); if (parent != null) { IClass result = parent.lookupClass(className); if (result != null) { return result; } } // delegating failed. Try our own namespace. IClass result = loadedClasses.get(className); 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(); } }
/* * @see com.ibm.wala.classLoader.IClassLoader#lookupClass(com.ibm.wala.types.TypeName) */ @Override public IClass lookupClass(TypeName className) { if (className == null) { throw new IllegalArgumentException("className is null"); } if (DEBUG_LEVEL > 1) { System.err.println(this + ": lookupClass " + className); } // treat arrays specially: if (className.isArrayType()) { return arrayClassLoader.lookupClass(className, this, cha); } // try delegating first. IClassLoader parent = getParent(); if (parent != null) { IClass result = parent.lookupClass(className); if (result != null) { return result; } } // delegating failed. Try our own namespace. IClass result = loadedClasses.get(className); return result; }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes