Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7N4ZDbUtA3ofqAqRV
25 lines
833 B
Python
25 lines
833 B
Python
"""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)
|