From bee15f5eb0a1d2ca8725366a19514a024b50dd21 Mon Sep 17 00:00:00 2001 From: zhouzihao Date: Wed, 29 Apr 2026 15:26:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20'W8=E5=91=A8=E6=A2=93=E6=B5=A9202506050319'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AI协同学习&思考题.txt | 19 +++++++++++++++++++ W8周梓浩202506050319/pair.iml | 11 +++++++++++ 2 files changed, 30 insertions(+) create mode 100644 W8周梓浩202506050319/AI协同学习&思考题.txt create mode 100644 W8周梓浩202506050319/pair.iml diff --git a/W8周梓浩202506050319/AI协同学习&思考题.txt b/W8周梓浩202506050319/AI协同学习&思考题.txt new file mode 100644 index 0000000..dfd3c87 --- /dev/null +++ b/W8周梓浩202506050319/AI协同学习&思考题.txt @@ -0,0 +1,19 @@ +一、Java泛型擦除后如何通过反射获取泛型类型? + 1、通过父类/超类类型参数获取 + 2、获取方法参数/返回值的泛型类型 + 3、获取字段的泛型类型 +二、AI审查 + +✅ 优点 +泛型设计正确 - Cache 泛型声明规范 + +封装合理 - storage 字段为 private,符合封装原则 + +委托模式 - 方法直接委托给 HashMap,简单高效 + +构造函数初始化 - 正确创建了 HashMap 实例 + +代码基础不错,功能完整,主要是缺少一些企业级实践(线程安全、Optional 使用等)。 + +三、为什么Java泛型不支持基本类型? + 因为Java泛型是通过类型擦除实现的,运行时所有泛型类型都会被替换为Object,而基本类型不是Object的子类。 \ No newline at end of file diff --git a/W8周梓浩202506050319/pair.iml b/W8周梓浩202506050319/pair.iml new file mode 100644 index 0000000..9465dd8 --- /dev/null +++ b/W8周梓浩202506050319/pair.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file