• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TypeReference类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.ibm.wala.types.TypeReference的典型用法代码示例。如果您正苦于以下问题:Java TypeReference类的具体用法?Java TypeReference怎么用?Java TypeReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TypeReference类属于com.ibm.wala.types包,在下文中一共展示了TypeReference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getLayoutClass

import com.ibm.wala.types.TypeReference; //导入依赖的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: foundTransferringSite

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
/**
 * Adds a transfer site with every transfer which is not known to be safe. If all of the
 * transfers at a transfer site are known to be safe, then no transfer point is added.
 */
protected void foundTransferringSite(CGNode node, SSAAbstractInvokeInstruction invokeInstr)
{
    // Return static methods and dispatch methods with only the receiver argument.
    if (invokeInstr.isStatic() || invokeInstr.getNumberOfParameters() == 1)
        return;

    // Ignore any method which is not a procedure invocation on a remote capsule instance.
    IMethod targetMethod = cha.resolveMethod(invokeInstr.getDeclaredTarget());
    if (! isRemoteProcedure(targetMethod))
        return;
    
    MutableIntSet transfers = new BitVectorIntSet();
    
    for (int idx = 1; idx < targetMethod.getNumberOfParameters(); idx++)
    {
        TypeReference paramType = targetMethod.getParameterType(idx);
        if (! isKnownSafeTypeForTransfer(paramType)) {
            transfers.add(invokeInstr.getUse(idx));
        }
    }
    
    if (! transfers.isEmpty()) {
        addTransferringSite(node, new InvokeTransferSite(node, transfers, invokeInstr));
    }
}
 
开发者ID:paninij,项目名称:paninij,代码行数:30,代码来源:TransferAnalysis.java


示例3: makeReceiver

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
/**
 * @see makeArgument
 */
protected int makeReceiver(AbstractRootMethod root)
{
    constZeroValueNumber = root.addLocal();
    
    // Instantiate a capsule core instance to serve as this entrypoint's receiver object.
    // Note that every capsule core must (only) have the default constructor.
    TypeReference receiverType = method.getParameterType(0);
    SSANewInstruction receiverAllocation = root.addAllocation(receiverType);
    if (receiverAllocation == null)
        return -1;
    int receiverValueNumber = receiverAllocation.getDef();
    
    // Make a capsule mockup instance for each of the receiver's fields (i.e. all of its
    // `@Local`, `@Import`, and state fields).
    for (IField f : core.getAllFields()) {
        addCoreFieldInstance(root, f, receiverValueNumber);
    }
    
    // Initialize the newly created receiver object.
    // TODO: Debug and re-enable this.
    makeReceiverInitInvocation(root, receiverValueNumber);
    
    return receiverValueNumber;
}
 
开发者ID:paninij,项目名称:paninij,代码行数:28,代码来源:CapsuleTemplateEntrypoint.java


示例4: addCoreFieldInstance

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
/**
 * Adds an instance to the core field's. The behavior of this method will depend upon the
 * field's type and annotations. For example, if a the field is primitive or effectively
 * immutable, nothing is instantiated; if it is a capsule interface, it will delegate to
 * `addCapsuleMockup()`.
 * 
 * @param root  The fake root method to which the instantiation instructions are being added.
 * @param field A field on `core`.
 * @param receiverValueNumber Value number of the receiver instance whose field to which some
 *                            kind of object instance is being added.
 */
protected void addCoreFieldInstance(AbstractRootMethod root, IField field, int receiverValueNumber)
{
    TypeReference fieldTypeRef = field.getFieldTypeReference();
    
    if (fieldTypeRef.isArrayType()) {
        addCoreFieldArrayInstance(root, field, receiverValueNumber);
        return;
    }

    if (fieldTypeRef.isPrimitiveType() || isKnownToBeEffectivelyImmutable(fieldTypeRef)) {
        // No need to add instances for these types.
        return;
    }

    if (PaniniModel.isCapsuleInterface(getCha().lookupClass(fieldTypeRef))) {
        addCapsuleMockupInstance(root, field, receiverValueNumber);
        return;
    }

    // Otherwise, consider the field to be non-capsule state variable.
    addStateInstance(root, field, receiverValueNumber);
}
 
开发者ID:paninij,项目名称:paninij,代码行数:34,代码来源:CapsuleTemplateEntrypoint.java


示例5: isTypeValue

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
private boolean isTypeValue(int valueNumber, TypeReference type) {
   IR ir = node.getIR();
   if (ir.getSymbolTable().isNullConstant(valueNumber)) {
return false;
   }

   PointerKey pk = new LocalPointerKey(node, valueNumber);
   OrdinalSet<? extends InstanceKey> types = PA.getPointsToSet( pk );
   if (types.isEmpty()) {
     assert
       !types.isEmpty() :
       "no types for " + valueNumber + " of " + node;
   }
   boolean result = true;
   for(Iterator<? extends InstanceKey> ts = types.iterator(); ts.hasNext(); ) {
     InstanceKey t = ts.next();
     if (! t.getConcreteType().getReference().equals(type)) {
result = false;
     }
   }
   return result;
 }
 
开发者ID:wala,项目名称:MemSAT,代码行数:23,代码来源:MiniaturJavaScriptTypeData.java


示例6: Options

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
/**
 * Returns an Options instance initialized with default values.
 * @effects 
 * this.isContextSensitive' = true and
 * this.loopUnrollDepth' = 3 and
 * this.openWorldScopeSize' = 4 and
 * this.numberOfIndexAtoms' =  10 and
 * this.recursionLimit' = 1 and
 * this.primordialConcreteTypes' = {int, String} and
 * this.kodkodOptions'.solver = SATFactory.MiniSAT and
 * this.kodkodOptions'.bitwidth = 8 and 
 * this.memoryModel' = RelaxedModelFactory and
 * this.assertsAreAssumptions = false
 */
public Options() {
	this.isContextSensitive = true;
	this.loopUnrollDepth = 3;
	this.openWorldScopeSize = 4;
	this.numberOfIndexAtoms = 10;
	this.recursionLimit = 1;
	this.primordialConcreteTypes = new HashSet<TypeReference>();
	primordialConcreteTypes.add(TypeReference.JavaLangInteger);
    primordialConcreteTypes.add(TypeReference.JavaLangString);
	this.undefinedType = null;
	this.kodkodOptions = new kodkod.engine.config.Options();
	kodkodOptions.setBitwidth(8);
	kodkodOptions.setSolver(SATFactory.MiniSat);
	this.memoryModel = null;
	this.assertsAreAssumptions = false;
	this.eclipseProjectName = null;
}
 
开发者ID:wala,项目名称:MemSAT,代码行数:32,代码来源:Options.java


示例7: method

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
/**
 * Returns a method reference for the given method 
 * @return method reference for the given Method */
public static MethodReference method(Method jmethod) { 
	final TypeReference declaringClass = typeReference(jmethod.getDeclaringClass());

	final StringBuilder descriptor = new StringBuilder("(");
	for(Class<?> paramType : jmethod.getParameterTypes()) { 
		descriptor.append(bytecodeDescriptor(paramType));
	}
	descriptor.append(")");
	descriptor.append(bytecodeDescriptor(jmethod.getReturnType()));
	
	return MethodReference.findOrCreate(
			declaringClass,
			Atom.findOrCreateUnicodeAtom(jmethod.getName()), 
			Descriptor.findOrCreateUTF8(descriptor.toString()));
}
 
开发者ID:wala,项目名称:MemSAT,代码行数:19,代码来源:TestUtil.java


示例8: lookupClass

import com.ibm.wala.types.TypeReference; //导入依赖的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


示例9: makePublicEntrypoints

import com.ibm.wala.types.TypeReference; //导入依赖的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


示例10: setToSynthesizeNativeClasses

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
/**
 * TODO: Is this method name an accurate description of what this bypass logic is doing?
 */
private static void setToSynthesizeNativeClasses(IClassHierarchy cha,
                                                 AnalysisOptions options,
                                                 XMLMethodSummaryReader natives)
{
    IClassLoader loader = cha.getLoader(cha.getScope().getSyntheticLoader());
    Set<TypeReference> allocatable = natives.getAllocatableClasses();
    ClassTargetSelector parent = options.getClassTargetSelector();

    ClassTargetSelector child = new BypassClassTargetSelector(parent, allocatable, cha, loader);
    options.setSelector(child);
}
 
开发者ID:paninij,项目名称:paninij,代码行数:15,代码来源:WalaUtil.java


示例11: loadCoreClass

import com.ibm.wala.types.TypeReference; //导入依赖的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


示例12: getCapsuleMockupClassReference

import com.ibm.wala.types.TypeReference; //导入依赖的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);
}
 
开发者ID:paninij,项目名称:paninij,代码行数:11,代码来源:PaniniModel.java


示例13: addCoreFieldArrayInstance

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
/**
 * If appropriate, instantiate and add an array instance in the given fake root.
 */
protected void addCoreFieldArrayInstance(AbstractRootMethod root, IField field,
                                             int receiverValueNumber)
{
    // Currently, when an array is instantiated it is instantiated with size 1, and when
    // elements need to be instantiated only the 0th is instantiated.
    // TODO: Is this bad?
    final int DEFAULT_ARRAY_LENGTH = 1;

    TypeReference arrayTypeRef = field.getFieldTypeReference();
    int dimensionality = arrayTypeRef.getDimensionality();
    if (dimensionality > 1)
    {
        String msg = "TODO: Cannot yet add instances for array whose dimensionality is ";
        throw new UnsupportedOperationException(msg + dimensionality);
    }
    
    SSAInstruction newArrayInstr = root.add1DArrayAllocation(arrayTypeRef, DEFAULT_ARRAY_LENGTH);

    TypeReference elemTypeRef = arrayTypeRef.getArrayElementType();
    if (elemTypeRef.isPrimitiveType() || isKnownToBeEffectivelyImmutable(elemTypeRef))
    {
        // No need to add instances for the elements of these types of arrays.
        return;
    }

    // Add a single new mockup instance if the array's elements are capsule interfaces.
    if (PaniniModel.isCapsuleInterface(getCha().lookupClass(elemTypeRef)))
    {
        int mockupValueNumber = newCapsuleMockupInstance(root, elemTypeRef);
        root.addSetArrayField(elemTypeRef, newArrayInstr.getDef(), constZeroValueNumber,
                              mockupValueNumber);
        return;
    }
    
    // Otherwise, assume that the elements of the array should be initialized in source code.
    // TODO: Is this right.
}
 
开发者ID:paninij,项目名称:paninij,代码行数:41,代码来源:CapsuleTemplateEntrypoint.java


示例14: iterator

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
public Iterator<Entrypoint> iterator() {

		return new Iterator<Entrypoint>() {
			private int index = 0;
			private final int subtypesBound = 10;

			public void remove() {
				Assertions.UNREACHABLE();
			}

			public boolean hasNext() {
				return index < methods.size();
			}

			public Entrypoint next() {
			  return
				new SubtypesEntrypoint(methods.get(index++), cha)
				{
					protected TypeReference[] makeParameterTypes(IMethod method, int i) 
					{
						TypeReference[] all = super.makeParameterTypes(method, i);
						if (all.length > subtypesBound) {
							TypeReference[] some = new TypeReference[ subtypesBound ];
							for(int j = 0; j < subtypesBound; j++) {
								some[j] = all[j];
							}

							return some;
						} else {
							return all;
						}
					}
				};
			}
		};
	}
 
开发者ID:wala,项目名称:MemSAT,代码行数:37,代码来源:MiniaturJavaEntrypoints.java


示例15: valueOf

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
/**
 * Returns an expression that models the set of all instances of the given type.
 * @return an expression that models the set of all instances of the given type.
 */
public final Expression valueOf(TypeReference type) { 
	final List<Expression> parts = new ArrayList<Expression>();
	for(InstanceKey key : sets.keySet()) { 
		IClassHierarchy cha = key.getConcreteType().getClassHierarchy();
		if (cha.isSubclassOf(key.getConcreteType(), cha.lookupClass(type))) {
			parts.add(sets.get(key));
		}
	}
	return parts.isEmpty() ? Expression.NONE : Expression.union(parts);
}
 
开发者ID:wala,项目名称:MemSAT,代码行数:15,代码来源:ConstantFactory.java


示例16: valueInterpreter

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
/**
 * Returns an interpreter for the value read or written by the given inlined instruction.
 * @requires inst.action in NORMAL_READ + VOLATILE_READ + NORMAL_WRITE + VOLATILE_WRITE
 * @return an interpreter for the value read or written by the given inlined instruction.
 */
private final Interpreter<Object> valueInterpreter(InlinedInstruction inst) { 
	final ConstantFactory consts = translation.factory().constants();
	final TypeReference type;
	if (inst.instruction() instanceof SSAFieldAccessInstruction) { 
		type = ((SSAFieldAccessInstruction)inst.instruction()).getDeclaredFieldType();
	} else {
		type = ((SSAArrayReferenceInstruction)inst.instruction()).getElementType();
	}
	return consts.interpreter(IRType.convert(type));
}
 
开发者ID:wala,项目名称:MemSAT,代码行数:16,代码来源:ConcurrentStringVisualizer.java


示例17: typeReference

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
/**
 * Returns the type reference for the given class. 
 * @return type reference for the given class */
public static TypeReference typeReference(Class<?> jclass) { 
	return TypeReference.findOrCreate(
			JavaSourceAnalysisScope.SOURCE, 
			"L" + jclass.getName().replace('.','/'));
	
}
 
开发者ID:wala,项目名称:MemSAT,代码行数:10,代码来源:TestUtil.java


示例18: isKnownToBeEffectivelyImmutable

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
public static boolean isKnownToBeEffectivelyImmutable(TypeReference typeRef)
{
    return isKnownToBeEffectivelyImmutable(typeRef.getName().toString());
}
 
开发者ID:paninij,项目名称:paninij,代码行数:5,代码来源:SoterUtil.java


示例19: isKnownSafeTypeForTransfer

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
public static boolean isKnownSafeTypeForTransfer(TypeReference typeRef)
{
    // TODO: Add String and primitive box types (e.g. Integer).
    return typeRef.isPrimitiveType();
}
 
开发者ID:paninij,项目名称:paninij,代码行数:6,代码来源:PaniniModel.java


示例20: method

import com.ibm.wala.types.TypeReference; //导入依赖的package包/类
/** @return method reference corresponding to the given arguments */
private static MethodReference method(TypeReference type, String name, String descriptor) { 
	return MethodReference.findOrCreate(type, 
			Atom.findOrCreateUnicodeAtom(name), 
			Descriptor.findOrCreateUTF8(descriptor));
}
 
开发者ID:wala,项目名称:MemSAT,代码行数:7,代码来源:SpecialTranslatorFactory.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NodeAVL类代码示例发布时间:2022-05-22
下一篇:
Java PrivilegedGetTccl类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap