[java:S1943] Improved message

Qube: Community 9.9

The Java rule S1943 commands me to “remove this use of …”.

byte[] bytes = "foobar".getBytes();

The message is very misleading. It should better ask me to add a Charset argument.

Hello @mfroehlich,

Thanks for your message. Your suggestion does make sense. Currently, we’re working on improving the descriptions of our rules and improving an error message will also contribute to that effort.

I’ve created a ticket to track the progress on the issue:

https://sonarsource.atlassian.net/browse/SONARJAVA-4620

Best,
Margarita