Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » IType.getMethod and signature from bytecode
IType.getMethod and signature from bytecode [message #650831] Wed, 26 January 2011 13:11 Go to next message
Michal Borek is currently offline Michal Borek
Messages: 25
Registered: August 2010
Junior Member
Hello,
I've got a problem with getMethod() method of IType

I have a signature of specific method from bytecode.

For example:
(Ljava.lang.Integer;Ljava.lang.Integer)I

I want to use it in in
IType.getMethod(String methodName, String[] signatureParameters);

Eclipse doesn't recognize a type, but parameter that is in source code (e.g. java.lang.String != String)

Is there a way to get method if I don't know how developer wrote the type?

Thanks in advance!




Re: IType.getMethod and signature from bytecode [message #650906 is a reply to message #650831] Thu, 27 January 2011 01:55 Go to previous messageGo to next message
Zhongwei Zhao is currently offline Zhongwei Zhao
Messages: 11
Registered: July 2009
Junior Member
Hi,

I do not understand you,can you explain more,thanks!
Re: IType.getMethod and signature from bytecode [message #650933 is a reply to message #650906] Thu, 27 January 2011 03:45 Go to previous messageGo to next message
Michal Borek is currently offline Michal Borek
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.



[Updated on: Thu, 27 January 2011 03:45]

Report message to a moderator

Re: IType.getMethod and signature from bytecode [message #650956 is a reply to message #650933] Thu, 27 January 2011 05:04 Go to previous messageGo to next message
Zhongwei Zhao is currently offline Zhongwei Zhao
Messages: 11
Registered: July 2009
Junior Member
finally,I got what do you mean,I think you should post it on JDT instead of PDT
Re: IType.getMethod and signature from bytecode [message #653171 is a reply to message #650831] Tue, 08 February 2011 13:09 Go to previous message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2253
Registered: July 2009
Senior Member
On 1/26/2011 1:11 PM, emPl wrote:
> Hello,
> I've got a problem with getMethod() method of IType
> I have a signature of specific method from bytecode.
>
> For example:
> (Ljava.lang.Integer;Ljava.lang.Integer)I

You might want the JDT newsgroup instead of the PDT newsgroup.

--
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational


---
Nitin Dahyabhai
Eclipse WTP, IBM
Previous Topic:Strange Errormarking
Next Topic:Code hint for javascript files. js
Goto Forum:
  


Current Time: Sun Aug 31 06:42:33 EDT 2014

Powered by FUDForum. Page generated in 0.01663 seconds