-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/resources/org/sonar/l10n/pmd/rules/pmd-p3c/AvoidApacheBeanUtilsCopyRule.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<p>Look for qualified this usages in the same class.</p> | ||
<p>Examples:</p> | ||
<pre> | ||
TestObject a = new TestObject(); | ||
TestObject b = new TestObject(); | ||
a.setX(b.getX()); | ||
a.setY(b.getY()); | ||
</pre> |
8 changes: 8 additions & 0 deletions
8
src/main/resources/org/sonar/l10n/pmd/rules/pmd-p3c/AvoidMissUseOfMathRandomRule.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<p>Look for qualified this usages in the same class.</p> | ||
<p>Examples:</p> | ||
<pre> | ||
Negative example: | ||
Long randomLong =(long) (Math.random() * 10); | ||
Positive example: | ||
Long randomLong = new Random().nextLong(); | ||
</pre> |
15 changes: 15 additions & 0 deletions
15
src/main/resources/org/sonar/l10n/pmd/rules/pmd-p3c/AvoidNewDateGetTimeRule.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<p>Look for qualified this usages in the same class.</p> | ||
<p>Examples:</p> | ||
<pre> | ||
public class TimeMillisDemo { | ||
public static void main(String args[]) { | ||
// Positive example: | ||
long a = System.currentTimeMillis(); | ||
// Negative example: | ||
long b = new Date().getTime(); | ||
|
||
System.out.println(a); | ||
System.out.println(b); | ||
} | ||
} | ||
</pre> |
13 changes: 13 additions & 0 deletions
13
src/main/resources/org/sonar/l10n/pmd/rules/pmd-p3c/AvoidPatternCompileInMethodRule.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<p>Look for qualified this usages in the same class.</p> | ||
<p>Examples:</p> | ||
<pre> | ||
public class XxxClass { | ||
// Use precompile | ||
private static Pattern NUMBER_PATTERN = Pattern.compile("[0-9]+"); | ||
public Pattern getNumberPattern() { | ||
// Avoid use Pattern.compile in method body. | ||
Pattern localPattern = Pattern.compile("[0-9]+"); | ||
return localPattern; | ||
} | ||
} | ||
</pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters