Usages of

com.ibm.wala.types.TypeName.string2TypeName(?)
private MethodReference getSliceRootReference(String className, String methodName, String methodDescriptor) { TypeName clsName = TypeName.string2TypeName("L" + className.replace('.', '/')); TypeReference clsRef = TypeReference.findOrCreate(JavaSourceAnalysisScope.SOURCE, clsName); Atom nameAtom = Atom.findOrCreateUnicodeAtom(methodName); Descriptor descr = Descriptor.findOrCreateUTF8(Language.JAVA, methodDescriptor); return MethodReference.findOrCreate(clsRef, nameAtom, descr); }
@Test public void test1() throws InvalidClassFileException { TypeReference t = TypeReference.findOrCreate(ClassLoaderReference.Application, TypeName .string2TypeName("Linner/TestStaticInner")); IClass klass = cha.lookupClass(t); assert klass != null; ShrikeClass s = (ShrikeClass)klass; Assert.assertFalse(s.isInnerClass()); }
/** * @param T a type reference * @return a synthetic class name to represent the synthetic form of this type * @throws IllegalArgumentException if T is null */ public static TypeName getName(TypeReference T) { if (T == null) { throw new IllegalArgumentException("T is null"); } String s = "L$" + T.getName().toString().substring(1); return TypeName.string2TypeName(s); }
private static MethodReference getSliceRootReference(String className, String methodName, String methodDescriptor) { TypeName clsName = TypeName.string2TypeName("L" + className.replace('.', '/')); TypeReference clsRef = TypeReference.findOrCreate(JavaSourceAnalysisScope.SOURCE, clsName); Atom nameAtom = Atom.findOrCreateUnicodeAtom(methodName); Descriptor descr = Descriptor.findOrCreateUTF8(Language.JAVA, methodDescriptor); return MethodReference.findOrCreate(clsRef, nameAtom, descr); }
/** * Utility function. Useful when parsing input. */ public MethodReference findMethod(Atom loader, String klass, Atom name, ImmutableByteArray desc) { if (desc == null) { throw new IllegalArgumentException("null desc"); } ClassLoaderReference clr = getLoader(loader); Descriptor ddesc = Descriptor.findOrCreate(languages.get(clr.getLanguage()), desc); TypeReference type = TypeReference.findOrCreate(clr, TypeName.string2TypeName(klass)); return MethodReference.findOrCreate(type, name, ddesc); }
static TypeReference findOrCreateTypeReference(String loaderName, String typeStr, IClassHierarchy cha) { ClassLoaderReference clr = findLoader(loaderName, cha); TypeName typeName = TypeName.string2TypeName("L" + typeStr); TypeReference typeRef = TypeReference.findOrCreate(clr, typeName); return typeRef; }
public Entrypoint next() { Atom mainMethod = Atom.findOrCreateAsciiAtom(methodNames[index]); TypeReference T = TypeReference.findOrCreate(loaderRef, TypeName.string2TypeName(classNames[index])); MethodReference mainRef = MethodReference.findOrCreate(T, mainMethod, Descriptor .findOrCreateUTF8(methodDescriptors[index++])); return new DefaultEntrypoint(mainRef, cha); }
@Override protected void leaveTypeLiteralExpr(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) { WalkContext wc = c; assert n.getChild(0).getKind() == CAstNode.CONSTANT; String typeNameStr = (String) n.getChild(0).getValue(); TypeName typeName = TypeName.string2TypeName(typeNameStr); TypeReference typeRef = TypeReference.findOrCreate(loader.getReference(), typeName); int result = wc.currentScope().allocateTempValue(); c.setValue(n, result); wc.cfg().addInstruction(insts.LoadMetadataInstruction(wc.cfg().currentInstruction, result, loader.getLanguage().getConstantType(typeRef), typeRef)); }
protected void leaveTypeLiteralExpr(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) { WalkContext wc = (WalkContext) c; assert n.getChild(0).getKind() == CAstNode.CONSTANT; String typeNameStr = (String) n.getChild(0).getValue(); TypeName typeName = TypeName.string2TypeName(typeNameStr); TypeReference typeRef = TypeReference.findOrCreate(loader.getReference(), typeName); int result = wc.currentScope().allocateTempValue(); c.setValue(n, result); wc.cfg().addInstruction(insts.LoadMetadataInstruction(result, loader.getLanguage().getConstantType(typeRef), typeRef)); }
@Override protected void doNewObject(WalkContext context, CAstNode newNode, int result, Object type, int[] arguments) { assert arguments == null; TypeReference typeRef = TypeReference.findOrCreate(JavaScriptTypes.jsLoader, TypeName.string2TypeName("L" + type)); context.cfg().addInstruction(insts.NewInstruction(context.cfg().getCurrentInstruction(), result, NewSiteReference.make(context.cfg().getCurrentInstruction(), typeRef))); }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes