当前位置: 首页>>代码示例>>Java>>正文


Java IClassHierarchy.lookupClass方法代码示例

本文整理汇总了Java中com.ibm.wala.ipa.cha.IClassHierarchy.lookupClass方法的典型用法代码示例。如果您正苦于以下问题:Java IClassHierarchy.lookupClass方法的具体用法?Java IClassHierarchy.lookupClass怎么用?Java IClassHierarchy.lookupClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ibm.wala.ipa.cha.IClassHierarchy的用法示例。


在下文中一共展示了IClassHierarchy.lookupClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLayoutClass

import com.ibm.wala.ipa.cha.IClassHierarchy; //导入方法依赖的package包/类
private IClass getLayoutClass(IClassHierarchy cha, String clazzName) {
	// This is due to the fault-tolerant xml parser
	if (clazzName.equals("view")) clazzName = "View";

	IClass iclazz = null;
	if (iclazz == null)
		iclazz = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application, Utils.convertToBrokenDexBytecodeNotation(clazzName)));
	if (iclazz == null && !packageName.isEmpty())
		iclazz = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application, Utils.convertToBrokenDexBytecodeNotation(packageName + "." + clazzName)));
	if (iclazz == null)
		iclazz = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application, Utils.convertToBrokenDexBytecodeNotation("android.widget." + clazzName)));
	if (iclazz == null)	
		iclazz = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application, Utils.convertToBrokenDexBytecodeNotation("android.webkit." + clazzName)));
	if (iclazz == null)
		iclazz = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application, Utils.convertToBrokenDexBytecodeNotation("android.view." + clazzName)));
	
	// PreferenceScreen, PreferenceCategory, (i)shape, item, selector, scale, corners, solid .. tags are no classes and thus there will be no corresponding layout class
	if (iclazz == null)	
		logger.trace(Utils.INDENT + "Could not find layout class " + clazzName);

	return iclazz;
}
 
开发者ID:reddr,项目名称:LibScout,代码行数:23,代码来源:LayoutFileParser.java

示例2: isInitialNodeByCallSite

import com.ibm.wala.ipa.cha.IClassHierarchy; //导入方法依赖的package包/类
/**
 * @return True iff the given call site indicates that the enclosing call graph node is
 * considered an "initial" node.
 */
private static boolean isInitialNodeByCallSite(CGNode node, CallSiteReference callSite)
{
    IClassHierarchy cha = node.getClassHierarchy();
    MethodReference calleeMethod = callSite.getDeclaredTarget();
    IClass calleeClass = cha.lookupClass(calleeMethod.getDeclaringClass());

    if (calleeClass == null || isCapsuleInterface(calleeClass) == false) {
        return false;
    }
    if (calleeMethod.getNumberOfParameters() == 0) {
        return false;
    }
    
    return true;
}
 
开发者ID:paninij,项目名称:paninij,代码行数:20,代码来源:SoterUtil.java

示例3: lookupClass

import com.ibm.wala.ipa.cha.IClassHierarchy; //导入方法依赖的package包/类
/**
 * Looks up an IClass for a given class name
 * @param cha  a {@link IClassHierarchy}
 * @param clazzName  in java notation, e.g. "de.infsec.MyActivity"
 * @return a {@link IClass} object
 * @throws ClassNotFoundException
 */
public static IClass lookupClass(IClassHierarchy cha, String clazzName) throws ClassNotFoundException {
	if (clazzName == null)
		throw new ClassNotFoundException(Utils.INDENT + "class name is NULL");
	
	String convertedClass = Utils.convertToBrokenDexBytecodeNotation(clazzName);
	IClass iclazz = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application, convertedClass));
	
	if (iclazz == null)
		throw new ClassNotFoundException(Utils.INDENT + "[lookupClass] Could'nt lookup IClass for " + clazzName);
	
	return iclazz;
}
 
开发者ID:reddr,项目名称:LibScout,代码行数:20,代码来源:WalaUtils.java

示例4: makePublicEntrypoints

import com.ibm.wala.ipa.cha.IClassHierarchy; //导入方法依赖的package包/类
private static Iterable<Entrypoint> makePublicEntrypoints(AnalysisScope scope, IClassHierarchy cha, String entryClass) {
  Collection<Entrypoint> result = new ArrayList<Entrypoint>();
  IClass klass = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application,
      StringStuff.deployment2CanonicalTypeString(entryClass)));
  for (IMethod m : klass.getDeclaredMethods()) {
    if (m.isPublic()) {
      result.add(new DefaultEntrypoint(m, cha));
    }
  }
  return result;
}
 
开发者ID:wala,项目名称:WALA-start,代码行数:12,代码来源:ScopeFileCallGraph.java

示例5: loadCoreClass

import com.ibm.wala.ipa.cha.IClassHierarchy; //导入方法依赖的package包/类
/**
   * @param cha
   * @param coreName The name of the core to be analyzed. Should be something of the form
   *                 `-Lorg/paninij/soter/FooCore`.
   */
  public static IClass loadCoreClass(String coreName, IClassHierarchy cha)
  {
      AnalysisScope scope = cha.getScope();
      ClassLoaderReference appLoaderRef = scope.getApplicationLoader();
TypeReference typeRef = TypeReference.findOrCreate(appLoaderRef, coreName);

      IClass coreClass = cha.lookupClass(typeRef);
      if (coreClass == null)
      {
          String msg = "Failed to load a core's `IClass`: " + coreName;
          throw new IllegalArgumentException(msg);
      }
      return coreClass;
  }
 
开发者ID:paninij,项目名称:paninij,代码行数:20,代码来源:WalaUtil.java


注:本文中的com.ibm.wala.ipa.cha.IClassHierarchy.lookupClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。