Make Report implement Iterable<RuleViolation>
With this change we can easily iterate over a Report using the for-each loop of Java 5 instead of using Report.iterator(). Also the @Override annotation has been added to Report.iterator() and ReportTree.iterator() as PMD switched to Java 6.
This commit is contained in:
1 parent
46a57aa3ab
commit
41705f17da
2 files changed
+3
-1
No files matched your search
@@ -20,7 +20,7 @@ import net.sourceforge.pmd.util.EmptyIterator;
|
||||
import net.sourceforge.pmd.util.NumericConstants;
|
||||
import net.sourceforge.pmd.util.StringUtil;
|
||||
|
||||
public class Report {
|
||||
public class Report implements Iterable<RuleViolation> {
|
||||
|
||||
public static Report createReport(RuleContext ctx, String fileName) {
|
||||
Report report = new Report();
|
||||
@@ -263,6 +263,7 @@ public class Report {
|
||||
return violationTree.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<RuleViolation> iterator() {
|
||||
return violations.iterator();
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ public class ReportTree implements Iterable<RuleViolation> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<RuleViolation> iterator() {
|
||||
return new TreeIterator();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user