7

When vising method instruction a.doAnother(account.getId); Using visitMethodInsn() in ASM. I need to get type of account from the method argument account.getId() and the type of account is Account. however I am getting return type of account.getId() that is long . How to get Type of account that is Account here?

sTg
  • 4,313
  • 16
  • 68
  • 115
Swati Thakare
  • 189
  • 1
  • 8
  • ASM can't help you with that. You should probably refactor your `doAnother` method to take an `Account` instead of a `long id`. – Clashsoft Apr 16 '16 at 11:55
  • If the id is received from a method call, you would need to parse the privious visitMethodIns. – Rafael Winterhalter Apr 16 '16 at 16:30
  • Hello @Clashsoft, I am processing the code of other existing project using ASM so I can not modify the doAnother() method (method of existing project) and I don't have choice other than ASM. Thanks for your response :) – Swati Thakare Apr 18 '16 at 07:03
  • Hello @Rafael Winterhalter, Type of the id that is 'long' is received. If you are asking to parse privious 'visitMethodInsn()' calls, then I think I will not get details of required method call 'a.doAnother(account.getId);'. previous method calls will give other (previous) instruction details. Thanks for your response :) – Swati Thakare Apr 18 '16 at 07:24
  • I would suggest you to clarify what your "type" is. Is it a Java class(`java.lang.Class`), a class name (`Class.getName()`), asm type (`org.objectweb.asm.Type`), java type (`java.lang.reflect.Type`) or some account type indicator (possibly `Account.getType()`)? – glee8e Apr 20 '16 at 07:21
  • Account is an entity. type of Account is javax.persistence.Entity. account is an object of type Account (entity) – Swati Thakare Apr 20 '16 at 08:06

0 Answers0