wave N+5: vfbuild20 fixes (zh EF var2 in 4 removeIf lambdas)
This commit is contained in:
parent
64904197c4
commit
c5a231465c
3 changed files with 76 additions and 4 deletions
38
tools/waves_n5.py
Normal file
38
tools/waves_n5.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
"""Волна N+5: vfbuild20 — 4 EF в zh.java (var2 в 4 removeIf-лямбдах). Запуск: python3 tools/waves_n5.py"""
|
||||
|
||||
import os, sys
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
JAVA = os.path.join(ROOT, "src/main/java")
|
||||
p = os.path.join(JAVA, "defpackage/zh.java")
|
||||
L = open(p, encoding="utf-8", errors="replace").read().splitlines()
|
||||
ok = True
|
||||
|
||||
|
||||
def edit(ln, old, new):
|
||||
global ok
|
||||
i = ln - 1
|
||||
if i < len(L) and old in L[i]:
|
||||
L[i] = L[i].replace(old, new, 1)
|
||||
elif i < len(L) and new in L[i]:
|
||||
pass
|
||||
else:
|
||||
ok = False
|
||||
print(f"MISS {ln}: {old!r} got {(L[i] if i < len(L) else '<oob>').strip()!r}")
|
||||
|
||||
|
||||
for ln in (1158, 1122, 1095, 1072):
|
||||
edit(ln, "if (!var2.contains(var1x)) {", "if (!var2f.contains(var1x)) {")
|
||||
# insert before 1060 (after var2 = var1.getThemes(); at 1059)
|
||||
if (
|
||||
L[1059].strip().startswith("this.physics.keySet().removeIf(")
|
||||
and "final List var2f" not in L[1057:1060]
|
||||
):
|
||||
L.insert(1059, " final List var2f = var2;")
|
||||
else:
|
||||
ok = False
|
||||
print(f"INSERT-MISS: line1060 = {L[1059].strip()!r}")
|
||||
|
||||
open(p, "w", encoding="utf-8").write("\n".join(L) + "\n")
|
||||
print("OK" if ok else "PROBLEMS")
|
||||
sys.exit(0 if ok else 1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue