AsmAnalyzer { void findClassesDerivingFrom(String super_name, Map<String, ClassReader> zipClasses, Map<String, ClassReader> inOutFound) throws LogAbortException { if (mExcludedClasses.contains(getOuterClassName(super_name))) { return; } findClass(super_name, zipClasses, inOutFound); for (Entry<String, ClassReader> entry : zipClasses.entrySet()) { String className = entry.getKey(); if (super_name.equals(className)) { continue; } ClassReader classReader = entry.getValue(); ClassReader parent_cr = classReader; while (parent_cr != null) { String parent_name = internalToBinaryClassName(parent_cr.getSuperName()); if (parent_name == null) { break; } else if (super_name.equals(parent_name)) { inOutFound.put(className, classReader); break; } parent_cr = zipClasses.get(parent_name); } } } AsmAnalyzer(Log log, List<String> osJarPath, AsmGenerator gen,
            String[] deriveFrom, String[] includeGlobs, Set<String> excludeClasses,
            String[] includeFileGlobs); void analyze();  }
@Test public void testFindClassesDerivingFrom() throws LogAbortException, IOException { Map<String, ClassReader> zipClasses = new TreeMap<String, ClassReader>(); Map<String, InputStream> filesFound = new TreeMap<String, InputStream>(); mAa.parseZip(mOsJarPath, zipClasses, filesFound); TreeMap<String, ClassReader> found = new TreeMap<String, ClassReader>(); mAa.findClassesDerivingFrom("mock_android.view.View", zipClasses, found); assertArrayEquals(new String[] { "mock_android.view.View", "mock_android.view.ViewGroup", "mock_android.widget.LinearLayout", "mock_android.widget.TableLayout", }, found.keySet().toArray()); for (String key : found.keySet()) { ClassReader value = found.get(key); assertNotNull("No value for " + key, value); assertEquals(key, AsmAnalyzer.classReaderToClassName(value)); } }