diff options
author | David Gageot <david@gageot.net> | 2012-04-27 16:45:37 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-04-27 16:48:58 +0200 |
commit | bd90fa7d3ec17f825cac80eebd46cf1ee0412ee9 (patch) | |
tree | 92a3ff7db9b91d9afe4684cc90a7a0cc5c3e010c /plugins/sonar-squid-java-plugin/src | |
parent | 1a6a18a5c4e73987a72b8176f398477f13074d29 (diff) | |
download | sonarqube-bd90fa7d3ec17f825cac80eebd46cf1ee0412ee9.tar.gz sonarqube-bd90fa7d3ec17f825cac80eebd46cf1ee0412ee9.zip |
Code cleaning : Remove unnecessary casts
Diffstat (limited to 'plugins/sonar-squid-java-plugin/src')
5 files changed, 11 insertions, 11 deletions
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/AccessorVisitor.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/AccessorVisitor.java index 37a4ad8d529..8509dcf3195 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/AccessorVisitor.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/AccessorVisitor.java @@ -126,7 +126,7 @@ public class AccessorVisitor extends JavaAstVisitor { } private boolean inspectSetterMethodBody(DetailAST method, DetailAST methodParams, DetailAST methodBody) { - DetailAST expr = (DetailAST) methodBody.getFirstChild(); + DetailAST expr = methodBody.getFirstChild(); if (isAstType(expr, TokenTypes.EXPR)) { DetailAST assignment = expr.findFirstToken(TokenTypes.ASSIGN); if (assignment != null) { diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/MethodVisitor.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/MethodVisitor.java index 316c395595e..82abad51099 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/MethodVisitor.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/visitor/MethodVisitor.java @@ -95,7 +95,7 @@ public class MethodVisitor extends JavaAstVisitor { Parameter argumentType = extractArgumentAndReturnType(child.findFirstToken(TokenTypes.TYPE)); argumentTypes.add(new Parameter(argumentType)); } - child = (DetailAST) child.getNextSibling(); + child = child.getNextSibling(); } return argumentTypes; } diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmMethod.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmMethod.java index e5e68d74070..2c9efe9f064 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmMethod.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/asm/AsmMethod.java @@ -198,11 +198,11 @@ public class AsmMethod extends AsmResource { } private boolean isCallToNonStaticInternalField(AsmEdge edge) { - return edge.getTargetAsmClass() == (AsmClass)getParent() && edge.getUsage() == SourceCodeEdgeUsage.CALLS_FIELD && !((AsmField)edge.getTo()).isStatic(); + return edge.getTargetAsmClass() == getParent() && edge.getUsage() == SourceCodeEdgeUsage.CALLS_FIELD && !((AsmField) edge.getTo()).isStatic(); } private boolean isCallToNonStaticInternalMethod(AsmEdge edge) { - return edge.getTargetAsmClass() == (AsmClass)getParent() && edge.getUsage() == SourceCodeEdgeUsage.CALLS_METHOD && !((AsmMethod)edge.getTo()).isStatic(); + return edge.getTargetAsmClass() == getParent() && edge.getUsage() == SourceCodeEdgeUsage.CALLS_METHOD && !((AsmMethod) edge.getTo()).isStatic(); } @Override diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/DesignBridge.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/DesignBridge.java index 9e1175faee8..cfffeb395b9 100644 --- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/DesignBridge.java +++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/bridges/DesignBridge.java @@ -70,9 +70,9 @@ public class DesignBridge extends Bridge { LOG.debug("{} feedback edges", feedbackEdges.size()); int tangles = cyclesAndFESSolver.getWeightOfFeedbackEdgeSet(); - savePositiveMeasure(sonarProject, CoreMetrics.PACKAGE_CYCLES, (double) cyclesAndFESSolver.getCycles().size()); - savePositiveMeasure(sonarProject, CoreMetrics.PACKAGE_FEEDBACK_EDGES, (double) feedbackEdges.size()); - savePositiveMeasure(sonarProject, CoreMetrics.PACKAGE_TANGLES, (double) tangles); + savePositiveMeasure(sonarProject, CoreMetrics.PACKAGE_CYCLES, cyclesAndFESSolver.getCycles().size()); + savePositiveMeasure(sonarProject, CoreMetrics.PACKAGE_FEEDBACK_EDGES, feedbackEdges.size()); + savePositiveMeasure(sonarProject, CoreMetrics.PACKAGE_TANGLES, tangles); savePositiveMeasure(sonarProject, CoreMetrics.PACKAGE_EDGES_WEIGHT, getEdgesWeight(squidPackages)); String dsmJson = serializeDsm(squid, squidPackages, feedbackEdges); @@ -103,9 +103,9 @@ public class DesignBridge extends Bridge { Set<Edge> feedbackEdges = solver.getEdges(); int tangles = solver.getWeightOfFeedbackEdgeSet(); - savePositiveMeasure(sonarPackage, CoreMetrics.FILE_CYCLES, (double) cycles.size()); - savePositiveMeasure(sonarPackage, CoreMetrics.FILE_FEEDBACK_EDGES, (double) feedbackEdges.size()); - savePositiveMeasure(sonarPackage, CoreMetrics.FILE_TANGLES, (double) tangles); + savePositiveMeasure(sonarPackage, CoreMetrics.FILE_CYCLES, cycles.size()); + savePositiveMeasure(sonarPackage, CoreMetrics.FILE_FEEDBACK_EDGES, feedbackEdges.size()); + savePositiveMeasure(sonarPackage, CoreMetrics.FILE_TANGLES, tangles); savePositiveMeasure(sonarPackage, CoreMetrics.FILE_EDGES_WEIGHT, getEdgesWeight(squidFiles)); String dsmJson = serializeDsm(squid, squidFiles, feedbackEdges); diff --git a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/visitor/ClassVisitorTest.java b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/visitor/ClassVisitorTest.java index dae1ded5386..4a0544c2766 100644 --- a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/visitor/ClassVisitorTest.java +++ b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/java/ast/visitor/ClassVisitorTest.java @@ -137,7 +137,7 @@ public class ClassVisitorTest { @Test public void testCreateSquidClassFromEmptyPackage() { - SourceClass squidClass = ClassVisitor.createSourceClass((SourcePackage) new SourcePackage(""), "Squid"); + SourceClass squidClass = ClassVisitor.createSourceClass(new SourcePackage(""), "Squid"); assertEquals("Squid", squidClass.getKey()); } |