Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用Asm访问java字节码获取方法信息。似乎ClassReader类的accept方法是以异步方式调用的。所以无法立即获取方法信息。我该怎么办?
实际上,accept 方法是从您自己的代码中调用的,并且您应该传递您的 ClassVisitor 实现。然后将调用该访问者的方法,并且当调用 toaccept 完成时,有关类的所有信息都会通过该访问者传递。您可以将其记录在某些访问者的成员字段中或立即处理。如果你需要你的类的内存模型,你可以使用 ClassNode 作为访问者。