Custom rule test failed after updating sonar-java

Hello Community

After updating the sonar-java version from 6.0.0.20538 to 6.8.0.23379 one of our custom rule test is failing. Our custom rule checks if the certain object “org.eclipse.swt.graphics.Cursor” is created:

  @Override
  public void visitNewClass(NewClassTree tree) {
    super.visitNewClass(tree);
    if (tree.symbolType().is("org.eclipse.swt.graphics.Cursor")) {
      ...                            
    }
  }

Before the version update our custom rule was able to identify the full qualified name of the created object. After the update it only returns the object name, in this case “Cursor”.

Is it possible to access the full qualified name in a different way?

I am using:

SonarQube: 7.9.4
SonarJava: 6.8.0.23379

Thank you very much and stay healthy!

Hello @tlg,

Between version 6.0 and 6.8 we completely reworked the way we verify tests. It is probably what causes the issue. In your case, you are probably now missing the bytecode corresponding to eclipse swt library, which would be required by the engine to correctly resolve the type.

This answer from Quentin is probably going to help you:

Cheers,
Michael

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.