aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-squid-java-plugin/src/main
diff options
context:
space:
mode:
authorGodin <mandrikov@gmail.com>2010-11-29 17:45:35 +0000
committerGodin <mandrikov@gmail.com>2010-11-29 17:45:35 +0000
commit5276b9eadc0d4859d44667166155811b87832886 (patch)
tree2d193c4152c500c7a617149e9fc6aadc6a0088af /plugins/sonar-squid-java-plugin/src/main
parent6ce6cc598fdcd6e3d6eb662b47668b0c6b898f3d (diff)
downloadsonarqube-5276b9eadc0d4859d44667166155811b87832886.tar.gz
sonarqube-5276b9eadc0d4859d44667166155811b87832886.zip
Fix SquidVisitorNotifier
Diffstat (limited to 'plugins/sonar-squid-java-plugin/src/main')
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/SquidVisitorNotifier.java36
1 files changed, 12 insertions, 24 deletions
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/SquidVisitorNotifier.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/SquidVisitorNotifier.java
index 59eb5af86f7..306bb428441 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/SquidVisitorNotifier.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/SquidVisitorNotifier.java
@@ -26,36 +26,24 @@ public class SquidVisitorNotifier {
for (SquidVisitor visitor : squidVisitors) {
visitor.visitFile(sourceFile);
}
- callVisitClass(sourceFile);
+ visitChildren(sourceFile);
}
- private void callVisitClass(SourceFile sourceFile) {
- if ( !sourceFile.hasChildren()) {
- return;
- }
- for (SourceCode sourceCode : sourceFile.getChildren()) {
- if (sourceCode instanceof SourceClass) {
- SourceClass sourceClass = (SourceClass) sourceCode;
- for (SquidVisitor visitor : squidVisitors) {
- visitor.visitClass(sourceClass);
- }
- callVisitMethod(sourceClass);
+ private void visitChildren(SourceCode sourceCode) {
+ if (sourceCode instanceof SourceClass) {
+ for (SquidVisitor visitor : squidVisitors) {
+ visitor.visitClass((SourceClass) sourceCode);
+ }
+ } else if (sourceCode instanceof SourceMethod) {
+ for (SquidVisitor visitor : squidVisitors) {
+ visitor.visitMethod((SourceMethod) sourceCode);
}
}
- }
- private void callVisitMethod(SourceClass sourceClass) {
- if ( !sourceClass.hasChildren()) {
- return;
- }
- for (SourceCode sourceCode : sourceClass.getChildren()) {
- if (sourceCode instanceof SourceMethod) {
- SourceMethod sourceMethod = (SourceMethod) sourceCode;
- for (SquidVisitor visitor : squidVisitors) {
- visitor.visitMethod(sourceMethod);
- }
+ if (sourceCode.hasChildren()) {
+ for (SourceCode child : sourceCode.getChildren()) {
+ visitChildren(child);
}
}
}
-
}