-
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
9 changed files
with
192 additions
and
5 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
12 changes: 12 additions & 0 deletions
12
...ources/org/sonar/l10n/pmd/rules/pmd-p3c/ClassCastExceptionWithSubListToArrayListRule.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,12 @@ | ||
<p>Look for qualified this usages in the same class.</p> | ||
<p>Examples:</p> | ||
<pre> | ||
Negative example: | ||
List<String> list = new ArrayList<String>(); | ||
list.add("22"); | ||
//warn | ||
List<String> test = (ArrayList<String>) list.subList(0, 1); | ||
|
||
Positive example: | ||
List<String> list2 = new ArrayList<String>(list.subList(0, 1)); | ||
</pre> |
9 changes: 9 additions & 0 deletions
9
src/main/resources/org/sonar/l10n/pmd/rules/pmd-p3c/ClassCastExceptionWithToArrayRule.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,9 @@ | ||
<p>Look for qualified this usages in the same class.</p> | ||
<p>Examples:</p> | ||
<pre> | ||
Negative example: | ||
Integer[] a = (Integer [])c.toArray(); | ||
|
||
Positive example: | ||
Integer[] b = (Integer [])c.toArray(new Integer[c.size()]); | ||
</pre> |
9 changes: 9 additions & 0 deletions
9
...in/resources/org/sonar/l10n/pmd/rules/pmd-p3c/CollectionInitShouldAssignCapacityRule.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,9 @@ | ||
<p>Look for qualified this usages in the same class.</p> | ||
<p>Examples:</p> | ||
<pre> | ||
Negative example: | ||
Map<String, String> map = new HashMap<String, String>(); | ||
|
||
Positive example: | ||
Map<String, String> map = new HashMap<String, String>(16); | ||
</pre> |
10 changes: 10 additions & 0 deletions
10
...rces/org/sonar/l10n/pmd/rules/pmd-p3c/ConcurrentExceptionWithModifyOriginSubListRule.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,10 @@ | ||
<p>Look for qualified this usages in the same class.</p> | ||
<p>Examples:</p> | ||
<pre> | ||
Negative example: | ||
List<String> originList = new ArrayList<String>(); | ||
originList.add("22"); | ||
List<String> subList = originList.subList(0, 1); | ||
//warn | ||
originList.add("22"); | ||
</pre> |
20 changes: 20 additions & 0 deletions
20
src/main/resources/org/sonar/l10n/pmd/rules/pmd-p3c/DontModifyInForeachCircleRule.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,20 @@ | ||
<p>Look for qualified this usages in the same class.</p> | ||
<p>Examples:</p> | ||
<pre> | ||
Negative example: | ||
List<String> originList = new ArrayList<String>(); | ||
originList.add("22"); | ||
for (String item : originList) { | ||
//warn | ||
list.add("bb"); | ||
} | ||
|
||
Positive example: | ||
Iterator<Integer> it=b.iterator(); | ||
while(it.hasNext()){ | ||
Integer temp = it.next(); | ||
if (delCondition) { | ||
it.remove(); | ||
} | ||
} | ||
</pre> |
13 changes: 13 additions & 0 deletions
13
.../resources/org/sonar/l10n/pmd/rules/pmd-p3c/UnsupportedExceptionWithModifyAsListRule.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> | ||
Positive example: | ||
List<String> t = Arrays.asList("a","b","c"); | ||
//warn | ||
t.add("22"); | ||
//warn | ||
t.remove("22"); | ||
//warn | ||
t.clear(); | ||
|
||
</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