1

Disclaimer: I am not asking about alternative imports. While this information may be useful, feel free to leave a comment; but any answer containing something like use another import will be downvoted. I am asking about how to suppress the warning. Thanks!

Here is the import I use:

import com.sun.xml.ws.developer.JAXWSProperties;

Sonar complains about it saying:

Use classes from the Java API instead of Sun classes. (squid:S1191)

How can I suppress this warning?

Andremoniy
  • 34,031
  • 20
  • 135
  • 241

2 Answers2

2

Can you please try:

import com.sun.xml.ws.developer.JAXWSProperties; // NOSONAR 
Raheela Aslam
  • 452
  • 2
  • 13
1

As per comments, this is related to turn sonar off

But adding @SupressWarning isn't possible in import statements, so your options:

  • Add at the end of the line //NOSONAR - for specific line

  • Deactivate rule squid:S1191 (available in Eclipse) - if you have multiple lines

Ori Marko
  • 56,308
  • 23
  • 131
  • 233
  • Do you know of a way to use //NOSONAR for a block of code? – Pytry Oct 03 '19 at 17:43
  • @pytry you can add `@SuppressWarnings` on method – Ori Marko Oct 05 '19 at 18:32
  • I should have been more specific. I don't want to add this to a method; I want to add it to ignore warnings on imports and package declarations, where you can't use annotations. Fun little tidbit; there seems to be a rule that shows a warning when you suppress all warnings using "//NOSONAR" .... so yeah. That's annoying. – Pytry Oct 07 '19 at 23:34