static Map classSizeInBytes_cache = weakHashMap(); static int classSizeInBytes(Class c) { Int size = classSizeInBytes_cache.get(c); if (size == null) classSizeInBytes_cache.put(c, size = classSizeInBytes_uncached(c)); ret size; } static int classSizeInBytes_uncached(Class c) ctex { L files = cast get(getClassLoader(c), 'files); S name = c.getName().replace('.', '/') + ".class"; for (File location : files) if (location.isDirectory()) { File f = new File(location, name); if (f.exists()) ret toInt_checked(fileSize(f)); } else if (location.isFile()) pcall { temp ZipFile zip = new ZipFile(location); ZipEntry entry = zip.getEntry(name); if (entry != null) ret toInt_checked(entry.getSize()); } print(name + " not found in: " + files); ret -1; }