
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
23 lines
511 B
Plaintext
23 lines
511 B
Plaintext
== Why is this an issue?
|
|
|
|
Invoking a method designed to return a string representation of an object which is already a string is a waste of keystrokes. This redundant construction may be optimized by the compiler, but will be confusing in the meantime.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,text]
|
|
----
|
|
String message = "hello world";
|
|
System.out.println(message.toString()); // Noncompliant;
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,text]
|
|
----
|
|
String message = "hello world";
|
|
System.out.println(message);
|
|
----
|
|
|