-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISSUE 240] deprecation of EC53 rule for java
- Loading branch information
Showing
6 changed files
with
23 additions
and
7 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
18 changes: 12 additions & 6 deletions
18
ecocode-rules-specifications/src/main/rules/EC53/java/EC53.asciidoc
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 |
---|---|---|
@@ -1,21 +1,27 @@ | ||
*This rule is deprecated because there aren't enough good arguments and not enough green measures / benchmarks, and will be removed soon.* | ||
|
||
== Why is this an issue? | ||
|
||
Using List instead of Arrays with Foreach save CPU cycles calculations and RAM consumption. | ||
|
||
## Noncompliant Code Example | ||
== Noncompliant Code Example | ||
|
||
```java | ||
[source,java] | ||
---- | ||
private final Integer[] intArray = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; | ||
for (Integer i : intArray) { | ||
// ... | ||
} | ||
``` | ||
---- | ||
|
||
## Compliant Solution | ||
== Compliant Solution | ||
|
||
```java | ||
[source,java] | ||
---- | ||
private final List<Integer> intList = Arrays.asList(new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); | ||
for (Integer i : intList) { | ||
// ... | ||
} | ||
``` | ||
---- |
3 changes: 3 additions & 0 deletions
3
ecocode-rules-specifications/src/main/rules/EC53/java/EC53.json
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,3 @@ | ||
{ | ||
"status": "deprecated" | ||
} |
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