}
public void executeOn(final Project project, SensorContext context) {
- purgeTask.purge((long) project.getId());
+ purgeTask.purge(project.getId());
}
}
}
public void purge(Project project, int projectSnapshotId) {
- clean((long) project.getId());
+ clean(project.getId());
}
public void clean(long projectId) {
private void addSubProjects(Project project, List<Resource> subProjects) {
for (Project subProject : project.getModules()) {
- Project indexedSubProject = (Project) index.getResource(subProject);
+ Project indexedSubProject = index.getResource(subProject);
if (indexedSubProject != null) {
subProjects.add(indexedSubProject);
}
private List<Element> getChildren(Element parent, String childName, @Nullable Namespace namespace) {
if (namespace == null) {
- return (List<Element>) parent.getChildren(childName);
+ return parent.getChildren(childName);
} else {
- return (List<Element>) parent.getChildren(childName, namespace);
+ return parent.getChildren(childName, namespace);
}
}
}
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) {
Parameter argumentType = extractArgumentAndReturnType(child.findFirstToken(TokenTypes.TYPE));
argumentTypes.add(new Parameter(argumentType));
}
- child = (DetailAST) child.getNextSibling();
+ child = child.getNextSibling();
}
return argumentTypes;
}
}
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
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);
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);
@Test
public void testCreateSquidClassFromEmptyPackage() {
- SourceClass squidClass = ClassVisitor.createSourceClass((SourcePackage) new SourcePackage(""), "Squid");
+ SourceClass squidClass = ClassVisitor.createSourceClass(new SourcePackage(""), "Squid");
assertEquals("Squid", squidClass.getKey());
}
}
public KeywordsTokenizer clone() {
- KeywordsTokenizer clone = (KeywordsTokenizer) super.clone();
+ KeywordsTokenizer clone = super.clone();
clone.setCaseInsensitive(true);
return clone;
}
private HtmlOptions options;
private int lineId;
- private static final int LF = (int) '\n';
- private static final int CR = (int) '\r';
+ private static final int LF = '\n';
+ private static final int CR = '\r';
public HtmlDecorator(HtmlOptions options) {
this.options = options;
assertThat((String) builder.getVariable("foo"), is("yyy"));
builder.setVariable("foo", null);
- assertThat((String) builder.getVariable("foo"), nullValue());
+ assertThat(builder.getVariable("foo"), nullValue());
assertThat((String) builder.getVariable("foo", "default"), is("default"));
}
}
List sortedList = dag.sort();
- return (Collection<T>) Collections2.filter(sortedList, Predicates.in(extensions));
+ return Collections2.filter(sortedList, Predicates.in(extensions));
}
/**
*/
@Deprecated
public static RuleMeasure createForCategory(Metric metric, Integer category, Double value) {
- return (RuleMeasure) new RuleMeasure(metric, null, null, category).setValue(value);
+ return new RuleMeasure(metric, null, null, category).setValue(value);
}
}
MavenPlugin mavenPlugin = MavenPlugin.registerPlugin(pom, "mygroup", "my.artifact", "1.0", true);
assertThat(mavenPlugin, not(nullValue()));
- Plugin plugin = MavenUtils.getPlugin((Collection<Plugin>) pom.getBuildPlugins(), "mygroup", "my.artifact");
+ Plugin plugin = MavenUtils.getPlugin(pom.getBuildPlugins(), "mygroup", "my.artifact");
assertThat(plugin, not(nullValue()));
assertThat(plugin.getVersion(), is("1.0"));
}
MavenPlugin mavenPlugin = MavenPlugin.registerPlugin(pom, "mygroup", "my.artifact", "1.0", true);
assertThat(mavenPlugin, not(nullValue()));
- Plugin plugin = MavenUtils.getPlugin((Collection<Plugin>) pom.getBuildPlugins(), "mygroup", "my.artifact");
+ Plugin plugin = MavenUtils.getPlugin(pom.getBuildPlugins(), "mygroup", "my.artifact");
assertThat(plugin, not(nullValue()));
assertThat(plugin.getVersion(), is("1.0"));
- Plugin pluginManagement = MavenUtils.getPlugin((Collection<Plugin>) pom.getPluginManagement().getPlugins(), "mygroup", "my.artifact");
+ Plugin pluginManagement = MavenUtils.getPlugin(pom.getPluginManagement().getPlugins(), "mygroup", "my.artifact");
assertThat(pluginManagement, nullValue());
}
MavenPlugin mavenPlugin = MavenPlugin.registerPlugin(pom, "mygroup", "my.artifact", "1.0", false);
assertThat(mavenPlugin, not(nullValue()));
- Plugin plugin = MavenUtils.getPlugin((Collection<Plugin>) pom.getBuildPlugins(), "mygroup", "my.artifact");
+ Plugin plugin = MavenUtils.getPlugin(pom.getBuildPlugins(), "mygroup", "my.artifact");
assertThat(plugin, not(nullValue()));
assertThat(plugin.getVersion(), is("0.9"));
- Plugin pluginManagement = MavenUtils.getPlugin((Collection<Plugin>) pom.getPluginManagement().getPlugins(), "mygroup", "my.artifact");
+ Plugin pluginManagement = MavenUtils.getPlugin(pom.getPluginManagement().getPlugins(), "mygroup", "my.artifact");
assertThat(pluginManagement, nullValue());
}
MavenPlugin mavenPlugin = MavenPlugin.registerPlugin(pom, "mygroup", "my.artifact", "1.0", false);
assertThat(mavenPlugin, not(nullValue()));
- Plugin plugin = MavenUtils.getPlugin((Collection<Plugin>) pom.getBuildPlugins(), "mygroup", "my.artifact");
+ Plugin plugin = MavenUtils.getPlugin(pom.getBuildPlugins(), "mygroup", "my.artifact");
assertThat(plugin, not(nullValue()));
assertThat(plugin.getVersion(), is("0.9"));
assertThat(plugin.getDependencies().size(), is(1));
MavenPlugin mavenPlugin = MavenPlugin.registerPlugin(pom, "mygroup", "my.artifact", "1.0", false);
assertThat(mavenPlugin, not(nullValue()));
- Plugin plugin = MavenUtils.getPlugin((Collection<Plugin>) pom.getBuildPlugins(), "mygroup", "my.artifact");
+ Plugin plugin = MavenUtils.getPlugin(pom.getBuildPlugins(), "mygroup", "my.artifact");
assertThat(plugin, not(nullValue()));
assertThat(plugin.getVersion(), is("0.9"));
assertThat(plugin.getDependencies().size(), is(1));
setupData("shared");
task.start();
- List<Rule> rules = (List<Rule>) getSession()
+ List<Rule> rules = getSession()
.createQuery("from " + Rule.class.getSimpleName() + " where pluginName<>'fake'")
.getResultList();
assertThat(rules.size(), greaterThan(0));
final Views views = new Views(VIEWS);
List resourceViewers = views.getPages(NavigationSection.RESOURCE_TAB);
assertThat(resourceViewers.size(), is(1 + 4 /* default */));
- assertThat(resourceViewers.contains(new ViewProxy((View) FAKE_TAB)), is(true));
+ assertThat(resourceViewers.contains(new ViewProxy(FAKE_TAB)), is(true));
}
@Test
return 0;
}
SumAggregationFormula sumFormula = new SumAggregationFormula();
- return sumFormula.aggregate(metric, measurables) / (double) measurables.size();
+ return sumFormula.aggregate(metric, measurables) / measurables.size();
}
}