Usages of

com.ibm.wala.types.TypeName.getPackage()
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; } }
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; }
//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 static IClass packageInfoFor(IClass clazz) { final TypeName name = clazz.getName(); final Atom packge = name.getPackage(); final TypeName packageInfoName = TypeName.findOrCreateClassName( packge.toString(), "package-info" ); return clazz.getClassLoader().lookupClass(packageInfoName); }
/** * @param m * @return true iff we can treat m as a no-op method */ protected boolean canIgnore(MemberReference m) { TypeReference T = m.getDeclaringClass(); TypeName n = T.getName(); Atom p = n.getPackage(); return (ignoredPackages.contains(p)); }
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; }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes