Usages of

com.ibm.wala.types.TypeName.toString()
/** * Get the first paramNo of a given type. * * @see com.ibm.wala.util.ssa.ParameterAccessor */ private static int firstOf(TypeName type, IMethod inCallTo) { for (int i = 0; i < inCallTo.getNumberOfParameters(); ++i) { if (inCallTo.getParameterType(i).getName().equals(type)) { return i; } } throw new IllegalArgumentException(type.toString() + " is not a parameter to " + inCallTo); }
/** * Create a human readable typename from a TypeName object * convert sth like [Ljava/lang/String to java.lang.String[] * @param tName * @return type name */ public static final String typeName(TypeName tName) { StringBuilder test = new StringBuilder(tName.toString().replace('/', '.').replace('$', '.')); while (test.charAt(0) == '[') { test.deleteCharAt(0); test.append("[]"); } // remove 'L' in front of object type test.deleteCharAt(0); return test.toString(); }
/** * Create a human readable typename from a TypeName object * convert sth like [Ljava/lang/String to java.lang.String[] * @param tName * @return type name */ public static final String typeName(TypeName tName) { StringBuilder test = new StringBuilder(tName.toString().replace('/', '.')); while (test.charAt(0) == '[') { test.deleteCharAt(0); test.append("[]"); } // remove 'L' in front of object type test.deleteCharAt(0); return test.toString(); }
@Override public CostResultMemory getCostForInstructionInBlock(SSAInstruction instruction, ISSABasicBlock block, CGNode node) { TypeName typeName = ((SSANewInstruction) instruction).getNewSite().getDeclaredType().getName(); String typeNameStr = typeName.toString(); CostResultMemory cost = new CostResultMemory(); if (typeNameStr.startsWith("[")) { setCostForNewArrayObject(cost, typeName, typeNameStr, block); } else { setCostForNewObject(cost, typeName, typeNameStr, block); } return cost; }
@Override protected void defineFunction(CAstEntity N, WalkContext definingContext, AbstractCFG<SSAInstruction, ? extends IBasicBlock<SSAInstruction>> cfg, SymbolTable symtab, boolean hasCatchBlock, Map<IBasicBlock<SSAInstruction>,TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) { // N.B.: base class may actually ask to create a synthetic type to wrap // code bodies, so we may see other things than TYPE_ENTITY here. CAstType.Method methodType = (Method) N.getType(); CAstType owningType = methodType.getDeclaringType(); TypeName typeName = makeType(owningType).getName(); IClass owner = loader.lookupClass(typeName); assert owner != null : typeName.toString() + " not found in " + loader; symtab.getConstant(0); symtab.getNullConstant(); ((JavaSourceLoaderImpl) loader).defineFunction(N, owner, cfg, symtab, hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo); }
public int getSizeForQualifiedType(TypeName type) { String parsedKey = type.toString(); if (parsedKey.startsWith("L")) { parsedKey = parsedKey.substring(1); } parsedKey = parsedKey.replace('/', '.'); if (this.typeSizeByTypeName.containsKey(parsedKey)) { return this.typeSizeByTypeName.get(parsedKey); } else { throw new NoSuchElementException(); } }
private TypeName className; // code omitted ... AccessibilityMember(IMember iMember) { if (iMember instanceof IField) { memberName = iMember.getName().toString(); isField = true; } else { IMethod method = (IMethod) iMember; memberName = method.getSelector().toString(); } IClass declaringClass = iMember.getDeclaringClass(); className = declaringClass.getName(); classLoaderName = declaringClass.getClassLoader().getName().toString(); packageName = computePackageName(className.toString()); }
protected void defineFunction(CAstEntity N, WalkContext definingContext, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock, Map<IBasicBlock,TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) { // N.B.: base class may actually ask to create a synthetic type to wrap // code bodies, so we may see other things than TYPE_ENTITY here. CAstType.Method methodType = (Method) N.getType(); CAstType owningType = methodType.getDeclaringType(); TypeName typeName = makeType(owningType).getName(); IClass owner = loader.lookupClass(typeName); if (owner == null) { assert owner != null : typeName.toString() + " not found in " + loader; } symtab.getConstant(0); symtab.getNullConstant(); ((JavaSourceLoaderImpl) loader).defineFunction(N, owner, cfg, symtab, hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo); }
/** * Is enough info present to resolve Intents. * * This information is needed by the startComponent-functions in order to resolve the * target of the call (if enough context is present). * * If this information is unavailable the call will be resolved to the function * AndroidModel.Class.startUNKNOWNComponent which will call all Components of the * specific type (Activity, Service, ..) present in the application. * * @return if check passed */ public boolean checkIntentSpecs() { boolean pass = true; final List <AndroidEntryPoint> entrypoits = AndroidEntryPointManager.ENTRIES; for (AndroidEntryPoint ep : entrypoits) { final TypeName test = ep.getMethod().getDeclaringClass().getName(); if (! this.manager.existsIntentFor(test)) { if (test.toString().startsWith("Landroid/")) { continue; } pass = false; } } return pass; }
@Override protected void defineFunction(CAstEntity N, WalkContext definingContext, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock, Map<IBasicBlock,TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) { // N.B.: base class may actually ask to create a synthetic type to wrap // code bodies, so we may see other things than TYPE_ENTITY here. CAstType.Method methodType = (Method) N.getType(); CAstType owningType = methodType.getDeclaringType(); TypeName typeName = makeType(owningType).getName(); IClass owner = loader.lookupClass(typeName); if (owner == null) { assert owner != null : typeName.toString() + " not found in " + loader; } symtab.getConstant(0); symtab.getNullConstant(); ((JavaSourceLoaderImpl) loader).defineFunction(N, owner, cfg, symtab, hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo); }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes