Sonarqube not able to analyze Hibernate method name

Hello SonarQube Community,

I recently started developing my custom plugin for sonarqube and successfully completed one development. Now I wanted to develop another plugin and the rule for this plugin is based on hibernate framework method signature. but when I try to print the method name (eg:findById)
using MethodInvocationTree(methodinvocationTree.symbol().name) it is printing !unknownmethod!.
i have added Hibernate framework in the classpath of the project using maven.

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>5.4.15.Final</version>
    <scope>provided</scope>
</dependency>

if someone know how to find the method name for hibernate then please help.
Thank you

Hey @mukeshpilaniya ,

It’s not very clear to me what you are observing.

  • Where and when are you seeing these !unknownmethod! names?
    • Is it during the analysis of a project while having your custom-rules plugin installed?
    • Is it while running the unit test of your rule?
      • If it’s the case, you probably didn’t add the jar in the correct place. You should add them in the pom of the custom plugin, which will duplicate the jar and place it in a special folder “test-jars”. Having this jar placed there is required by the rules under test to read correctly methods being used. Have a look here:

Hope this helps,
Michael