feat: 大幅增强原生行为 — 修复P0 Bug + 补全核心API
P0 Bug 修复: - Canvas.drawBitmap 重复定义导致重载丢失 → 合并为*args重载 - String.hashCode() 不可达的第二return → 修复为单return - File.compareTo() 调用不存在的__cmp__ → 改为显式比较 - HashMap.remove() 逻辑错误 → 区分单参(返回旧值)/双参(返回boolean) P1 核心行为增强: - Handler: sendMessage/sendMessageDelayed 现在真正入队异步执行 - Looper: loop() 实现真正的消息循环(按when时间取出到期消息) - AsyncTask: execute() 在后台线程池执行,完成后主线程回调 - Bundle: 新增12个数组类型put/get方法 - Math.round: 改为Java语义(floor(a+0.5))而非Python银行家舍入 - Thread: currentThread()缓存对象, 新增join/getState/getId/getPriority - String: 新增strip/repeat/isBlank/lines/subSequence/getChars/chars/formatted/translateEscapes P2 缺失API补全: - 新增21个Java标准Exception类 (NullPointerException等) - View: 新增39个事件处理/监听器/位置尺寸方法 - Activity: 新增33个生命周期/权限/UI方法 - Context: 新增22个文件流/权限/资源/主题方法 - Canvas: 支持 Canvas(Bitmap) 构造函数重载 - __init__.py: __all__ 补全Exception体系和Activity类
This commit is contained in:
1 parent
4645015004
commit
8c3bd3c415
9 files changed
+1017
-52
No files matched your search
@@ -666,13 +666,20 @@ class HashMap(Stub):
|
||||
return None
|
||||
return self._data[key]
|
||||
|
||||
def remove(self, key, value=None) -> bool:
|
||||
if value is None:
|
||||
return self._data.pop(key, None) is not None or key in self._data
|
||||
if key in self._data and self._data[key] == value:
|
||||
del self._data[key]
|
||||
return True
|
||||
return False
|
||||
def remove(self, key, value=None):
|
||||
if value is not None:
|
||||
# remove(key, value) — 返回 boolean
|
||||
if key in self._data and self._data[key] == value:
|
||||
del self._data[key]
|
||||
return True
|
||||
return False
|
||||
else:
|
||||
# remove(key) — 返回被删除的 value(与 Java 语义一致)
|
||||
if key in self._data:
|
||||
old = self._data[key]
|
||||
del self._data[key]
|
||||
return old
|
||||
return None
|
||||
|
||||
def replace(self, key, old_value=None, new_value=None):
|
||||
if old_value is None and new_value is None:
|
||||
|
||||
Reference in new issue
Block a user