diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-09-02 14:12:34 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-09-02 14:12:34 +0200 |
commit | a1d9480ac376955a23c3b23e6237a587139d86bb (patch) | |
tree | 180bb3409ca09fa78344e1a0f82dd1f38ec739cd | |
parent | 259fa0a5f2076aad072ea5f83980948553089fa8 (diff) | |
download | sonarqube-a1d9480ac376955a23c3b23e6237a587139d86bb.tar.gz sonarqube-a1d9480ac376955a23c3b23e6237a587139d86bb.zip |
Fix quality flaws
11 files changed, 58 insertions, 11 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/deprecated/ResourceFilters.java b/sonar-batch/src/main/java/org/sonar/batch/deprecated/ResourceFilters.java index f60713506d7..beeb5123a85 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/deprecated/ResourceFilters.java +++ b/sonar-batch/src/main/java/org/sonar/batch/deprecated/ResourceFilters.java @@ -41,7 +41,7 @@ public class ResourceFilters { check(logger, filters); } - private void check(Logger logger, ResourceFilter[] filters) { + private static void check(Logger logger, ResourceFilter[] filters) { if (filters.length > 0) { logger.warn("ResourceFilters are not supported since version 4.2: " + Joiner.on(", ").join(filters)); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/ActiveRulesPublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/ActiveRulesPublisher.java index b31bb9b3197..b7097b3a280 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/report/ActiveRulesPublisher.java +++ b/sonar-batch/src/main/java/org/sonar/batch/report/ActiveRulesPublisher.java @@ -43,7 +43,7 @@ public class ActiveRulesPublisher implements ReportPublisherStep { writer.writeActiveRules(activeRuleMessages); } - private class ToMessage implements Function<ActiveRule, BatchReport.ActiveRule> { + private static class ToMessage implements Function<ActiveRule, BatchReport.ActiveRule> { private final BatchReport.ActiveRule.Builder builder = BatchReport.ActiveRule.newBuilder(); @Override diff --git a/sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java b/sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java index ea5850f709e..d77de10243e 100644 --- a/sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java +++ b/sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java @@ -93,9 +93,9 @@ public class PluginLoader { def.addFiles(explodedPlugin.getLibs()); def.addMainClass(info.getKey(), info.getMainClass()); - for (String defaultSharedResource : DEFAULT_SHARED_RESOURCES) { - def.getExportMask().addInclusion(String.format("%s/%s/api/", defaultSharedResource, info.getKey())); - } + for (String defaultSharedResource : DEFAULT_SHARED_RESOURCES) { + def.getExportMask().addInclusion(String.format("%s/%s/api/", defaultSharedResource, info.getKey())); + } // The plugins that extend other plugins can only add some files to classloader. // They can't change metadata like ordering strategy or compatibility mode. diff --git a/sonar-db/src/main/java/org/sonar/core/persistence/package-info.java b/sonar-db/src/main/java/org/sonar/core/persistence/package-info.java new file mode 100644 index 00000000000..db3118f00c9 --- /dev/null +++ b/sonar-db/src/main/java/org/sonar/core/persistence/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package org.sonar.core.persistence; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-db/src/main/java/org/sonar/core/properties/package-info.java b/sonar-db/src/main/java/org/sonar/core/properties/package-info.java new file mode 100644 index 00000000000..cdd84a16be4 --- /dev/null +++ b/sonar-db/src/main/java/org/sonar/core/properties/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package org.sonar.core.properties; + +import javax.annotation.ParametersAreNonnullByDefault; + diff --git a/sonar-db/src/main/java/org/sonar/core/user/DefaultUserFinder.java b/sonar-db/src/main/java/org/sonar/core/user/DefaultUserFinder.java index 428d7b27918..11937a4c7da 100644 --- a/sonar-db/src/main/java/org/sonar/core/user/DefaultUserFinder.java +++ b/sonar-db/src/main/java/org/sonar/core/user/DefaultUserFinder.java @@ -59,7 +59,7 @@ public class DefaultUserFinder implements UserFinder { return toUsers(dtos); } - private List<User> toUsers(Collection<UserDto> dtos) { + private static List<User> toUsers(Collection<UserDto> dtos) { List<User> users = Lists.newArrayList(); for (UserDto dto : dtos) { users.add(dto.toUser()); diff --git a/sonar-db/src/main/java/org/sonar/core/user/DeprecatedUserFinder.java b/sonar-db/src/main/java/org/sonar/core/user/DeprecatedUserFinder.java index d379d878ad3..38da8a47df0 100644 --- a/sonar-db/src/main/java/org/sonar/core/user/DeprecatedUserFinder.java +++ b/sonar-db/src/main/java/org/sonar/core/user/DeprecatedUserFinder.java @@ -46,7 +46,7 @@ public class DeprecatedUserFinder implements UserFinder { return copy(userDao.selectActiveUserByLogin(login)); } - private User copy(@Nullable UserDto dto) { + private static User copy(@Nullable UserDto dto) { if (dto != null) { User user = new User().setEmail(dto.getEmail()).setLogin(dto.getLogin()).setName(dto.getName()); user.setId(dto.getId().intValue()); diff --git a/sonar-db/src/main/java/org/sonar/db/component/ResourceKeyUpdaterDao.java b/sonar-db/src/main/java/org/sonar/db/component/ResourceKeyUpdaterDao.java index 78217f48edd..1ec320febf5 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ResourceKeyUpdaterDao.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ResourceKeyUpdaterDao.java @@ -133,7 +133,7 @@ public class ResourceKeyUpdaterDao implements Dao { } } - private Set<ResourceDto> collectAllModules(long projectId, String stringToReplace, ResourceKeyUpdaterMapper mapper) { + private static Set<ResourceDto> collectAllModules(long projectId, String stringToReplace, ResourceKeyUpdaterMapper mapper) { ResourceDto project = mapper.selectProject(projectId); Set<ResourceDto> modules = Sets.newHashSet(); if (project.getKey().contains(stringToReplace)) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java index bae6ea57511..561cded1c40 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java @@ -27,7 +27,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Properties; import javax.annotation.CheckForNull; -import javax.annotation.Nullable; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; import org.sonar.api.CoreProperties; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java index 4e88bc085cc..16b780739e7 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java @@ -66,7 +66,7 @@ public abstract class ProfileExporter { } protected final ProfileExporter setSupportedLanguages(String... languages) { - supportedLanguages = (languages != null) ? languages : new String[0]; + supportedLanguages = (languages != null ? languages : new String[0]); return this; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java index bc37cec75b3..afe3d17e748 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java @@ -64,7 +64,7 @@ public abstract class ProfileImporter { } protected final ProfileImporter setSupportedLanguages(String... languages) { - supportedLanguages = ((languages != null) ? languages : new String[0]); + supportedLanguages = (languages != null ? languages : new String[0]); return this; } |