- refactor(8.5.1): split render/engine/uniform/impl 28 classes into hand/sky/esp/post/ui/world(+liquid) leaves - refactor(8.5.1): split renderer/ui top 28 files into blur/batches(+ordered)/item/deferred(+sched)/pass/dispatch leaves; add tools/pkgsplit scripts (split_struct.py, promote.py) for reproducible waves - refactor(8.5.1): split render/engine/text 24 files into font(+faces/info)/glyph/msdf/render/command leaves; fiximports tool; disambiguate Font/GlyphAtlasManager shadowing - refactor(8.5.1): split nondraggable/impl into bars(+jump)/locator(+panel)/buttons/tooltips/dynamicisland/overlay; promote.py +8-indent & ctor support - refactor(8.5.1): nondraggable dynamicisland 5->4 files (IslandUiUtil into controls) - refactor(8.5.1): split features/gui/clickgui top 20 files into render/screen/editor/input/tabs/picker/font; ClickGuiModel records nested - refactor(8.5.1): picker 6->5+screen leaf - refactor(8.5.1): picker catalog leaf (picker=2: state+icon manager) - refactor(tools): improve pkgsplit import handling (fiximports v2) - refactor(8.5.1): split util/text 8 -> mask/format/edit leaves (≤4) - refactor(8.5.1): split util/network 5, util/player/effect 5, util/media 5 (+ shadow fix) - refactor(8.5.1): split util/pvp 13, util/projectile 13, util/block 8 - refactor(8.5.1): split util/wav 9, util/item 9, util/combat 9, util/player/inventory 9 - refactor(8.5.1): split render/helpers 16 + config/values 16 - refactor(8.5.1): split renderer/ui/draw 23 -> shape/box/corner/edge/paint/effect - refactor(8.5.1): split render/engine/command 17 -> core/shape/effect/texture/world - refactor(8.5.1): split renderer/ui/runtime/script 23 -> engine/runtime/module/registry/render/patch - refactor(8.5.1): split profiler 14 + hud 14 + addon 14 - refactor(8.5.1): split iris 13 + profile 13 + text/backend 12 - refactor(8.5.1): split config 12 + module 12 + cosmetic 11 - refactor(8.5.1): split rhi/pipeline 11 + mixininterface 11 + config/common/impl 11 - refactor(8.5.1): split util/player 10 + rhi/resource 10 + runtime/render 10 - refactor(8.5.1): split rhi 9 + svg 9 + command 8 - refactor(8.5.1): split core 9 + postprocess 9 + combat 9 - refactor(8.5.1): split command/impl 16 + modules/player 14 + modules/misc 12 - refactor(8.5.1): split ui/runtime 43 -> core/style/input/reconcile/asset - refactor(8.5.1): split session/microsoft 8 + relations 7 + animation 7 - refactor(8.5.1): split engine/world 7 + postprocess/graph 7 + api/v0/render 7 - refactor(8.5.1): split sodium 12 + aiming 21 - refactor(8.5.1): split хвост 13 папок 34 файла - fix(8.5.1): видимость членов и enum после расщепления пакетов - refactor(8.5.1): FailRotationProcessor -> processors root (impl 5 -> 4) - docs(8.5.1): TODO — волна 8.5.1 завершена (0 папок >4 файлов) - refactor(8.5.2): split LoVisualAltManagerScreen 1113 -> 11 файлов alt/ (≤200 строк) - docs(8.5.2): LoVisualAltManagerScreen сплит завершён - refactor(8.5.2): split UiPrimitiveRenderer 1053 -> фасад 188 + primitive/ + rect/ (7 файлов ≤200); fix readPoints индексация - docs(8.5.2): UiPrimitiveRenderer сплит завершён
67 lines
3.2 KiB
Python
67 lines
3.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Depth-aware sweep: promote ALL package-private member declarations
|
|
(fields, methods, constructors, nested types) inside class bodies of a tree.
|
|
Skips private members deliberately? No — the wave policy: everything that was
|
|
package-private becomes public; existing public/private untouched.
|
|
Usage: member_sweep.py BASE"""
|
|
import os, re, sys
|
|
|
|
PRIMS = {"int","float","double","boolean","long","byte","short","char","void"}
|
|
MODS = {"public","private","protected","static","final","abstract","transient","volatile","native","strictfp","synchronized","default"}
|
|
TYPE_TOK = re.compile(r"^(?:[A-Za-z_]\w*\.)*[A-Za-z_]\w*(?:<[^>]*>)?(?:\[\])?(?:\?|extends\s+\w+)*$")
|
|
|
|
def clean(l):
|
|
s = re.sub(r"//.*", "", l)
|
|
s = re.sub(r'"(\\.|[^"\\])*"', '""', s)
|
|
s = re.sub(r"'(\\.|[^'\\])'", "''", s)
|
|
return s
|
|
|
|
def process(p):
|
|
lines = open(p).read().splitlines(keepends=True)
|
|
stack = []
|
|
out = []
|
|
changed = 0
|
|
for l in lines:
|
|
in_class = not stack or stack[-1] == "class"
|
|
s = l.strip()
|
|
ind = l[:len(l)-len(l.lstrip())]
|
|
if in_class and s and ind and l[:4] == " " and not s.startswith(("public","private","protected","//","*","@","}","{","import","package","else","return","if","for","while","switch","case","try","catch","finally","throw","new ","super.","this.","synchronized(")):
|
|
m = re.match(r"^(?:(?:static|final|abstract|transient|volatile|synchronized)\s+)*(<[\w ,<>]+>\s+)?([A-Za-z_][\w.]*(?:<[^>]*>)?)(?:\[\])?\s+(\w+)\s*(\(|=|;)", s)
|
|
ctor = re.match(r"^(\w+)\s*\(", s) and s.split("(")[0][0].isupper()
|
|
typ_ok = False
|
|
if m:
|
|
typ = m.group(2)
|
|
typ_ok = typ in PRIMS or typ[0].isupper()
|
|
is_field = m and typ_ok and m.group(4) in ("=",";")
|
|
is_method = m and typ_ok and m.group(4) == "(" and not s.startswith("return")
|
|
is_ctor = bool(ctor) and ind.strip() != "" and not s.startswith(("class","record","interface","enum","public","static","final","abstract","void","new ")) and re.match(rf"^\w+\(", s) and s.split("(")[0] in [fn for fn in [os.path.basename(p)[:-5]]]
|
|
is_type = bool(re.match(r"^(?:(?:static|final|abstract|sealed)\s+)*(class|interface|enum|record)\s+\w+", s))
|
|
if is_field or is_method or is_ctor or is_type:
|
|
l = ind + "public " + s + ("\n" if l.endswith("\n") else "")
|
|
changed += 1
|
|
out.append(l)
|
|
c = clean(l)
|
|
pos = 0
|
|
while True:
|
|
o = c.find("{", pos); cl = c.find("}", pos)
|
|
if o == -1 and cl == -1: break
|
|
if cl != -1 and (o == -1 or cl < o):
|
|
stack.pop() if stack else None
|
|
pos = cl + 1
|
|
else:
|
|
stack.append("class" if re.search(r"\b(class|interface|enum|record)\s+\w", c[:o]) else "other")
|
|
pos = o + 1
|
|
if changed:
|
|
open(p, "w").write("".join(out))
|
|
return changed
|
|
|
|
def main(base):
|
|
total = 0
|
|
for dp, dns, fns in os.walk(base):
|
|
for fn in fns:
|
|
if fn.endswith(".java"):
|
|
total += process(os.path.join(dp, fn))
|
|
print("member sweep promotions:", total)
|
|
|
|
if __name__ == "__main__":
|
|
main(sys.argv[1])
|