Usages of

com.ibm.wala.types.TypeName.getClassName()
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); }
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; } }
//return like a.b.c.d public static String getJavaFullClassName(IClass clazz) { TypeName tn = clazz.getName(); String packageName = (tn.getPackage() == null ? "" : tn.getPackage().toString() + "."); String clazzName = tn.getClassName().toString(); return Utils.translateSlashToDot(packageName) + clazzName; }
private String getClassCanonicalName(IMethod method) { TypeName clazz = method.getDeclaringClass().getName(); String className = ClassUtils.getCanonicalName(clazz.getPackage().toString() .replace("/", "."), clazz.getClassName().toString()); // if(className.contains("$")){ // className = className.substring(0, className.indexOf("$")); // } return className; }
// return like a.b.c.d public static String getJavaFullClassName(IClass clazz) { TypeName tn = clazz.getName(); String packageName = (tn.getPackage() == null ? "" : tn.getPackage() .toString() + "."); String clazzName = tn.getClassName().toString(); return Utils.translateSlashToDot(packageName) + clazzName; }
public static String getJavaFullClassName(IClass clazz) { TypeName tn = clazz.getName(); String packageName = (tn.getPackage() == null ? "" : tn.getPackage().toString() + "."); String clazzName = tn.getClassName().toString(); return translateSlashToDot(packageName) + clazzName; }
private String getClassName(IClass clazz){ TypeName typeName = clazz.getName(); return typeName.getPackage().toString().replaceAll("/", ".")+ "." + typeName.getClassName(); }
/** * Findbugs needs the name of the class that contains the bug. The class * name that WALA returns includes some additional information such as the * method name in case of anonymous classes. But, Findbugs expects names * that follow the standard Java bytecode convention. This method takes a * class name as reported by WALA and returns the name of the innermost * enclosing non-anonymous class of it. See issue #5 for more details. * * @param typeName * @return */ public static String getEnclosingNonanonymousClassName(TypeName typeName) { String packageName = typeName.getPackage().toString().replaceAll("/", "."); int indexOfOpenParen = packageName.indexOf('('); if (indexOfOpenParen != -1) { int indexOfLastPackageSeparator = packageName.lastIndexOf('.', indexOfOpenParen); return packageName.substring(0, indexOfLastPackageSeparator); } String className = typeName.getClassName().toString(); int indexOfDollarSign = className.indexOf('$'); if (indexOfDollarSign != -1) { className = className.substring(0, indexOfDollarSign); } return packageName + "." + className; }
private static Predicate<IMethod> fromClass(final String needleClassName) { return new Predicate<IMethod>() { @Override public boolean test(IMethod t) { TypeName typeName = t.getDeclaringClass().getName(); String testClassName = atomToStr(typeName.getClassName()); String testPkgName = atomToStr(typeName.getPackage()); String fullClassName = "L"+testPkgName + "/" + testClassName; boolean matchFound = needleClassName.equals(fullClassName); logger.debug("Comparing class: "+fullClassName+"\n"+ "with: "+needleClassName); logger.debug(" matches? "+matchFound); return matchFound; } }; }
public String toString() { TypeName t = cls.getName(); boolean isFinal; try { // see JVM specification section 4.3 for modifiers definitions int modifiers = cls.getModifiers(); isFinal = (modifiers & 0x0010) != 0; } catch (UnsupportedOperationException op) { // fakeRoot / synthetic classes do not support getModifiers // as they are build during analysis they cannot be extended by // the base program and therefore are final isFinal = true; } String str = (isFinal ? "final " : "") + "class " + t.getPackage() + "." + t.getClassName() + "\n"; for (Method m : contained) { str += "\t" + m + "\n"; } return str; }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes