V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  hnliuzesen  ›  全部回复第 2 页 / 共 2 页
回复总数  32
1  2  
@Parkerz 你要执行的 Spring 对象的方法是 Spring 管理的对象的方法么?
问大语言模型比在这里提问会来的更快

大语言模型说
1. findSpecial 用来调用 private 方法,但是 getSum 不是 private 方法
2. findSpecial 中 getSum 的参数数量与实际不符
3. LambdaMetafactory 中也是参数不符

```
@Test
public void likeReflectTest() throws Throwable {
Class<MethodHandles.Lookup> lookupClass = MethodHandles.Lookup.class;
Field implLookup = lookupClass.getDeclaredField("IMPL_LOOKUP");
implLookup.setAccessible(true);
MethodHandles.Lookup lookup = (MethodHandles.Lookup)implLookup.get(null);

// Assuming getSum is private, otherwise findVirtual should be used.
MethodHandle getSum = lookup
.in(Phone.class)
.findSpecial(
Phone.class,
"getSum",
methodType(int.class, int.class, int.class),
Phone.class
);

CallSite applyAsInt = LambdaMetafactory.metafactory(
lookup,
"applyAsInt",
methodType(ToIntFunction2.class),
methodType(int.class, Phone.class, int.class, int.class), // This should match the interface's method signature.
getSum,
getSum.type() // This should be the method handle's type.
);

ToIntFunction2 func = (ToIntFunction2) applyAsInt.getTarget().invoke();

int intResult = func.applyAsInt(new Phone(), 1, 0);

System.out.println(intResult);
}
```
37 天前
回复了 LazYFire 创建的主题 程序员 能不能推荐一下自己在用的 AI 编程插件
Amazon code whisperer ,不如 GitHub Copilot 好用,不过免费
37 天前
回复了 fine886 创建的主题 Blogger 如何搭建个人博客
可以直接看 [hexo]( https://hexo.io/zh-cn/) 的文档,有中文,也挺详细
48 天前
回复了 sdjl 创建的主题 程序员 用 AI 写代码,有哪些实用技巧?
@sdjl 不太一样,copilot 一般是补全一段代码,这个工具是靠提前写好的 prompt 将项目结构和需求还有具体的代码发给 OpenAI 的 API ,让它来完成需求,还会顺便生成 commit 提交,方便管理 API 进行的修改或者回退。
相当于是省去了写注释,然后发给 GPT 的过程。启动时带上你要修改的文件名,然后将注释内容直接在命令行中描述,它会直接完成这部分代码并提一个 commit 。
49 天前
回复了 sdjl 创建的主题 程序员 用 AI 写代码,有哪些实用技巧?
可以试下 Aider 这个项目,里面很多 prompt 写的挺好的,不直接用,也能学到很多技巧
https://aider.chat/
2018-10-10 14:54:27 +08:00
回复了 xqdoo00o 创建的主题 分享发现 win10 Linux “合体”
@zoxobo
sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
看看你的源是不是 archive.ubuntu.com 我遇见过是 xxx.archive.ubuntu.com 的需要改一下命令
2018-05-28 19:08:14 +08:00
回复了 c9 创建的主题 分享发现 安卓 QQ 这彩蛋,真不愧是国际大公司
看知乎,貌似是 5.2.8 就有了?
https://www.zhihu.com/question/278938947
2015-03-16 08:57:41 +08:00
回复了 tflz514 创建的主题 北京 合租的女生怎么这么不爱干净?
为什么人走了要把冰箱拔了呢……
2015-03-16 08:53:52 +08:00
回复了 Feiox 创建的主题 程序员 校内举行 “三行代码挑战赛” 想请各位提一提意见 ~
写一个小米抢购页面
printf("已售罄,请预约下一次抢购")
1  2  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1501 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 26ms · UTC 23:50 · PVG 07:50 · LAX 16:50 · JFK 19:50
Developed with CodeLauncher
♥ Do have faith in what you're doing.