本文整理匯總了Java中com.ibm.wala.types.TypeName類的典型用法代碼示例。如果您正苦於以下問題:Java TypeName類的具體用法?Java TypeName怎麽用?Java TypeName使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TypeName類屬於com.ibm.wala.types包,在下文中一共展示了TypeName類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toQualifiedName
import com.ibm.wala.types.TypeName; //導入依賴的package包/類
private static String toQualifiedName(TypeName typeName)
{
String packageName = new String(typeName.getPackage().getValArray());
String className = new String(typeName.getClassName().getValArray());
if (packageName.isEmpty()) {
return className;
} else {
return packageName + "/" + className;
}
}
示例2: getCapsuleMockupClassReference
import com.ibm.wala.types.TypeName; //導入依賴的package包/類
public static TypeReference getCapsuleMockupClassReference(TypeReference capsuleInterface)
{
ClassLoaderReference loader = capsuleInterface.getClassLoader();
TypeName interfaceName = capsuleInterface.getName();
String pkg = interfaceName.getPackage().toString();
String name = interfaceName.getClassName().toString() + CAPSULE_MOCKUP_SUFFIX;
return TypeReference.findOrCreateClass(loader, pkg, name);
}
示例3: getCallGraph
import com.ibm.wala.types.TypeName; //導入依賴的package包/類
/**
* Gets callgraph for given parameters (binary analysis only)
* @param exclusionFilePath
* @param classPath
* @param entryClass
* @param entryMethod
* @return
*/
public static CallGraph getCallGraph(String exclusionFilePath, String classPath, String entryClass, String entryMethod) {
AnalysisScope scope = null;
ClassHierarchy cha = null;
HashSet<Entrypoint> entryPoints = null;
try {
File exclusionFile = new File(exclusionFilePath);
scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classPath, exclusionFile); // works with class and jar files
cha = ClassHierarchyFactory.make(scope);
ClassLoaderReference clr = scope.getApplicationLoader();
entryPoints = HashSetFactory.make();
for(IClass class1 : cha) {
if(class1.getClassLoader().getReference().equals(clr)) {
Collection<IMethod> allMethods = class1.getDeclaredMethods();
for(IMethod m : allMethods) {
if(m.isPrivate()) {
continue;
}
TypeName tn = m.getDeclaringClass().getName();//MainApplication
if(tn.toString().contains("/" + entryClass) && m.getName().toString().contains(entryMethod)) { // TODO: too weak
entryPoints.add(new DefaultEntrypoint(m, cha));
}
}
}
}
// Iterable<Entrypoint> result1 = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha); // uses the static main methods as entry methods
if(entryPoints.size() == 0) {
log.error("Could not find specified entry point for analysis.\n" +
" path: " + classPath + "\n" +
" class: " + entryClass + "\n" +
" method: " + entryMethod);
System.exit(1);
}
AnalysisOptions options = new AnalysisOptions(scope, entryPoints);
// CallGraphBuilder builder = com.ibm.wala.ipa.callgraph.impl.Util.makeRTABuilder(options, new AnalysisCacheImpl(), cha, scope); // Rapid Type Analysis
SSAPropagationCallGraphBuilder builder = com.ibm.wala.ipa.callgraph.impl.Util.makeZeroCFABuilder(options, new AnalysisCacheImpl(), cha, scope); // 0-CFA = context-insensitive, class-based heap
// CallGraphBuilder builder = com.ibm.wala.ipa.callgraph.impl.Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope); // 0-1-CFA = context-insensitive, allocation-site-based heap
// CallGraphBuilder builder = com.ibm.wala.ipa.callgraph.impl.Util.makeZeroOneContainerCFABuilder(options, new AnalysisCacheImpl(), cha, scope); // 0-1-Container-CFA = object-sensitive container
return builder.makeCallGraph(options);
} catch (Exception e) {
log.error("Error while building the call graph");
e.printStackTrace();
System.exit(1);
return null;
}
}