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?
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: