]> source.dussan.org Git - sonarqube.git/commitdiff
Remove useless constructors with System2.INSTANCE
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 30 Jun 2014 12:48:07 +0000 (14:48 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 30 Jun 2014 13:59:44 +0000 (15:59 +0200)
sonar-batch/src/main/java/org/sonar/batch/profiling/ModuleProfiling.java
sonar-batch/src/main/java/org/sonar/batch/profiling/PhasesSumUpTimeProfiler.java
sonar-batch/src/test/java/org/sonar/batch/scan/ProjectScanContainerTest.java
sonar-core/src/main/java/org/sonar/core/permission/PermissionTemplateDao.java
sonar-core/src/main/java/org/sonar/core/rule/RuleDto.java
sonar-core/src/test/java/org/sonar/core/permission/GroupWithPermissionTemplateDaoTest.java
sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java
sonar-core/src/test/java/org/sonar/core/permission/UserWithPermissionTemplateDaoTest.java
sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java

index 8dc520e3d9dd011bec1d1ce466725301cf35daef..af2d888c8540025ab4683d7b1018c57097be4f31 100644 (file)
@@ -25,7 +25,7 @@ import org.sonar.api.utils.System2;
 import org.sonar.batch.phases.Phases;
 import org.sonar.batch.phases.Phases.Phase;
 
-import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
 
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -38,7 +38,7 @@ public class ModuleProfiling extends AbstractTimeProfiling {
   private Map<String, ItemProfiling> profilingPerBatchStep = new LinkedHashMap<String, ItemProfiling>();
   private final Project module;
 
-  public ModuleProfiling(@CheckForNull Project module, System2 system) {
+  public ModuleProfiling(@Nullable Project module, System2 system) {
     super(system);
     this.module = module;
   }
index a31cc144830866e02d33a513c734f2b1bd95c4d9..c2eec6f34a5060fcb3185ece6bcde50df7dd75bd 100644 (file)
@@ -60,10 +60,6 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx
 
   private final System2 system;
 
-  public PhasesSumUpTimeProfiler() {
-    this(System2.INSTANCE);
-  }
-
   static void println(String msg) {
     LOG.info(msg);
   }
@@ -77,8 +73,7 @@ public class PhasesSumUpTimeProfiler implements ProjectAnalysisHandler, SensorEx
     println(sb.toString());
   }
 
-  @VisibleForTesting
-  PhasesSumUpTimeProfiler(System2 system) {
+  public PhasesSumUpTimeProfiler(System2 system) {
     this.totalProfiling = new ModuleProfiling(null, system);
     this.system = system;
   }
index 8f585fd36c4e6400803882a8b986f5778b36627d..7f01b5fb55d01de64459fee722a14f554668b3d2 100644 (file)
@@ -31,6 +31,7 @@ import org.sonar.api.batch.bootstrap.ProjectReactor;
 import org.sonar.api.config.Settings;
 import org.sonar.api.platform.ComponentContainer;
 import org.sonar.api.task.TaskExtension;
+import org.sonar.api.utils.System2;
 import org.sonar.batch.bootstrap.ExtensionInstaller;
 import org.sonar.batch.profiling.PhasesSumUpTimeProfiler;
 import org.sonar.batch.scan.maven.MavenPluginExecutor;
@@ -53,6 +54,7 @@ public class ProjectScanContainerTest {
     settings = new Settings();
     parentContainer = new ComponentContainer();
     parentContainer.add(settings);
+    parentContainer.add(System2.INSTANCE);
     container = new ProjectScanContainer(parentContainer);
   }
 
index 12de7d95c95fe579a0d56d6e1314d774fef4aac5..9ec979bc2835be6ea21ccf68f76bb252ea5d53b6 100644 (file)
@@ -46,15 +46,11 @@ public class PermissionTemplateDao implements TaskComponent, ServerComponent {
   private final MyBatis myBatis;
   private final System2 system;
 
-  PermissionTemplateDao(MyBatis myBatis, System2 system) {
+  public PermissionTemplateDao(MyBatis myBatis, System2 system) {
     this.myBatis = myBatis;
     this.system = system;
   }
 
-  public PermissionTemplateDao(MyBatis myBatis) {
-    this(myBatis, System2.INSTANCE);
-  }
-
   /**
    * @return a paginated list of users.
    */
index e1859e925e3b7a92a96b250e70367d5b30b90166..fd3909bcc5851e2c3862592ee2d8ba4a7018a910 100644 (file)
@@ -305,8 +305,8 @@ public final class RuleDto extends Dto<RuleKey> {
     return effortToFixDescription;
   }
 
-  public RuleDto setEffortToFixDescription(@Nullable String effortToFixDescription) {
-    this.effortToFixDescription = effortToFixDescription;
+  public RuleDto setEffortToFixDescription(@Nullable String s) {
+    this.effortToFixDescription = s;
     return this;
   }
 
index dce3a2ac30b9595ec337fb8061968b1e768ba7ea..f91e616233a1207be5c182fb41b520dcde90d44d 100644 (file)
@@ -22,6 +22,7 @@ package org.sonar.core.permission;
 
 import org.junit.Before;
 import org.junit.Test;
+import org.sonar.api.utils.System2;
 import org.sonar.core.persistence.AbstractDaoTestCase;
 
 import java.util.List;
@@ -36,7 +37,7 @@ public class GroupWithPermissionTemplateDaoTest extends AbstractDaoTestCase {
 
   @Before
   public void setUp() {
-    dao = new PermissionTemplateDao(getMyBatis());
+    dao = new PermissionTemplateDao(getMyBatis(), System2.INSTANCE);
   }
 
   @Test
index a4efe7cac33cf9e1ec8a3c46e130110db2db3f3b..e76001acafc21e18846a0acc4484924847312a09 100644 (file)
@@ -26,6 +26,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.sonar.api.config.Settings;
+import org.sonar.api.utils.System2;
 import org.sonar.api.web.UserRole;
 import org.sonar.core.persistence.AbstractDaoTestCase;
 import org.sonar.core.persistence.MyBatis;
@@ -49,7 +50,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase {
   public void setUp() {
     RoleDao roleDao = new RoleDao(getMyBatis());
     UserDao userDao = new UserDao(getMyBatis());
-    permissionTemplateDao = new PermissionTemplateDao(getMyBatis());
+    permissionTemplateDao = new PermissionTemplateDao(getMyBatis(), System2.INSTANCE);
     Settings settings = new Settings();
     permissionFacade = new PermissionFacade(getMyBatis(), roleDao, userDao, new ResourceDao(getMyBatis()), permissionTemplateDao, settings);
   }
index 27ab2e6141810945dcfe93e8ae0f6a634f34b9d8..ed0dc5358fbf359ff8c690a95bb4e63c919d4c79 100644 (file)
@@ -22,6 +22,7 @@ package org.sonar.core.permission;
 
 import org.junit.Before;
 import org.junit.Test;
+import org.sonar.api.utils.System2;
 import org.sonar.core.persistence.AbstractDaoTestCase;
 
 import java.util.List;
@@ -36,7 +37,7 @@ public class UserWithPermissionTemplateDaoTest extends AbstractDaoTestCase {
 
   @Before
   public void setUp() {
-    dao = new PermissionTemplateDao(getMyBatis());
+    dao = new PermissionTemplateDao(getMyBatis(), System2.INSTANCE);
   }
 
   @Test
index 7522e3180d1ed5535999eaab6cbfa912fad129fb..e24d07ba7ef14655ec73c018d94a05531422acb8 100644 (file)
@@ -27,6 +27,7 @@ import org.sonar.api.config.Settings;
 import org.sonar.api.resources.Project;
 import org.sonar.api.resources.Resource;
 import org.sonar.api.security.DefaultGroups;
+import org.sonar.api.utils.System2;
 import org.sonar.core.permission.PermissionFacade;
 import org.sonar.core.permission.PermissionTemplateDao;
 import org.sonar.core.persistence.AbstractDaoTestCase;
@@ -49,7 +50,7 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase {
     project = new Project("project").setId(123);
     settings = new Settings();
     PermissionFacade permissionFacade = new PermissionFacade(getMyBatis(),
-      new RoleDao(getMyBatis()), new UserDao(getMyBatis()), new ResourceDao(getMyBatis()), new PermissionTemplateDao(getMyBatis()), settings);
+      new RoleDao(getMyBatis()), new UserDao(getMyBatis()), new ResourceDao(getMyBatis()), new PermissionTemplateDao(getMyBatis(), System2.INSTANCE), settings);
     permissions = new DefaultResourcePermissions(getMyBatis(), permissionFacade);
   }