"""Top-level types that vanished between two jars, split into 'moved' (same simple name elsewhere) and 'gone'.""" import collections import sys import zipfile def classes(path): return {n[:-6].replace('/', '.') for n in zipfile.ZipFile(path).namelist() if n.endswith('.class') and not n.startswith('META-INF') and 'package-info' not in n and '$' not in n} old, new = classes(sys.argv[1]), classes(sys.argv[2]) added = collections.defaultdict(list) for c in new - old: added[c.rsplit('.', 1)[1]].append(c) gone = sorted(old - new) print('moved:') for c in gone: if c.rsplit('.', 1)[1] in added: print(' %s -> %s' % (c, ', '.join(sorted(added[c.rsplit('.', 1)[1]])))) print('no type of the same name in the new jar:') for c in gone: if c.rsplit('.', 1)[1] not in added: print(' ' + c)