Sonarqube 8.4 Type.fullyQualifiedName() returning !Unknown!

Hi

We (structure101.com) have a Java plugin that has been working in all versions up to 8.1

When testing against 8.4.1 we found missing issues that are created by our BaseTreeVisitor implementation. We have tracked the problem to this code in our visitor class.

public void visitMethod(MethodTree tree) {
        String scanfqn = tree.symbol().type().fullyQualifiedName() + "." + tree.symbol().name();

The call tree.symbol().type().fullyQualifiedName() in 8.4 is returning the string !Unknown!
Previous versions of Sonarqube return the fully qualified class name.

Do you know of any Java API changes that would cause this?

Sonarqube version is 8.4.1.35646 with no changes other than the addition of our plugin.
Java plugin version is 6.5.1.22586

thanks and regards

Mike Swainston-Rainford

Hey Mike,

When you say

Which version are you talking about?

  • Is it SQ 7.9.x LTS?
  • Is it an older version of the SQ 8.x series?
  • Is it older?

In order to help you:

  • It would help if you could also tell me on which version of the Java analyzer you were relying on when everything was working fine.
  • Would you be able to tell me if you are only seeing this behavior in your custom-rules-plugin unit tests only? Or also in production?

I feel that the culprit could be the refactor of the JavaCheckVerifier we did for release 6.3 of the Java Analyzer (see SONARJAVA-3315). With this refactor, we changed a bit the way the bytecode of external libraries is provided to checks, and if your test case requires external classes, now you might have to provide it explicitly, by setting the classpath, as mentioned in this answer from another thread:

Hope this helps,
Michael