desc tag in XML report

22 views
Skip to first unread message

sainat...@gmail.com

unread,
May 18, 2020, 6:36:01 AM5/18/20
to JaCoCo and EclEmma Users
<method name="invoke"
desc="(ILjava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;">


I am in need to get fully qualified method name (along with parameters)  from the report 
for the same task I have written a parser which would pick up package / class / method name and build a fully qualified method name 


But I am running into one small blocker here 
For the name of the method I can get it from name , to get the method parameters I thought of making use of desc tag but they seem to come along with type signatures for primitives (see. I, V and L reference)

Given that I have a method's desc

<method name="setFeature"
desc="Ljava/lang/String;Z">

I would only want to get setFeature(java.lang.String)


Please suggest me how to accomplish the same 

Marc Hoffmann

unread,
May 19, 2020, 3:21:32 AM5/19/20
to jac...@googlegroups.com
Hi,

the signature description is the internal representation used in Java class files. You can use libraries like ASM (see Type class) to parse these descriptors.

Also JaCoCo implements such a mapping to create Java source like methods declarations in the HTML report, see JavaNames.

But your second example

    desc="Ljava/lang/String;Z”>

does not look like a valid method descriptor (parenthesis missing). Was this XML snipped generated by JaCoCo?

Regards,
-marc


--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/9de8bd30-a547-480a-9419-468a018294c2%40googlegroups.com.

Message has been deleted

sainat...@gmail.com

unread,
May 19, 2020, 3:37:35 AM5/19/20
to JaCoCo and EclEmma Users
It was a copy-paste error on my side 

Wouldn't reading the params under the first set of opening and closing parenthesis suffice? to find out the method signatures in the form of java.lang.String or some custom object types


On Tuesday, 19 May 2020 12:51:32 UTC+5:30, Marc R. Hoffmann wrote:
Hi,

the signature description is the internal representation used in Java class files. You can use libraries like ASM (see Type class) to parse these descriptors.

Also JaCoCo implements such a mapping to create Java source like methods declarations in the HTML report, see JavaNames.

But your second example

    desc="Ljava/lang/String;Z”>

does not look like a valid method descriptor (parenthesis missing). Was this XML snipped generated by JaCoCo?

Regards,
-marc


On 18. May 2020, at 12:36, sainat...@gmail.com wrote:

<method name="invoke"
desc="(ILjava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;">


I am in need to get fully qualified method name (along with parameters)  from the report 
for the same task I have written a parser which would pick up package / class / method name and build a fully qualified method name 


But I am running into one small blocker here 
For the name of the method I can get it from name , to get the method parameters I thought of making use of desc tag but they seem to come along with type signatures for primitives (see. I, V and L reference)

Given that I have a method's desc

<method name="setFeature"
desc="Ljava/lang/String;Z">

I would only want to get setFeature(java.lang.String)


Please suggest me how to accomplish the same 

--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jac...@googlegroups.com.

Marc Hoffmann

unread,
May 19, 2020, 3:47:32 AM5/19/20
to jac...@googlegroups.com
Hi,

the types between the parenthesis are the method parameters, the type after the closing parenthesis is the return value. See JVM specification.

Which of the information you need depends on your use case.

Regards,
-marc


To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/9ee7258e-55a9-41a7-8097-5db876d90661%40googlegroups.com.

sainat...@gmail.com

unread,
May 19, 2020, 9:49:12 AM5/19/20
to JaCoCo and EclEmma Users
Thanks Marc 
Have written few regex rules to pick out the method params 
Seems to be working just fine for now 

Cheers!
Reply all
Reply to author
Forward
0 new messages