36 lines
525 B
Plaintext
36 lines
525 B
Plaintext
== Why is this an issue?
|
|
|
|
The use of the ``++this++`` keyword is only required when the member is shadowed by a local parameter, or variable. In other cases, the code should be simplified by its removal.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,text]
|
|
----
|
|
public class MyClass
|
|
{
|
|
private int count;
|
|
|
|
public void DoSomething() {
|
|
this.count++; // Noncompliant
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,text]
|
|
----
|
|
public class MyClass
|
|
{
|
|
private int count;
|
|
|
|
public void DoSomething() {
|
|
count++;
|
|
}
|
|
}
|
|
----
|
|
|
|
|