本文整理汇总了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;
}
}