import org.sonar.server.db.migrations.SqlStatement;
import org.sonar.server.source.db.FileSourceDb;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-
import java.sql.SQLException;
import java.util.Iterator;
}
private static Iterable<Integer> splitIntegers(String s) {
- return Iterables.transform(Splitter.on(',').split(s), new Function<String, Integer>() {
+ return Iterables.transform(Splitter.on(',').omitEmptyStrings().trimResults().split(s), new Function<String, Integer>() {
@Override
- public Integer apply(String input) {
+ public Integer apply(@Nonnull String input) {
return Integer.parseInt(input);
}
});
@Test
public void find_by_key() {
- Component<?> component = mock(Component.class);
+ Component component = mock(Component.class);
when(resourceDao.findByKey("struts")).thenReturn(component);
assertThat(service.findByKey("struts")).isEqualTo(component);
}
public void clean() {
- for (ClassRealm realm : (Collection<ClassRealm>) world.getRealms()) {
+ for (ClassRealm realm : world.getRealms()) {
try {
world.disposeRealm(realm.getId());
} catch (Exception e) {
Hibernate.initialize(rule.getParams());
}
- protected final Rule doFindById(int ruleId) {
+ private Rule doFindById(int ruleId) {
DatabaseSession session = sessionFactory.getSession();
return session.getSingleResult(
session.createQuery("FROM " + Rule.class.getSimpleName() + " r WHERE r.id=:id and r.status<>:status")
setupData("fixture");
assertThat(dao.findByKey("org.struts:struts")).isNotNull();
- Component<?> component = dao.findByKey("org.struts:struts-core:src/org/struts/RequestContext.java");
+ Component component = dao.findByKey("org.struts:struts-core:src/org/struts/RequestContext.java");
assertThat(component).isNotNull();
assertThat(component.path()).isEqualTo("src/org/struts/RequestContext.java");
assertThat(dao.findByKey("unknown")).isNull();
}
@Override
- protected Object createCheck(ActiveRule activeRule) {
+ public Object createCheck(ActiveRule activeRule) {
Object object = checksByKey.get(activeRule.getConfigKey());
if (object != null) {
return instantiate(activeRule, object);
*/
public class Tokens {
- private List<TokenEntry> tokens = new ArrayList<TokenEntry>();
+ private List<TokenEntry> entries = new ArrayList<>();
public void add(TokenEntry tokenEntry) {
- this.tokens.add(tokenEntry);
+ this.entries.add(tokenEntry);
}
public Iterator<TokenEntry> iterator() {
- return tokens.iterator();
+ return entries.iterator();
}
public int size() {
- return tokens.size();
+ return entries.size();
}
public List<TokenEntry> getTokens() {
- return tokens;
+ return entries;
}
}
try {
List<File> files = Lists.newArrayList();
if (pom.getCompileClasspathElements() != null) {
- for (String classPathString : (List<String>) pom.getCompileClasspathElements()) {
+ for (String classPathString : pom.getCompileClasspathElements()) {
files.add(new File(classPathString));
}
}
import javax.annotation.CheckForNull;
-public interface Component<C extends Component> {
+public interface Component {
String key();
/**
*/
package org.sonar.api.component;
-public interface Module extends Component<Module> {
+public interface Module extends Component {
String getDescription();
String getBranch();
*/
package org.sonar.api.component;
-public interface Perspective<C extends Component<C>> {
+public interface Perspective<C extends Component> {
C component();
}
*/
package org.sonar.api.component;
-public interface SourceFile extends Component<SourceFile> {
+public interface SourceFile extends Component {
}
}
/**
- * @deprecated profile versioning is dropped in 4.4. Always returns -1.
+ * @deprecated profile versioning is dropped in 4.4. Always returns null.
*/
@CheckForNull
@Deprecated