Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » IType.getMethod() - Bytecode signature to retrieve method
IType.getMethod() - Bytecode signature to retrieve method [message #651078] Thu, 27 January 2011 17:07 Go to next message
Michal Borek is currently offline Michal BorekFriend
Messages: 25
Registered: August 2010
Junior Member
I analyze bytecode of java and I have method descriptor

for example:
method name: add
method descriptor (Ljava.lang.Integer;Ljava.lang.Integer)Ljava.lang.Integer;

it can be read as: Integer add (Integer , Integer)

I want to add a marker in a line there method signature is in source code
for example:
-> public Integer add(java.lang.Integer a, Integer b) {

}



where -> is a marker I want to add.

IType interface defines IMethod getMethod(String methodName, String[] signatureParameters);

but signatureParameters are not these from bytecode (e.g. Ljava.lang.Integer) but for example QInteger or Qjava.lang.Integer (depends on how it's defined in source code)

for "a" and "b" parameters in my example above it would be Qjava.lang.Integer; and QInteger; respectively.

My question is:
Is there a way to convert values from bytecode or somehow find particular method having only bytecode (always fully-qualified) parameter names.
for "b".

The best solution would be:
myClass.getMethod("add", new String[] {"Ljava.lang.Integer;", "Ljava.lang.Integer;"}); 



but it doesn't work (It needs Eclipse specific signatures).

If it's not clear please tell me what should I describe in detail.
Re: IType.getMethod() - Bytecode signature to retrieve method [message #651186 is a reply to message #651078] Fri, 28 January 2011 09:38 Go to previous message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
It should be good enough for binary types, but Q(unresolved) is required for source types. Look at org.eclipse.jdt.core.Signature#createTypeSignature() to convert.
Previous Topic:source formatting: avoid linebreak after {
Next Topic:SDL_JAVA_PACKAGE_PATH
Goto Forum:
  


Current Time: Wed Apr 24 16:26:27 GMT 2024

Powered by FUDForum. Page generated in 0.03277 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top