@Override public final boolean equals(Object other) { assert other != null && other instanceof Key; Key that = (Key) other; return (name.equals(that.name) && classloader.equals(that.classloader)); } }
/** * @return the unique name that identifies this class loader. */ @Override public Atom getName() { return me.getName(); }
private IClassHierarchy getHierarchy(ClassLoaderReference loader) { return getHierarchy(loader.getLanguage()); }
for (Map.Entry<ClassLoaderReference, List<Module>> e : moduleMap.entrySet()) { ClassLoaderReference lrReference = e.getKey(); String moduleLdr = lrReference.getName().toString(); String moduleLang = lrReference.getLanguage().toString(); assert Language.JAVA.getName().equals(lrReference.getLanguage()) : "Java language only is currently supported"; for (Map.Entry<ClassLoaderReference, String> e : loaderImplByRef.entrySet()) { ClassLoaderReference lrReference = e.getKey(); String ldrName = lrReference.getName().toString(); String ldrLang = lrReference.getLanguage().toString(); assert Language.JAVA.getName().equals(lrReference.getLanguage()) : "Java language only is currently supported"; String ldrImplName = e.getValue(); String ldrImplDescrLine = String.format("%s,%s,%s,%s", ldrName, ldrLang, "loaderImpl", ldrImplName);
/** * Initialize the standard 3 class loaders for java analysis */ protected void initCoreForJava() { ClassLoaderReference primordial = new ClassLoaderReference(PRIMORDIAL, ClassLoaderReference.Java, null); ClassLoaderReference extension = new ClassLoaderReference(EXTENSION, ClassLoaderReference.Java, primordial); ClassLoaderReference application = new ClassLoaderReference(APPLICATION, ClassLoaderReference.Java, extension); loadersByName.put(PRIMORDIAL, primordial); loadersByName.put(EXTENSION, extension); loadersByName.put(APPLICATION, application); }
/** * Return a class loader corresponding to a given class loader identifier. * Create one if necessary. * * @param classLoaderReference * identifier for the desired class loader */ @Override public IClassLoader getLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, AnalysisScope scope) throws IOException { if (classLoaderReference == null) { throw new IllegalArgumentException("null classLoaderReference"); } IClassLoader result = map.get(classLoaderReference); if (result == null) { ClassLoaderReference parentRef = classLoaderReference.getParent(); IClassLoader parent = null; if (parentRef != null) { parent = getLoader(parentRef, cha, scope); } IClassLoader cl = makeNewClassLoader(classLoaderReference, cha, parent, scope); map.put(classLoaderReference, cl); result = cl; } return result; }
for (Map.Entry<ClassLoaderReference, List<Module>> e : moduleMap.entrySet()) { ClassLoaderReference lrReference = e.getKey(); String moduleLdr = lrReference.getName().toString(); String moduleLang = lrReference.getLanguage().toString(); assert Language.JAVA.getName().equals(lrReference.getLanguage()) : "Java language only is currently supported"; for (Map.Entry<ClassLoaderReference, String> e : loaderImplByRef.entrySet()) { ClassLoaderReference lrReference = e.getKey(); String ldrName = lrReference.getName().toString(); String ldrLang = lrReference.getLanguage().toString(); assert Language.JAVA.getName().equals(lrReference.getLanguage()) : "Java language only is currently supported"; String ldrImplName = e.getValue(); String ldrImplDescrLine = String.format("%s,%s,%s,%s", ldrName, ldrLang, "loaderImpl", ldrImplName);
/** * Initialize the standard 3 class loaders for java analysis */ protected void initCoreForJava() { ClassLoaderReference primordial = new ClassLoaderReference(PRIMORDIAL, ClassLoaderReference.Java, null); ClassLoaderReference extension = new ClassLoaderReference(EXTENSION, ClassLoaderReference.Java, primordial); ClassLoaderReference application = new ClassLoaderReference(APPLICATION, ClassLoaderReference.Java, extension); loadersByName.put(PRIMORDIAL, primordial); loadersByName.put(EXTENSION, extension); loadersByName.put(APPLICATION, application); }
/** * Return a class loader corresponding to a given class loader identifier. * Create one if necessary. * * @param classLoaderReference * identifier for the desired class loader */ @Override public IClassLoader getLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, AnalysisScope scope) throws IOException { if (classLoaderReference == null) { throw new IllegalArgumentException("null classLoaderReference"); } IClassLoader result = map.get(classLoaderReference); if (result == null) { ClassLoaderReference parentRef = classLoaderReference.getParent(); IClassLoader parent = null; if (parentRef != null) { parent = getLoader(parentRef, cha, scope); } IClassLoader cl = makeNewClassLoader(classLoaderReference, cha, parent, scope); map.put(classLoaderReference, cl); result = cl; } return result; }
@Override public final boolean equals(Object other) { assert other != null && other instanceof Key; Key that = (Key) other; return (name.equals(that.name) && classloader.equals(that.classloader)); } }
/** * @return the unique name that identifies this class loader. */ @Override public Atom getName() { return me.getName(); }
private static Atom getLanguage(TypeReference type) { return type.getClassLoader().getLanguage(); }
/** * Create the class loader for synthetic classes. */ protected void initSynthetic(ClassLoaderReference parent) { ClassLoaderReference synthetic = new ClassLoaderReference(SYNTHETIC, ClassLoaderReference.Java, parent); setLoaderImpl(synthetic, "com.ibm.wala.ipa.summaries.BypassSyntheticClassLoader"); loadersByName.put(SYNTHETIC, synthetic); }
private static void computeClassPath(AnalysisScope scope) { StringBuilder buf = new StringBuilder(); ClassLoaderReference cl = scope.getApplicationLoader(); while (cl != null) { List<Module> modules = scope.getModules(cl); for (Module m : modules) { if (buf.length() > 0) buf.append(File.pathSeparator); if (m instanceof JarFileModule) { JarFileModule jarFileModule = (JarFileModule) m; buf.append(jarFileModule.getAbsolutePath()); } else if (m instanceof DirectoryTreeModule) { DirectoryTreeModule directoryTreeModule = (DirectoryTreeModule) m; buf.append(directoryTreeModule.getPath()); } else Assertions.UNREACHABLE("Module entry is neither jar file nor directory"); } cl = cl.getParent(); } }
private static boolean isApplicationCode(final TypeReference tref) { return tref.getClassLoader().equals(ClassLoaderReference.Application); }
@Override public Atom getName() { return loader.getName(); }
private static Atom getLanguage(TypeReference type) { return type.getClassLoader().getLanguage(); }
/** * Create the class loader for synthetic classes. */ protected void initSynthetic(ClassLoaderReference parent) { ClassLoaderReference synthetic = new ClassLoaderReference(SYNTHETIC, ClassLoaderReference.Java, parent); setLoaderImpl(synthetic, "com.ibm.wala.ipa.summaries.BypassSyntheticClassLoader"); loadersByName.put(SYNTHETIC, synthetic); }
cl = cl.getParent();
private static boolean isAPIComponent(final IClass cls) { ClassLoaderReference clr = cls.getClassLoader().getReference(); if (! (clr.equals(ClassLoaderReference.Primordial) || clr.equals(ClassLoaderReference.Extension))) { if (cls.getName().toString().startsWith("Landroid/")) { return true; } return false; } else { return true; } }