aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2019-12-09 09:34:43 -0600
committerSonarTech <sonartech@sonarsource.com>2019-12-10 20:46:09 +0100
commitd1fd889554bccbb50122550899dbb66b90b04f78 (patch)
tree9cad838366292ee79b77ac3513403f7489b06355
parentf86a1094588e4e47b3abf612891af0431653cd0e (diff)
downloadsonarqube-d1fd889554bccbb50122550899dbb66b90b04f78.tar.gz
sonarqube-d1fd889554bccbb50122550899dbb66b90b04f78.zip
Fix code quality issues and reduce dependency on Guava
-rw-r--r--plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/ChecksSensor.java2
-rw-r--r--plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/MultilineIssuesSensor.java10
-rw-r--r--plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/AnalysisErrorSensorTest.java3
-rw-r--r--server/sonar-auth-github/src/main/java/org/sonar/auth/github/GitHubSettings.java4
-rw-r--r--server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/Krb5LoginConfiguration.java2
-rw-r--r--server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapAutodiscoveryTest.java2
-rw-r--r--server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapGroupsProviderTest.java2
-rw-r--r--server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapSettingsManagerTest.java23
-rw-r--r--server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapUsersProviderTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/CloseIssuesOnRemovedComponentsVisitor.java5
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueCounter.java6
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueLifecycle.java1
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/LiveMeasureDtoToMeasure.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureDtoToMeasure.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImpl.java5
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/notification/ReportAnalysisFailureNotificationEmailTemplate.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutorTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/component/CrawlerDepthLimitTest.java24
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImplTest.java4
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/AverageFormulaExecutionTest.java4
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/ReportFormulaExecutorComponentVisitorTest.java4
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/SumFormulaExecutionTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java1
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssuesRepositoryVisitorTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/MovedIssueVisitorTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecutionTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/RuleRepositoryImplTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/RuleRepositoryRule.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/TrackerBaseInputFactoryTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/BestValueOptimizationTest.java4
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImplTest.java8
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureTest.java4
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureToMeasureDtoTest.java6
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitygate/QualityGateServiceImplTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitorTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoDbLoaderTest.java1
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoRepositoryRule.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesDiffImplTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/DbMigrationsStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ExecuteVisitorsStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCommentMeasuresStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCoverageMeasuresStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportLanguageDistributionMeasuresStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java3
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCommentMeasuresStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCoverageMeasuresStepTest.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java1
-rw-r--r--server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryRule.java1
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeTaskProcessorRepositoryImpl.java13
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/CeDistributedInformationImplTest.java3
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java2
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginRepositoryTest.java4
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java2
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java2
-rw-r--r--server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfilingPreparedStatementHandler.java2
-rw-r--r--server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfilingStatementHandler.java2
-rw-r--r--server/sonar-db-core/src/test/java/org/sonar/db/DatabaseUtilsTest.java2
-rw-r--r--server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java7
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java3
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricDao.java8
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java6
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipDao.java4
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingDaoTest.java2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java8
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/dump/DumpSQSchema.java4
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueMapperTest.java6
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoTest.java6
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeMapperTest.java2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeProfilerTest.java2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java1
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java2
-rw-r--r--server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java2
-rw-r--r--server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java2
-rw-r--r--server/sonar-db-dao/src/testFixtures/java/org/sonar/db/notification/NotificationDbTester.java2
-rw-r--r--server/sonar-db-dao/src/testFixtures/java/org/sonar/db/user/GroupTesting.java3
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandlerTest.java2
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImplTest.java7
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerPopulatorImplTest.java5
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImplTest.java10
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/DataChangeTest.java69
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepRegistryImplTest.java3
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImplTest.java4
-rw-r--r--server/sonar-main/src/test/java/org/sonar/application/ProcessLauncherImplTest.java2
-rw-r--r--server/sonar-main/src/test/java/org/sonar/application/cluster/AppNodesClusterHostsConsistencyTest.java2
-rw-r--r--server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java2
-rw-r--r--server/sonar-main/src/test/java/org/sonar/application/process/EsManagedProcessTest.java2
-rw-r--r--server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java2
-rw-r--r--server/sonar-process/src/main/java/org/sonar/process/logging/LogbackHelper.java4
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/ConfigurationUtilsTest.java16
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/ProcessEntryPointTest.java11
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java6
-rw-r--r--server/sonar-process/src/test/java/org/sonar/process/cluster/health/SharedHealthStateImplTest.java2
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/es/IndexDefinition.java4
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/es/IndexDefinitionHash.java12
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIteratorForSingleChunk.java4
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java3
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java3
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssuesChangesNotificationBuilder.java2
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/notification/NotificationDispatcherMetadata.java4
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleExtensionDoc.java4
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/user/index/UserDoc.java4
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/view/index/ViewDoc.java4
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/view/index/ViewIndexer.java6
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/webhook/WebhookPayloadFactoryImpl.java3
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/es/OneToManyResilientIndexingListenerTest.java2
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/es/OneToOneResilientIndexingListenerTest.java2
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/es/SortingTest.java10
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandlerTest.java3
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java2
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java2
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java8
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/property/InternalPropertiesImplTest.java2
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/qualitygate/notification/QGChangeEmailTemplateTest.java3
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/qualityprofile/index/ActiveRuleIndexerTest.java3
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/setting/ThreadLocalSettingsTest.java2
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/util/AbstractStoppableExecutorServiceTest.java14
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java2
-rw-r--r--server/sonar-server-common/src/testFixtures/java/org/elasticsearch/transport/MockTcpTransport.java6
-rw-r--r--server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/FakeDoc.java4
-rw-r--r--server/sonar-server-common/src/testFixtures/java/org/sonar/server/issue/IssueDocTesting.java4
-rw-r--r--server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java2
-rw-r--r--server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginFileSystemTest.java9
-rw-r--r--server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/UpdateCenterServlet.java1
-rw-r--r--server/sonar-webserver-api/src/test/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImplTest.java3
-rw-r--r--server/sonar-webserver-api/src/test/java/org/sonar/server/setting/ProjectConfigurationLoaderImplTest.java2
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/HttpHeadersAuthentication.java2
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileDefinitionsBridge.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/HttpHeadersAuthenticationTest.java4
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/JwtCsrfVerifierTest.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/JwtHttpHandlerTest.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/RequestAuthenticatorImplTest.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserSessionInitializerTest.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/event/AuthenticationEventImplTest.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQPChangeNotificationTemplateTest.java2
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileDefinitionsBridgeTest.java6
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java4
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java11
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java2
-rw-r--r--server/sonar-webserver-auth/src/testFixtures/java/org/sonar/server/tester/AbstractMockUserSession.java4
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java5
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java3
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/debt/DebtModelPluginRepositoryTest.java13
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/es/IndexerStartupTaskTest.java2
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationChannelTest.java2
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationDaemonTest.java2
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DefaultServerUpgradeStatusTest.java2
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdManagerTest.java2
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/qualitygate/ProjectsInWarningDaemonTest.java6
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/rule/CachingRuleFinderTest.java2
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java50
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/rule/WebServerRuleFinderImplTest.java2
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/search/BaseDocTest.java8
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/startup/RegisterMetricsTest.java2
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java4
-rw-r--r--server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java2
-rw-r--r--server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexDefinitions.java4
-rw-r--r--server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java6
-rw-r--r--server/sonar-webserver-es/src/test/java/org/sonar/server/es/RecoveryIndexerTest.java4
-rw-r--r--server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/IssuesAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/ProjectDataLoader.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/IssuesFinderSort.java14
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/Result.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseData.java6
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/custom/ws/CustomMeasureJsonWriter.java5
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/MeasureMatrix.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/notification/ws/ListAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/UpdateAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/DbMigrationStatusAction.java5
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/MigrateDbAction.java5
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java2
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PluginUpdateAggregator.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java5
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileComparison.java8
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/NewCustomRule.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/RuleUpdate.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java4
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/DeactivateAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UpdateLoginAction.java8
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/DeleteAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/UpdateAction.java3
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LoginActionTest.java6
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LogoutActionTest.java6
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/queue/ReportSubmitterTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ComponentServiceUpdateKeyTest.java3
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/duplication/ws/ShowActionTest.java6
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/favorite/ws/AddActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/favorite/ws/RemoveActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/health/HealthCheckerImplTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/AddTagsActionTest.java1
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/AssignActionTest.java3
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/CommentActionTest.java12
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/IssueFinderTest.java3
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/RemoveTagsActionTest.java7
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/TransitionActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/TransitionServiceTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/AddCommentActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/AssignActionTest.java3
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/ChangelogActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/custom/ws/MetricsActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/live/LiveMeasureComputerImplTest.java4
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java1
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/notification/ws/AddActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/notification/ws/RemoveActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/GroupPermissionChangerTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/UserPermissionChangerTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java4
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java6
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/AddUserToTemplateActionTest.java21
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/DeleteTemplateActionTest.java13
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/HealthActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/InfoActionTest.java8
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/StatusActionTest.java24
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/UpgradesActionTest.java3
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/UpdateKeyActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/UpdateVisibilityActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectanalysis/ws/SearchActionTest.java5
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/projecttag/ws/SetActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/DestroyActionTest.java4
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/SelectActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileComparisonTest.java3
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/RegisterQualityProfilesNotificationTest.java12
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/BackupActionTest.java1
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangeParentActionTest.java1
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangelogActionTest.java1
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ExportActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/InheritanceActionTest.java1
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java8
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/RemoveProjectActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/ListDefinitionsActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/SetActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/SettingsUpdaterTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/ValuesActionTest.java4
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/source/ws/RawActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/UpdateLoginActionTest.java10
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/usergroups/ws/AddUserActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/usergroups/ws/DeleteActionTest.java4
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/DeleteActionTest.java2
-rw-r--r--server/sonar-webserver-webapi/src/test/java/org/sonar/server/ws/ws/ResponseExampleActionTest.java2
-rw-r--r--server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/DefaultLocalResponse.java4
-rw-r--r--server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/RemovedWebServiceHandlerTest.java2
-rw-r--r--server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/DumbResponse.java6
-rw-r--r--server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/TestRequest.java3
-rw-r--r--server/sonar-webserver/src/main/java/org/sonar/server/platform/web/MasterServletFilter.java3
-rw-r--r--server/sonar-webserver/src/test/java/org/sonar/server/app/TomcatContextsTest.java2
-rw-r--r--server/sonar-webserver/src/test/java/org/sonar/server/platform/web/MasterServletFilterTest.java2
-rw-r--r--server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RedirectFilterTest.java2
-rw-r--r--server/sonar-webserver/src/test/java/org/sonar/server/platform/web/UserSessionFilterTest.java2
-rw-r--r--server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesFilterTest.java4
-rw-r--r--server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebServiceReroutingFilterTest.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java6
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/FieldDiffs.java21
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/tracking/AbstractTracker.java1
-rw-r--r--sonar-core/src/main/java/org/sonar/core/util/DefaultHttpDownloader.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/util/HttpsTrust.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/util/logs/DefaultProfiler.java3
-rw-r--r--sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java2
-rw-r--r--sonar-core/src/test/java/org/sonar/core/util/ProgressLoggerTest.java2
-rw-r--r--sonar-core/src/test/java/org/sonar/core/util/ProtobufJsonFormatTest.java4
-rw-r--r--sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java46
-rw-r--r--sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java2
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/detector/ContainsInComparator.java20
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/statement/matcher/UptoTokenMatcher.java5
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/detector/original/BlocksGroupTest.java5
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/index/DataUtilsTest.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/TokenizerBridgeTest.java3
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/java/JavaDuplicationsFunctionalTest.java6
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementTest.java2
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/predicates/AbsolutePathPredicate.java2
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/predicates/URIPredicate.java2
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/DefaultSensorDescriptor.java4
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java2
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/WorkDuration.java12
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultFileSystemTest.java6
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultInputDirTest.java2
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultInputFileTest.java8
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/PathPatternTest.java6
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/predicates/DefaultFilePredicatesTest.java6
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/predicates/FilenamePredicateTest.java7
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/impl/utils/ScannerUtilsTest.java2
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/impl/utils/WorkDurationTest.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasure.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleParamType.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java6
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java10
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/log/DefaultProfiler.java3
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestComponentTest.java20
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestIssueTest.java26
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureComputerContextTest.java42
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureTest.java20
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestSettingsTest.java4
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTest.java7
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/config/ConfigurationTest.java6
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/profiles/AnnotationProfileParserTest.java19
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/AbstractLanguageTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/server/profile/BuiltInQualityProfilesDefinitionTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleParamTypeTest.java10
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleTagsToTypeConverterTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest.java5
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultRepositoryTest.java3
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/user/UserGroupValidationTest.java10
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java6
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/FieldUtils2Test.java20
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/System2Test.java9
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/ZipUtilsTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogbackLoggerTest.java1
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/LogOutput.java2
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploder.java4
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializer.java2
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/MetricsRepository.java3
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java2
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java8
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfiguratorTest.java9
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalTempFolderProviderTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/MetricProviderTest.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ModuleSensorExtensionDictionnaryTest.java18
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/PostJobExtensionDictionnaryTest.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ProcessedScannerPropertiesTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdSettingsTest.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/deprecated/perspectives/PerspectiveBuilderTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageReportParserTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueFilterChainTest.java8
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/LineRangeTest.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoaderTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java3
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/DeprecatedBranchMediumTest.java5
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java5
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumTest.java8
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/PreviewMediumTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tasks/TasksMediumTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/ProjectRepositoriesSupplierTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/SingleProjectRepositoryTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileVerifierTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectBuildersExecutorTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java34
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/ProjectPullRequestsTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputComponentStoreTest.java2
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java17
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java15
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleInputComponentStoreTest.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ProjectExclusionFiltersTest.java14
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/DefaultBlameOutputTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/util/ScannerUtilsTest.java4
-rw-r--r--sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java31
-rw-r--r--sonar-testing-harness/src/main/java/org/sonar/test/JsonComparison.java4
-rw-r--r--sonar-testing-harness/src/test/java/org/sonar/test/i18n/BundleSynchronizedMatcherTest.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/analysisreports/AnalysisReportsService.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/AuthenticationService.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/LoginRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/batch/BatchService.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/batch/FileRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/batch/IssuesRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/batch/ProjectRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CancelRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ComponentRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/ce/SubmitRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/components/AppRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/components/ComponentsService.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/components/ShowRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/CreateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/DeleteRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/MetricsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/UpdateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/DuplicationsService.java3
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/ShowRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/emails/EmailsService.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/emails/SendRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/AddRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/FavoritesService.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/RemoveRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/SearchRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AddCommentRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/IndexRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/L10nService.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/languages/LanguagesService.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/languages/ListRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/measures/MeasuresService.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/CreateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/UpdateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/NavigationService.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/OrganizationRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/AddRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/ListRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/NotificationsService.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/RemoveRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/SearchMembersRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupToTemplateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddProjectCreatorToTemplateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserToTemplateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/ApplyTemplateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/CreateTemplateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/DeleteTemplateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/GroupsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupFromTemplateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveProjectCreatorFromTemplateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserFromTemplateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchGlobalPermissionsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchProjectPermissionsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchTemplatesRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SetDefaultTemplateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateGroupsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateUsersRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UpdateTemplateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UsersRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/DownloadRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/InstallRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UninstallRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UpdateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/CreateEventRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteEventRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SearchRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SetBaselineRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UnsetBaselineRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UpdateEventRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/DeleteRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ListRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/RenameRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/CreateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/SearchRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/DeleteRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/ListRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/ProjectPullRequestsService.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projects/CreateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projects/DeleteRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projects/SearchMyProjectsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateKeyRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateVisibilityRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/SearchRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/properties/IndexRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/properties/PropertiesService.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ListRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UnsetDefaultRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddGroupRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddProjectRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddUserRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/BackupRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangeParentRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangelogRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CompareRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CopyRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CreateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeleteRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ExportRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/InheritanceRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ProjectsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveGroupRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveProjectRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveUserRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RenameRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RestoreRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchGroupsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchUsersRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SetDefaultRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ShowRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/roots/RootsService.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/roots/SetRootRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/roots/UnsetRootRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/rules/AppRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/rules/ShowRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/rules/TagsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/ShowRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/server/ServerService.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/sources/HashRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IndexRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IssueSnippetsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/sources/LinesRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/sources/RawRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ScmRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ShowRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/sources/SourcesService.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/system/ChangeLogLevelRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/system/LogsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/timemachine/TimemachineService.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/InstalledPluginsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UpdatecenterService.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UploadRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/AddUserRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/CreateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/DeleteRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/RemoveUserRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UpdateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UsersRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/userproperties/UserPropertiesService.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/users/SetHomepageRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/GenerateRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/RevokeRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/SearchRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/UserTokensService.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeleteRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeliveryRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/ListRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ListRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ResponseExampleRequest.java1
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/WebservicesService.java2
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/BaseServiceTest.java5
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java4
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/HttpExceptionTest.java2
582 files changed, 808 insertions, 1339 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/ChecksSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/ChecksSensor.java
index 76c839d1a07..c058af0d199 100644
--- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/ChecksSensor.java
+++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/ChecksSensor.java
@@ -50,7 +50,7 @@ public class ChecksSensor implements Sensor {
@Override
public void execute(SensorContext context) {
Checks<Check> checks = checkFactory.create(XooRulesDefinition.XOO_REPOSITORY);
- checks.addAnnotatedChecks((Object[]) Check.ALL);
+ checks.addAnnotatedChecks(Check.ALL);
FilePredicates p = context.fileSystem().predicates();
for (InputFile file : context.fileSystem().inputFiles(p.and(p.hasLanguages(Xoo.KEY), p.hasType(Type.MAIN)))) {
for (Check check : checks.all()) {
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/MultilineIssuesSensor.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/MultilineIssuesSensor.java
index c1592e3cf8b..7c91f7c7120 100644
--- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/MultilineIssuesSensor.java
+++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/rule/MultilineIssuesSensor.java
@@ -21,11 +21,11 @@ package org.sonar.xoo.rule;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import com.google.common.collect.Table;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
@@ -70,10 +70,10 @@ public class MultilineIssuesSensor implements Sensor {
}
private static void createIssues(InputFile file, SensorContext context) {
- Map<Integer, TextPointer> startIssuesPositions = Maps.newHashMap();
- Map<Integer, TextPointer> endIssuesPositions = Maps.newHashMap();
- Map<Integer, Table<Integer, Integer, TextPointer>> startFlowsPositions = Maps.newHashMap();
- Map<Integer, Table<Integer, Integer, TextPointer>> endFlowsPositions = Maps.newHashMap();
+ Map<Integer, TextPointer> startIssuesPositions = new HashMap<>();
+ Map<Integer, TextPointer> endIssuesPositions = new HashMap<>();
+ Map<Integer, Table<Integer, Integer, TextPointer>> startFlowsPositions = new HashMap<>();
+ Map<Integer, Table<Integer, Integer, TextPointer>> endFlowsPositions = new HashMap<>();
parseIssues(file, context, startIssuesPositions, endIssuesPositions);
parseFlows(file, startFlowsPositions, endFlowsPositions);
diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/AnalysisErrorSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/AnalysisErrorSensorTest.java
index f08e3bd202a..3f2a356d707 100644
--- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/AnalysisErrorSensorTest.java
+++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/AnalysisErrorSensorTest.java
@@ -42,7 +42,6 @@ public class AnalysisErrorSensorTest {
public TemporaryFolder temp = new TemporaryFolder();
private AnalysisErrorSensor sensor;
- private SensorContextTester context;
@Before
public void setUp() {
@@ -74,7 +73,7 @@ public class AnalysisErrorSensorTest {
.setModuleBaseDir(baseDir)
.setLines(4)
.build();
- context = SensorContextTester.create(baseDir);
+ SensorContextTester context = SensorContextTester.create(baseDir);
context.fileSystem().add(inputFile);
sensor.execute(context);
diff --git a/server/sonar-auth-github/src/main/java/org/sonar/auth/github/GitHubSettings.java b/server/sonar-auth-github/src/main/java/org/sonar/auth/github/GitHubSettings.java
index 272f2ed19c5..04af2ddd440 100644
--- a/server/sonar-auth-github/src/main/java/org/sonar/auth/github/GitHubSettings.java
+++ b/server/sonar-auth-github/src/main/java/org/sonar/auth/github/GitHubSettings.java
@@ -142,7 +142,7 @@ public class GitHubSettings {
.category(CATEGORY)
.subCategory(SUBCATEGORY)
.type(STRING)
- .defaultValue(valueOf("https://api.github.com/"))
+ .defaultValue("https://api.github.com/")
.index(7)
.build(),
PropertyDefinition.builder(WEB_URL)
@@ -152,7 +152,7 @@ public class GitHubSettings {
.category(CATEGORY)
.subCategory(SUBCATEGORY)
.type(STRING)
- .defaultValue(valueOf("https://github.com/"))
+ .defaultValue("https://github.com/")
.index(8)
.build(),
PropertyDefinition.builder(ORGANIZATIONS)
diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/Krb5LoginConfiguration.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/Krb5LoginConfiguration.java
index c13360733c6..6748c4b166a 100644
--- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/Krb5LoginConfiguration.java
+++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/Krb5LoginConfiguration.java
@@ -32,7 +32,7 @@ public class Krb5LoginConfiguration extends Configuration {
static {
String loginModule = "com.sun.security.auth.module.Krb5LoginModule";
AppConfigurationEntry.LoginModuleControlFlag flag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
- CONFIG_LIST[0] = new AppConfigurationEntry(loginModule, flag, new HashMap<String, Object>());
+ CONFIG_LIST[0] = new AppConfigurationEntry(loginModule, flag, new HashMap<>());
}
/**
diff --git a/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapAutodiscoveryTest.java b/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapAutodiscoveryTest.java
index 989a3305fd7..7cfa94a1073 100644
--- a/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapAutodiscoveryTest.java
+++ b/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapAutodiscoveryTest.java
@@ -73,7 +73,7 @@ public class LdapAutodiscoveryTest {
Attribute attribute = mock(Attribute.class);
NamingEnumeration namingEnumeration = mock(NamingEnumeration.class);
- when(context.getAttributes(Mockito.anyString(), Mockito.<String[]>anyObject())).thenReturn(attributes);
+ when(context.getAttributes(Mockito.anyString(), Mockito.anyObject())).thenReturn(attributes);
when(attributes.get(Mockito.eq("srv"))).thenReturn(attribute);
when(attribute.getAll()).thenReturn(namingEnumeration);
when(namingEnumeration.hasMore()).thenReturn(true, true, true, true, true, false);
diff --git a/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapGroupsProviderTest.java b/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapGroupsProviderTest.java
index a2aab4bc3c0..7859f415903 100644
--- a/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapGroupsProviderTest.java
+++ b/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapGroupsProviderTest.java
@@ -44,7 +44,7 @@ public class LdapGroupsProviderTest {
public static LdapServer infosupportServer = new LdapServer(USERS_INFOSUPPORT_COM_LDIF, "infosupport.com", "dc=infosupport,dc=com");
@Test
- public void defaults() throws Exception {
+ public void defaults() {
MapSettings settings = LdapSettingsFactory.generateSimpleAnonymousAccessSettings(exampleServer, null);
LdapSettingsManager settingsManager = new LdapSettingsManager(settings, new LdapAutodiscovery());
diff --git a/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapSettingsManagerTest.java b/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapSettingsManagerTest.java
index 88d16dedec8..02780a2af32 100644
--- a/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapSettingsManagerTest.java
+++ b/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapSettingsManagerTest.java
@@ -62,7 +62,7 @@ public class LdapSettingsManagerTest {
}
@Test
- public void testContextFactoriesWithSingleLdap() throws Exception {
+ public void testContextFactoriesWithSingleLdap() {
LdapSettingsManager settingsManager = new LdapSettingsManager(
generateSingleLdapSettingsWithUserAndGroupMapping(), new LdapAutodiscovery());
assertThat(settingsManager.getContextFactories().size()).isEqualTo(1);
@@ -71,11 +71,9 @@ public class LdapSettingsManagerTest {
/**
* Test there are 2 @link{org.sonar.plugins.ldap.LdapContextFactory}s found.
*
- * @throws Exception
- * This is not expected.
*/
@Test
- public void testContextFactoriesWithMultipleLdap() throws Exception {
+ public void testContextFactoriesWithMultipleLdap() {
LdapSettingsManager settingsManager = new LdapSettingsManager(
generateMultipleLdapSettingsWithUserAndGroupMapping(), new LdapAutodiscovery());
assertThat(settingsManager.getContextFactories().size()).isEqualTo(2);
@@ -84,7 +82,7 @@ public class LdapSettingsManagerTest {
}
@Test
- public void testAutodiscover() throws Exception {
+ public void testAutodiscover() {
LdapAutodiscovery ldapAutodiscovery = mock(LdapAutodiscovery.class);
LdapSrvRecord ldap1 = new LdapSrvRecord("ldap://localhost:189", 1, 1);
LdapSrvRecord ldap2 = new LdapSrvRecord("ldap://localhost:1899", 1, 1);
@@ -95,9 +93,9 @@ public class LdapSettingsManagerTest {
}
@Test
- public void testAutodiscoverFailed() throws Exception {
+ public void testAutodiscoverFailed() {
LdapAutodiscovery ldapAutodiscovery = mock(LdapAutodiscovery.class);
- when(ldapAutodiscovery.getLdapServers("example.org")).thenReturn(Collections.<LdapSrvRecord>emptyList());
+ when(ldapAutodiscovery.getLdapServers("example.org")).thenReturn(Collections.emptyList());
LdapSettingsManager settingsManager = new LdapSettingsManager(
generateAutodiscoverSettings(), ldapAutodiscovery);
@@ -110,11 +108,9 @@ public class LdapSettingsManagerTest {
/**
* Test there are 2 @link{org.sonar.plugins.ldap.LdapUserMapping}s found.
*
- * @throws Exception
- * This is not expected.
*/
@Test
- public void testUserMappings() throws Exception {
+ public void testUserMappings() {
LdapSettingsManager settingsManager = new LdapSettingsManager(
generateMultipleLdapSettingsWithUserAndGroupMapping(), new LdapAutodiscovery());
assertThat(settingsManager.getUserMappings().size()).isEqualTo(2);
@@ -125,11 +121,9 @@ public class LdapSettingsManagerTest {
/**
* Test there are 2 @link{org.sonar.plugins.ldap.LdapGroupMapping}s found.
*
- * @throws Exception
- * This is not expected.
*/
@Test
- public void testGroupMappings() throws Exception {
+ public void testGroupMappings() {
LdapSettingsManager settingsManager = new LdapSettingsManager(
generateMultipleLdapSettingsWithUserAndGroupMapping(), new LdapAutodiscovery());
assertThat(settingsManager.getGroupMappings().size()).isEqualTo(2);
@@ -140,10 +134,9 @@ public class LdapSettingsManagerTest {
/**
* Test what happens when no configuration is set.
* Normally there will be a contextFactory, but the autodiscovery doesn't work for the test server.
- * @throws Exception
*/
@Test
- public void testEmptySettings() throws Exception {
+ public void testEmptySettings() {
LdapSettingsManager settingsManager = new LdapSettingsManager(
new MapSettings(), new LdapAutodiscovery());
diff --git a/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapUsersProviderTest.java b/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapUsersProviderTest.java
index 90e61e59fea..ff2c503a044 100644
--- a/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapUsersProviderTest.java
+++ b/server/sonar-auth-ldap/src/test/java/org/sonar/auth/ldap/LdapUsersProviderTest.java
@@ -43,7 +43,7 @@ public class LdapUsersProviderTest {
public static LdapServer infosupportServer = new LdapServer(USERS_INFOSUPPORT_COM_LDIF, "infosupport.com", "dc=infosupport,dc=com");
@Test
- public void test() throws Exception {
+ public void test() {
Settings settings = LdapSettingsFactory.generateSimpleAnonymousAccessSettings(exampleServer, infosupportServer);
LdapSettingsManager settingsManager = new LdapSettingsManager(settings, new LdapAutodiscovery());
LdapUsersProvider usersProvider = new LdapUsersProvider(settingsManager.getContextFactories(), settingsManager.getUserMappings());
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/CloseIssuesOnRemovedComponentsVisitor.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/CloseIssuesOnRemovedComponentsVisitor.java
index 4a091871d84..f21fa89ed5a 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/CloseIssuesOnRemovedComponentsVisitor.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/CloseIssuesOnRemovedComponentsVisitor.java
@@ -54,8 +54,7 @@ public class CloseIssuesOnRemovedComponentsVisitor extends TypeAwareVisitorAdapt
}
private void closeIssuesForDeletedComponentUuids(Set<String> deletedComponentUuids) {
- DiskCache<DefaultIssue>.DiskAppender cacheAppender = issueCache.newAppender();
- try {
+ try (DiskCache<DefaultIssue>.DiskAppender cacheAppender = issueCache.newAppender()) {
for (String deletedComponentUuid : deletedComponentUuids) {
List<DefaultIssue> issues = issuesLoader.loadOpenIssues(deletedComponentUuid);
for (DefaultIssue issue : issues) {
@@ -66,8 +65,6 @@ public class CloseIssuesOnRemovedComponentsVisitor extends TypeAwareVisitorAdapt
cacheAppender.append(issue);
}
}
- } finally {
- cacheAppender.close();
}
}
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java
index df7a4865df5..1a540c7eb3c 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/ComponentIssuesLoader.java
@@ -196,7 +196,7 @@ public class ComponentIssuesLoader {
i.addComment(c.toComment());
break;
default:
- throw new IllegalStateException("Unknow change type: " + c.getChangeType());
+ throw new IllegalStateException("Unknown change type: " + c.getChangeType());
}
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueCounter.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueCounter.java
index cbb25a73897..de736bb91d4 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueCounter.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueCounter.java
@@ -200,7 +200,7 @@ public class IssueCounter extends IssueVisitor {
if (!periodHolder.hasPeriod() && !analysisMetadataHolder.isPullRequest()) {
return;
}
- double unresolvedVariations = (double) currentCounters.counterForPeriod().unresolved;
+ double unresolvedVariations = currentCounters.counterForPeriod().unresolved;
measureRepository.add(component, metricRepository.getByKey(NEW_VIOLATIONS_KEY), Measure.newMeasureBuilder()
.setVariation(unresolvedVariations)
.createNoValue());
@@ -211,7 +211,7 @@ public class IssueCounter extends IssueVisitor {
Multiset<String> bag = currentCounters.counterForPeriod().severityBag;
Metric metric = metricRepository.getByKey(metricKey);
measureRepository.add(component, metric, Measure.newMeasureBuilder()
- .setVariation((double) bag.count(severity))
+ .setVariation(bag.count(severity))
.createNoValue());
}
@@ -223,7 +223,7 @@ public class IssueCounter extends IssueVisitor {
Multiset<RuleType> bag = currentCounters.counterForPeriod().typeBag;
Metric metric = metricRepository.getByKey(metricKey);
measureRepository.add(component, metric, Measure.newMeasureBuilder()
- .setVariation((double) bag.count(type))
+ .setVariation(bag.count(type))
.createNoValue());
}
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueLifecycle.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueLifecycle.java
index 61cf97bc13f..98aaf4f56a2 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueLifecycle.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueLifecycle.java
@@ -31,7 +31,6 @@ import org.sonar.core.issue.DefaultIssueComment;
import org.sonar.core.issue.FieldDiffs;
import org.sonar.core.issue.IssueChangeContext;
import org.sonar.core.util.Uuids;
-import org.sonar.db.component.KeyType;
import org.sonar.server.issue.IssueFieldsSetter;
import org.sonar.server.issue.workflow.IssueWorkflow;
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/LiveMeasureDtoToMeasure.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/LiveMeasureDtoToMeasure.java
index 3e5b684d24f..7d58909ad26 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/LiveMeasureDtoToMeasure.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/LiveMeasureDtoToMeasure.java
@@ -77,7 +77,7 @@ public class LiveMeasureDtoToMeasure {
}
return of(setCommonProperties(Measure.newMeasureBuilder(), measureDto)
- .create(value.doubleValue(), org.sonar.api.measures.Metric.MAX_DECIMAL_SCALE, data));
+ .create(value, org.sonar.api.measures.Metric.MAX_DECIMAL_SCALE, data));
}
private static Optional<Measure> toBooleanMeasure(LiveMeasureDto measureDto, @Nullable Double value, @Nullable String data) {
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java
index 96f9530be16..673708246a2 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java
@@ -458,7 +458,7 @@ public interface Measure {
}
public Measure create(int value, @Nullable String data) {
- return createInternal(ValueType.INT, (double) value, data);
+ return createInternal(ValueType.INT, value, data);
}
public Measure create(int value) {
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureDtoToMeasure.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureDtoToMeasure.java
index 7a634d4fdec..5e5c370a9b1 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureDtoToMeasure.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureDtoToMeasure.java
@@ -77,7 +77,7 @@ public class MeasureDtoToMeasure {
}
return of(setCommonProperties(Measure.newMeasureBuilder(), measureDto)
- .create(value.doubleValue(), org.sonar.api.measures.Metric.MAX_DECIMAL_SCALE, data));
+ .create(value, org.sonar.api.measures.Metric.MAX_DECIMAL_SCALE, data));
}
private static Optional<Measure> toBooleanMeasure(MeasureDto measureDto, @Nullable Double value, String data) {
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImpl.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImpl.java
index ced2f5d0d73..769213feeb1 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImpl.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryImpl.java
@@ -48,13 +48,10 @@ public class MetricRepositoryImpl implements MetricRepository, Startable {
@Override
public void start() {
- DbSession dbSession = dbClient.openSession(false);
- try {
+ try (DbSession dbSession = dbClient.openSession(false)) {
List<MetricDto> metricList = dbClient.metricDao().selectEnabled(dbSession);
this.metricsByKey = from(metricList).transform(MetricDtoToMetric.INSTANCE).uniqueIndex(MetricToKey.INSTANCE);
this.metricsById = from(metricList).transform(MetricDtoToMetric.INSTANCE).uniqueIndex(MetricToId.INSTANCE);
- } finally {
- dbSession.close();
}
}
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/notification/ReportAnalysisFailureNotificationEmailTemplate.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/notification/ReportAnalysisFailureNotificationEmailTemplate.java
index 280fdd3fd11..74374ac54a9 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/notification/ReportAnalysisFailureNotificationEmailTemplate.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/notification/ReportAnalysisFailureNotificationEmailTemplate.java
@@ -27,6 +27,7 @@ import org.sonar.api.notifications.Notification;
import org.sonar.server.issue.notification.EmailMessage;
import org.sonar.server.issue.notification.EmailTemplate;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.sonar.api.utils.DateUtils.formatDateTime;
public class ReportAnalysisFailureNotificationEmailTemplate implements EmailTemplate {
@@ -94,7 +95,7 @@ public class ReportAnalysisFailureNotificationEmailTemplate implements EmailTemp
private static String encode(String toEncode) {
try {
- return URLEncoder.encode(toEncode, "UTF-8");
+ return URLEncoder.encode(toEncode, UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("Encoding not supported", e);
}
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutorTest.java
index b86b8a8ca3b..289db4cc0ac 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutorTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/api/posttask/PostProjectAnalysisTasksExecutorTest.java
@@ -109,7 +109,7 @@ public class PostProjectAnalysisTasksExecutorTest {
new PostProjectAnalysisTask[] {postProjectAnalysisTask});
@Before
- public void setUp() throws Exception {
+ public void setUp() {
qualityGateHolder.setQualityGate(new QualityGate(QUALITY_GATE_ID, QUALITY_GATE_NAME, of(CONDITION_1, CONDITION_2)));
qualityGateStatusHolder.setStatus(QualityGateStatus.OK, ImmutableMap.of(
CONDITION_1, ConditionStatus.create(ConditionStatus.EvaluationStatus.OK, "value"),
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/component/CrawlerDepthLimitTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/component/CrawlerDepthLimitTest.java
index 2d76be70a4b..fa3a1335cb1 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/component/CrawlerDepthLimitTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/component/CrawlerDepthLimitTest.java
@@ -20,13 +20,13 @@
package org.sonar.ce.task.projectanalysis.component;
import com.google.common.base.Function;
-import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableSet;
import com.tngtech.java.junit.dataprovider.DataProvider;
import com.tngtech.java.junit.dataprovider.DataProviderRunner;
import com.tngtech.java.junit.dataprovider.UseDataProvider;
import java.util.Arrays;
import java.util.Set;
+import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.junit.Rule;
import org.junit.Test;
@@ -43,18 +43,8 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith(DataProviderRunner.class)
public class CrawlerDepthLimitTest {
- private static final Set<Type> REPORT_TYPES = from(asList(Type.values())).filter(new Predicate<Type>() {
- @Override
- public boolean apply(Type input) {
- return input.isReportType();
- }
- }).toSet();
- private static final Set<Type> VIEWS_TYPES = from(asList(Type.values())).filter(new Predicate<Type>() {
- @Override
- public boolean apply(Type input) {
- return input.isViewsType();
- }
- }).toSet();
+ private static final Set<Type> REPORT_TYPES = Arrays.stream(Type.values()).filter(Type::isReportType).collect(Collectors.toSet());
+ private static final Set<Type> VIEWS_TYPES = Arrays.stream(Type.values()).filter(Type::isViewsType).collect(Collectors.toSet());
@Rule
public ExpectedException expectedException = ExpectedException.none();
@@ -258,7 +248,7 @@ public class CrawlerDepthLimitTest {
for (Type type : types) {
assertThat(depthLimit.isHigherThan(type)).as("isHigherThan(%s)", type).isTrue();
}
- for (Type reportType : from(REPORT_TYPES).filter(not(in(Arrays.asList(types))))) {
+ for (Type reportType : from(REPORT_TYPES).filter(not(in(asList(types))))) {
assertThat(depthLimit.isHigherThan(reportType)).as("isHigherThan(%s)", reportType).isFalse();
}
}
@@ -267,7 +257,7 @@ public class CrawlerDepthLimitTest {
for (Type type : types) {
assertThat(depthLimit.isHigherThan(type)).as("isHigherThan(%s)", type).isTrue();
}
- for (Type reportType : from(VIEWS_TYPES).filter(not(in(Arrays.asList(types))))) {
+ for (Type reportType : from(VIEWS_TYPES).filter(not(in(asList(types))))) {
assertThat(depthLimit.isHigherThan(reportType)).as("isHigherThan(%s)", reportType).isFalse();
}
}
@@ -276,7 +266,7 @@ public class CrawlerDepthLimitTest {
for (Type type : types) {
assertThat(depthLimit.isDeeperThan(type)).as("isDeeperThan(%s)", type).isTrue();
}
- for (Type reportType : from(REPORT_TYPES).filter(not(in(Arrays.asList(types))))) {
+ for (Type reportType : from(REPORT_TYPES).filter(not(in(asList(types))))) {
assertThat(depthLimit.isDeeperThan(reportType)).as("isDeeperThan(%s)", reportType).isFalse();
}
}
@@ -285,7 +275,7 @@ public class CrawlerDepthLimitTest {
for (Type type : types) {
assertThat(depthLimit.isDeeperThan(type)).as("isDeeperThan(%s)", type).isTrue();
}
- for (Type reportType : from(VIEWS_TYPES).filter(not(in(Arrays.asList(types))))) {
+ for (Type reportType : from(VIEWS_TYPES).filter(not(in(asList(types))))) {
assertThat(depthLimit.isDeeperThan(reportType)).as("isDeeperThan(%s)", reportType).isFalse();
}
}
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImplTest.java
index 63d6cd19a90..26b54e507c9 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImplTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/filemove/ScoreMatrixDumperImplTest.java
@@ -64,7 +64,7 @@ public class ScoreMatrixDumperImplTest {
}
@Before
- public void setUp() throws Exception {
+ public void setUp() {
FileUtils.listFiles(tempDir.toFile(), new AbstractFileFilter() {
@Override
public boolean accept(File file) {
@@ -119,7 +119,7 @@ public class ScoreMatrixDumperImplTest {
};
}
- private static Collection<File> listDumpFilesForTaskUuid(String taskUuid) throws IOException {
+ private static Collection<File> listDumpFilesForTaskUuid(String taskUuid) {
return FileUtils.listFiles(tempDir.toFile(), new AbstractFileFilter() {
@Override
public boolean accept(File file) {
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/AverageFormulaExecutionTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/AverageFormulaExecutionTest.java
index c5b14a98b1b..5a702e672f2 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/AverageFormulaExecutionTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/AverageFormulaExecutionTest.java
@@ -57,10 +57,10 @@ public class AverageFormulaExecutionTest {
@Rule
public PeriodHolderRule periodsHolder = new PeriodHolderRule();
- FormulaExecutorComponentVisitor underTest;
+ private FormulaExecutorComponentVisitor underTest;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
underTest = FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
.buildFor(Lists.newArrayList(
AverageFormula.Builder.newBuilder()
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/ReportFormulaExecutorComponentVisitorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/ReportFormulaExecutorComponentVisitorTest.java
index 8237e2d3fdb..188f44d830a 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/ReportFormulaExecutorComponentVisitorTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/ReportFormulaExecutorComponentVisitorTest.java
@@ -315,7 +315,7 @@ public class ReportFormulaExecutorComponentVisitorTest {
}
}
- private class FakeCounter implements Counter<FakeCounter> {
+ private static class FakeCounter implements Counter<FakeCounter> {
private int value = 0;
@Override
@@ -364,7 +364,7 @@ public class ReportFormulaExecutorComponentVisitorTest {
}
}
- private class FakeVariationCounter implements Counter<FakeVariationCounter> {
+ private static class FakeVariationCounter implements Counter<FakeVariationCounter> {
private final IntValue values = new IntValue();
@Override
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/SumFormulaExecutionTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/SumFormulaExecutionTest.java
index cdaec5e99d6..d631cef2706 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/SumFormulaExecutionTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/formula/SumFormulaExecutionTest.java
@@ -53,7 +53,7 @@ public class SumFormulaExecutionTest {
FormulaExecutorComponentVisitor underTest;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
underTest = FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
.buildFor(Lists.newArrayList(createIntSumFormula(LINES_KEY)));
}
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java
index 24b8edf5bd7..7e4414feb13 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java
@@ -152,7 +152,6 @@ public class IntegrateIssuesVisitorTest {
tracker = new TrackerExecution(baseInputFactory, rawInputFactory, closedIssuesInputFactory, new Tracker<>(), issuesLoader, analysisMetadataHolder);
prBranchTracker = new PullRequestTrackerExecution(baseInputFactory, rawInputFactory, new Tracker<>(), newLinesRepository);
mergeBranchTracker = new ReferenceBranchTrackerExecution(rawInputFactory, mergeInputFactory, new Tracker<>());
-
trackingDelegator = new IssueTrackingDelegator(prBranchTracker, mergeBranchTracker, tracker, analysisMetadataHolder);
treeRootHolder.setRoot(PROJECT);
issueCache = new IssueCache(temp.newFile(), System2.INSTANCE);
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssuesRepositoryVisitorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssuesRepositoryVisitorTest.java
index d1e51f4281b..d9821109256 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssuesRepositoryVisitorTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/IssuesRepositoryVisitorTest.java
@@ -57,7 +57,7 @@ public class IssuesRepositoryVisitorTest {
IssuesRepositoryVisitor underTest = new IssuesRepositoryVisitor(componentIssuesRepository);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
treeRootHolder.setRoot(PROJECT);
}
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/MovedIssueVisitorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/MovedIssueVisitorTest.java
index 386bf4a2231..3456a7a33b4 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/MovedIssueVisitorTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/MovedIssueVisitorTest.java
@@ -60,7 +60,7 @@ public class MovedIssueVisitorTest {
private MovedIssueVisitor underTest = new MovedIssueVisitor(analysisMetadataHolder, movedFilesRepository, new IssueFieldsSetter());
@Before
- public void setUp() throws Exception {
+ public void setUp() {
analysisMetadataHolder.setAnalysisDate(ANALYSIS_DATE);
when(movedFilesRepository.getOriginalFile(any(Component.class)))
.thenReturn(Optional.absent());
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecutionTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecutionTest.java
index f7a7fe26fb0..aa7816f7e22 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecutionTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/PullRequestTrackerExecutionTest.java
@@ -66,7 +66,7 @@ public class PullRequestTrackerExecutionTest {
private List<DefaultIssue> baseIssues = new ArrayList<>();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(rawFactory.create(FILE)).thenReturn(createInput(rawIssues));
when(baseFactory.create(FILE)).thenReturn(createInput(baseIssues));
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/RuleRepositoryImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/RuleRepositoryImplTest.java
index 6f694130957..c9a46a270f5 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/RuleRepositoryImplTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/RuleRepositoryImplTest.java
@@ -81,7 +81,7 @@ public class RuleRepositoryImplTest {
private RuleRepositoryImpl underTest = new RuleRepositoryImpl(adHocRuleCreator, dbClient, analysisMetadataHolder);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(dbClient.openSession(anyBoolean())).thenReturn(dbSession);
when(dbClient.ruleDao()).thenReturn(ruleDao);
when(ruleDao.selectAll(any(DbSession.class), eq(ORGANIZATION_UUID))).thenReturn(ImmutableList.of(AB_RULE));
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/RuleRepositoryRule.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/RuleRepositoryRule.java
index 1393647e054..fbcd53dd11e 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/RuleRepositoryRule.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/RuleRepositoryRule.java
@@ -81,7 +81,7 @@ public class RuleRepositoryRule extends ExternalResource implements RuleReposito
public RuleRepositoryRule add(DumbRule rule) {
rulesByKey.put(requireNonNull(rule.getKey()), rule);
- rulesById.put(requireNonNull(rule.getId()), rule);
+ rulesById.put(rule.getId(), rule);
return this;
}
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/TrackerBaseInputFactoryTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/TrackerBaseInputFactoryTest.java
index f9562921b33..ae446e9fc73 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/TrackerBaseInputFactoryTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/issue/TrackerBaseInputFactoryTest.java
@@ -61,7 +61,7 @@ public class TrackerBaseInputFactoryTest {
new IssueFieldsSetter(), mock(ComponentsWithUnprocessedIssues.class));
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(dbClient.openSession(false)).thenReturn(dbSession);
when(dbClient.fileSourceDao()).thenReturn(fileSourceDao);
when(movedFilesRepository.getOriginalFile(any(Component.class)))
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/BestValueOptimizationTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/BestValueOptimizationTest.java
index f6883521632..3e18e0c5b01 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/BestValueOptimizationTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/BestValueOptimizationTest.java
@@ -146,9 +146,9 @@ public class BestValueOptimizationTest {
Predicate<Measure> underTest = BestValueOptimization.from(createMetric(Metric.MetricType.RATING, A.getIndex()), FILE_COMPONENT);
assertThat(underTest.test(newMeasureBuilder().create(A.getIndex()))).isTrue();
- assertThat(underTest.test(newMeasureBuilder().setVariation((double) A.getIndex()).createNoValue())).isTrue();
+ assertThat(underTest.test(newMeasureBuilder().setVariation(A.getIndex()).createNoValue())).isTrue();
assertThat(underTest.test(newMeasureBuilder().create(B.getIndex()))).isFalse();
- assertThat(underTest.test(newMeasureBuilder().setVariation((double) B.getIndex()).createNoValue())).isFalse();
+ assertThat(underTest.test(newMeasureBuilder().setVariation(B.getIndex()).createNoValue())).isFalse();
}
@Test
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImplTest.java
index 68253569a7d..e74bc2ecd06 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImplTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureRepositoryImplTest.java
@@ -20,7 +20,6 @@
package org.sonar.ce.task.projectanalysis.measure;
import com.google.common.base.Function;
-import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.tngtech.java.junit.dataprovider.DataProvider;
import com.tngtech.java.junit.dataprovider.DataProviderRunner;
@@ -277,12 +276,7 @@ public class MeasureRepositoryImplTest {
}
private Measure getSomeMeasureByValueType(final Metric.MetricType metricType) {
- return from(MEASURES).filter(new Predicate<Measure>() {
- @Override
- public boolean apply(@Nullable Measure input) {
- return input.getValueType() == metricType.getValueType();
- }
- }).first().get();
+ return from(MEASURES).filter(input -> input.getValueType() == metricType.getValueType()).first().get();
}
@Test
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureTest.java
index d5e0aa80076..d8cfe10b77f 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureTest.java
@@ -218,7 +218,7 @@ public class MeasureTest {
assertThat(newMeasureBuilder().setQualityGateStatus(someStatus).create(false, null).getQualityGateStatus()).isEqualTo(someStatus);
assertThat(newMeasureBuilder().setQualityGateStatus(someStatus).create(1, null).getQualityGateStatus()).isEqualTo(someStatus);
assertThat(newMeasureBuilder().setQualityGateStatus(someStatus).create((long) 1, null).getQualityGateStatus()).isEqualTo(someStatus);
- assertThat(newMeasureBuilder().setQualityGateStatus(someStatus).create((double) 1, 1, null).getQualityGateStatus()).isEqualTo(someStatus);
+ assertThat(newMeasureBuilder().setQualityGateStatus(someStatus).create(1, 1, null).getQualityGateStatus()).isEqualTo(someStatus);
assertThat(newMeasureBuilder().setQualityGateStatus(someStatus).create("str").getQualityGateStatus()).isEqualTo(someStatus);
assertThat(newMeasureBuilder().setQualityGateStatus(someStatus).create(Measure.Level.OK).getQualityGateStatus()).isEqualTo(someStatus);
}
@@ -263,7 +263,7 @@ public class MeasureTest {
assertThat(newMeasureBuilder().create(false, someData).getData()).isEqualTo(someData);
assertThat(newMeasureBuilder().create(1, someData).getData()).isEqualTo(someData);
assertThat(newMeasureBuilder().create((long) 1, someData).getData()).isEqualTo(someData);
- assertThat(newMeasureBuilder().create((double) 1, 1, someData).getData()).isEqualTo(someData);
+ assertThat(newMeasureBuilder().create(1, 1, someData).getData()).isEqualTo(someData);
}
@Test
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureToMeasureDtoTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureToMeasureDtoTest.java
index 1301088a749..24458d15aa4 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureToMeasureDtoTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureToMeasureDtoTest.java
@@ -61,7 +61,7 @@ public class MeasureToMeasureDtoTest {
private MeasureToMeasureDto underTest = new MeasureToMeasureDto(analysisMetadataHolder, treeRootHolder);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
analysisMetadataHolder.setUuid(ANALYSIS_UUID);
}
@@ -81,7 +81,7 @@ public class MeasureToMeasureDtoTest {
{Measure.newMeasureBuilder().create(true, SOME_DATA), SOME_BOOLEAN_METRIC},
{Measure.newMeasureBuilder().create(1, SOME_DATA), SOME_INT_METRIC},
{Measure.newMeasureBuilder().create((long) 1, SOME_DATA), SOME_LONG_METRIC},
- {Measure.newMeasureBuilder().create((double) 2, 1, SOME_DATA), SOME_DOUBLE_METRIC},
+ {Measure.newMeasureBuilder().create(2, 1, SOME_DATA), SOME_DOUBLE_METRIC},
{Measure.newMeasureBuilder().create(SOME_STRING), SOME_STRING_METRIC},
{Measure.newMeasureBuilder().create(Measure.Level.OK), SOME_LEVEL_METRIC}
};
@@ -160,7 +160,7 @@ public class MeasureToMeasureDtoTest {
@Test
public void toMeasureDto_maps_value_and_data_from_data_field_for_DOUBLE_metric() {
- MeasureDto trueMeasureDto = underTest.toMeasureDto(Measure.newMeasureBuilder().create((double) 789, 1, SOME_DATA), SOME_DOUBLE_METRIC, SOME_COMPONENT);
+ MeasureDto trueMeasureDto = underTest.toMeasureDto(Measure.newMeasureBuilder().create(789, 1, SOME_DATA), SOME_DOUBLE_METRIC, SOME_COMPONENT);
assertThat(trueMeasureDto.getValue()).isEqualTo(789);
assertThat(trueMeasureDto.getData()).isEqualTo(SOME_DATA);
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitygate/QualityGateServiceImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitygate/QualityGateServiceImplTest.java
index 0dc856ed72b..587254a4c41 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitygate/QualityGateServiceImplTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitygate/QualityGateServiceImplTest.java
@@ -60,7 +60,7 @@ public class QualityGateServiceImplTest {
private QualityGateServiceImpl underTest = new QualityGateServiceImpl(dbClient, metricRepository);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(dbClient.qualityGateDao()).thenReturn(qualityGateDao);
when(dbClient.gateConditionDao()).thenReturn(qualityGateConditionDao);
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitorTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitorTest.java
index 1931072d0aa..1d5258eb770 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitorTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitorTest.java
@@ -92,7 +92,7 @@ public class NewMaintainabilityMeasuresVisitorTest {
private VisitorsCrawler underTest;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(ratingSettings.getDebtRatingGrid()).thenReturn(new DebtRatingGrid(RATING_GRID));
underTest = new VisitorsCrawler(Arrays.asList(new NewMaintainabilityMeasuresVisitor(metricRepository, measureRepository, newLinesRepository, ratingSettings)));
}
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoDbLoaderTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoDbLoaderTest.java
index a0418e92b89..be723bb6a2f 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoDbLoaderTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoDbLoaderTest.java
@@ -43,7 +43,6 @@ import org.sonar.db.source.FileSourceDto;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.sonar.api.utils.log.LoggerLevel.TRACE;
import static org.sonar.ce.task.projectanalysis.component.ReportComponent.builder;
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoRepositoryRule.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoRepositoryRule.java
index 756c5c25975..a61a4610ccc 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoRepositoryRule.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/scm/ScmInfoRepositoryRule.java
@@ -49,7 +49,7 @@ public class ScmInfoRepositoryRule extends ExternalResource implements ScmInfoRe
}
public ScmInfoRepositoryRule setScmInfo(int fileRef, Map<Integer, Changeset> changesets) {
- scmInfoByFileRef.put(fileRef, new ScmInfoImpl(changesets.values().stream().toArray(Changeset[]::new)));
+ scmInfoByFileRef.put(fileRef, new ScmInfoImpl(changesets.values().toArray(new Changeset[0])));
return this;
}
}
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesDiffImplTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesDiffImplTest.java
index 238d9759ef4..f49a78727ef 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesDiffImplTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/source/SourceLinesDiffImplTest.java
@@ -62,7 +62,7 @@ public class SourceLinesDiffImplTest {
};
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(dbClient.openSession(false)).thenReturn(dbSession);
when(dbClient.componentDao()).thenReturn(componentDao);
when(dbClient.fileSourceDao()).thenReturn(fileSourceDao);
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/DbMigrationsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/DbMigrationsStepTest.java
index aeaf7580cb0..41d87e78205 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/DbMigrationsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/DbMigrationsStepTest.java
@@ -52,7 +52,7 @@ public class DbMigrationsStepTest {
ProjectAnalysisDataChange[] dataChanges = IntStream.range(0, 5 + new Random().nextInt(5))
.mapToObj(i -> mock(ProjectAnalysisDataChange.class))
.toArray(ProjectAnalysisDataChange[]::new);
- InOrder inOrder = Mockito.inOrder((Object[]) dataChanges);
+ InOrder inOrder = Mockito.inOrder(dataChanges);
when(projectAnalysisDataChanges.getDataChanges()).thenReturn(Arrays.asList(dataChanges));
underTest.execute(new TestComputationStepContext());
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ExecuteVisitorsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ExecuteVisitorsStepTest.java
index a7e92cc0664..0683436fddc 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ExecuteVisitorsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ExecuteVisitorsStepTest.java
@@ -207,7 +207,7 @@ public class ExecuteVisitorsStepTest {
}
}
- public class Counter {
+ public static class Counter {
private int value = 0;
public void add(int value) {
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStepTest.java
index 67406258bd1..4870c3bc825 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStepTest.java
@@ -103,7 +103,7 @@ public class LoadCrossProjectDuplicationsRepositoryStepTest {
integrateCrossProjectDuplications, dbClient);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
ComponentDto project = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert());
dbClient.componentDao().insert(dbSession, project);
SnapshotDto projectSnapshot = SnapshotTesting.newAnalysis(project);
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java
index 01966886f92..47f9b6bf042 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java
@@ -101,7 +101,7 @@ public class LoadPeriodsStepTest extends BaseStepTest {
}
@Before
- public void setUp() throws Exception {
+ public void setUp() {
organization = dbTester.organizations().insert();
project = dbTester.components().insertMainBranch(organization);
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java
index 3dca5219162..ef827047fcb 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java
@@ -84,7 +84,7 @@ public class PersistCrossProjectDuplicationIndexStepTest {
private ComputationStep underTest;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(baseAnalysis.getUuid()).thenReturn(BASE_ANALYSIS_UUID);
analysisMetadataHolder.setUuid(ANALYSIS_UUID);
analysisMetadataHolder.setBaseAnalysis(baseAnalysis);
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java
index 987c834ad91..b7f36b3bc26 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/PersistDuplicationDataStepTest.java
@@ -79,7 +79,7 @@ public class PersistDuplicationDataStepTest extends BaseStepTest {
public MetricRepositoryRule metricRepository = new MetricRepositoryRule();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MetricDto metric = db.measures().insertMetric(m -> m.setKey(DUPLICATIONS_DATA_KEY).setValueType(Metric.ValueType.STRING.name()));
insertComponent(PROJECT_KEY, PROJECT_UUID);
insertComponent(FILE_1_KEY, FILE_1_UUID);
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCommentMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCommentMeasuresStepTest.java
index fbcd8650fa2..e49b8231f13 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCommentMeasuresStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCommentMeasuresStepTest.java
@@ -72,7 +72,7 @@ public class ReportCommentMeasuresStepTest {
ComputationStep underTest = new CommentMeasuresStep(treeRootHolder, metricRepository, measureRepository);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
treeRootHolder.setRoot(
builder(PROJECT, ROOT_REF)
.addChildren(
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCoverageMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCoverageMeasuresStepTest.java
index 052e07e1277..a1c07268841 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCoverageMeasuresStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportCoverageMeasuresStepTest.java
@@ -75,7 +75,7 @@ public class ReportCoverageMeasuresStepTest {
CoverageMeasuresStep underTest = new CoverageMeasuresStep(treeRootHolder, metricRepository, measureRepository, reportReader);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
treeRootHolder.setRoot(
builder(PROJECT, ROOT_REF)
.addChildren(
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportLanguageDistributionMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportLanguageDistributionMeasuresStepTest.java
index 6bfcc3f31ae..2f92cbe943c 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportLanguageDistributionMeasuresStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportLanguageDistributionMeasuresStepTest.java
@@ -66,7 +66,7 @@ public class ReportLanguageDistributionMeasuresStepTest {
ComputationStep underTest = new LanguageDistributionMeasuresStep(treeRootHolder, metricRepository, measureRepository);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
treeRootHolder.setRoot(
builder(PROJECT, ROOT_REF)
.addChildren(
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java
index e3171b9a66a..89c23047b41 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ReportPersistComponentsStepTest.java
@@ -87,7 +87,6 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
private Date now;
private MutableDisabledComponentsHolder disabledComponentsHolder = mock(MutableDisabledComponentsHolder.class, RETURNS_DEEP_STUBS);
private PersistComponentsStep underTest;
- private BranchPersister branchPersister;
@Before
public void setup() throws Exception {
@@ -95,7 +94,7 @@ public class ReportPersistComponentsStepTest extends BaseStepTest {
when(system2.now()).thenReturn(now.getTime());
db.organizations().insertForUuid(ORGANIZATION_UUID);
- branchPersister = mock(BranchPersister.class);
+ BranchPersister branchPersister = mock(BranchPersister.class);
underTest = new PersistComponentsStep(dbClient, treeRootHolder, dbIdsRepository, system2, disabledComponentsHolder, analysisMetadataHolder, branchPersister);
}
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCommentMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCommentMeasuresStepTest.java
index 222b367b2c3..11f0f2a102a 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCommentMeasuresStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCommentMeasuresStepTest.java
@@ -74,7 +74,7 @@ public class ViewsCommentMeasuresStepTest {
ComputationStep underTest = new CommentMeasuresStep(treeRootHolder, metricRepository, measureRepository);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
treeRootHolder.setRoot(
builder(VIEW, ROOT_REF)
.addChildren(
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCoverageMeasuresStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCoverageMeasuresStepTest.java
index 5c2ef23cb4e..f704e8464cc 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCoverageMeasuresStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsCoverageMeasuresStepTest.java
@@ -65,7 +65,7 @@ public class ViewsCoverageMeasuresStepTest {
CoverageMeasuresStep underTest = new CoverageMeasuresStep(treeRootHolder, metricRepository, measureRepository);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
treeRootHolder.setRoot(
builder(VIEW, ROOT_REF)
.addChildren(
diff --git a/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java b/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java
index 1858d25a7f7..04d3d1b36bc 100644
--- a/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java
+++ b/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java
@@ -117,7 +117,6 @@ public class AnalysisMetadataHolderRule extends ExternalResource implements Muta
@Override
public AnalysisMetadataHolderRule setAnalysisDate(long date) {
- checkNotNull(date, "Date must not be null");
this.analysisDate.setProperty(date);
return this;
}
diff --git a/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryRule.java b/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryRule.java
index 7f781ff34b0..9d3f601703f 100644
--- a/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryRule.java
+++ b/server/sonar-ce-task-projectanalysis/src/testFixtures/java/org/sonar/ce/task/projectanalysis/metric/MetricRepositoryRule.java
@@ -73,7 +73,6 @@ public class MetricRepositoryRule extends ExternalResource implements MetricRepo
public MetricRepositoryRule add(Metric metric) {
requireNonNull(metric.getKey(), "key can not be null");
- requireNonNull(metric.getId(), "id can not be null");
checkState(!metricsByKey.containsKey(metric.getKey()), format("Repository already contains a metric for key %s", metric.getKey()));
checkState(!metricsById.containsKey((long) metric.getId()), format("Repository already contains a metric for id %s", metric.getId()));
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeTaskProcessorRepositoryImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeTaskProcessorRepositoryImpl.java
index f17cbf65d9e..d1bc0882f79 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeTaskProcessorRepositoryImpl.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeTaskProcessorRepositoryImpl.java
@@ -19,21 +19,18 @@
*/
package org.sonar.ce.taskprocessor;
-import com.google.common.base.Function;
-import com.google.common.base.Joiner;
import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import java.util.Collection;
import java.util.Map;
import java.util.Optional;
+import java.util.function.Function;
+import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.sonar.ce.task.CeTask;
import org.sonar.ce.task.taskprocessor.CeTaskProcessor;
import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.collect.FluentIterable.from;
import static java.lang.String.CASE_INSENSITIVE_ORDER;
import static java.lang.String.format;
@@ -42,8 +39,6 @@ import static java.lang.String.format;
* PicoContainer the current object belongs to.
*/
public class CeTaskProcessorRepositoryImpl implements CeTaskProcessorRepository {
- private static final Joiner COMMA_JOINER = Joiner.on(", ");
-
private final Map<String, CeTaskProcessor> taskProcessorByCeTaskType;
public CeTaskProcessorRepositoryImpl(CeTaskProcessor[] taskProcessors) {
@@ -58,7 +53,7 @@ public class CeTaskProcessorRepositoryImpl implements CeTaskProcessorRepository
private static Map<String, CeTaskProcessor> indexTaskProcessors(CeTaskProcessor[] taskProcessors) {
Multimap<String, CeTaskProcessor> permissiveIndex = buildPermissiveCeTaskProcessorIndex(taskProcessors);
checkUniqueHandlerPerCeTaskType(permissiveIndex);
- return ImmutableMap.copyOf(Maps.transformValues(permissiveIndex.asMap(), CeTaskProcessorCollectionToFirstElement.INSTANCE));
+ return permissiveIndex.asMap().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, y -> CeTaskProcessorCollectionToFirstElement.INSTANCE.apply(y.getValue())));
}
private static Multimap<String, CeTaskProcessor> buildPermissiveCeTaskProcessorIndex(CeTaskProcessor[] taskProcessors) {
@@ -79,7 +74,7 @@ public class CeTaskProcessorRepositoryImpl implements CeTaskProcessorRepository
"There can be only one CeTaskProcessor instance registered as the processor for CeTask type %s. " +
"More than one found. Please fix your configuration: %s",
entry.getKey(),
- COMMA_JOINER.join(from(entry.getValue()).transform(ToClassName.INSTANCE).toSortedList(CASE_INSENSITIVE_ORDER))));
+ entry.getValue().stream().map(ToClassName.INSTANCE).sorted(CASE_INSENSITIVE_ORDER).collect(Collectors.joining(", "))));
}
}
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/CeDistributedInformationImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/CeDistributedInformationImplTest.java
index 38d50609779..e5ac953aeb5 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/CeDistributedInformationImplTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/CeDistributedInformationImplTest.java
@@ -104,8 +104,7 @@ public class CeDistributedInformationImplTest {
connectedClients.add(clientUUID1);
connectedClients.add(clientUUID2);
connectedClients.add(clientUUID3);
- Map modifiableWorkerMap = new HashMap();
- modifiableWorkerMap.putAll(workerMap);
+ Map modifiableWorkerMap = new HashMap(workerMap);
when(hzClientWrapper.getUuid()).thenReturn(clientUUID1);
when(hzClientWrapper.getMemberUuids()).thenReturn(connectedClients);
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java
index ed29b66a014..7a9ff48a625 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java
@@ -89,7 +89,7 @@ public class CePluginJarExploderTest {
return new File("src/test/plugins/sonar-test2-plugin/target/sonar-test2-plugin-0.1-SNAPSHOT.jar");
}
- private class DumbFileSystem implements ServerFileSystem {
+ private static class DumbFileSystem implements ServerFileSystem {
private final TemporaryFolder temp;
private File tempDir;
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginRepositoryTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginRepositoryTest.java
index c002d288e26..3af53faea9b 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginRepositoryTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginRepositoryTest.java
@@ -19,9 +19,9 @@
*/
package org.sonar.ce.container;
-import com.google.common.collect.Maps;
import java.io.File;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Map;
import org.junit.After;
import org.junit.Rule;
@@ -144,7 +144,7 @@ public class CePluginRepositoryTest {
*/
@Override
public Map<String, Plugin> load(Map<String, PluginInfo> infoByKeys) {
- Map<String, Plugin> result = Maps.newHashMap();
+ Map<String, Plugin> result = new HashMap<>();
for (String pluginKey : infoByKeys.keySet()) {
result.put(pluginKey, mock(Plugin.class));
}
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
index d6bf03851e6..aa6aedf7c59 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
@@ -138,7 +138,7 @@ public class ComputeEngineContainerImplTest {
.map(ComponentAdapter::getComponentImplementation)
.collect(Collectors.toList())).doesNotContain(
(Class) CeDistributedInformationImpl.class).contains(
- (Class) StandaloneCeDistributedInformation.class);
+ StandaloneCeDistributedInformation.class);
assertThat(picoContainer.getParent().getParent().getParent().getParent()).isNull();
} finally {
underTest.stop();
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java
index e686c1ea019..9c4c86b2db6 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImplTest.java
@@ -281,7 +281,7 @@ public class CeProcessingSchedulerImplTest {
processingExecutorService.runFutures();
}
- private class TestCeWorkerFactory implements CeWorkerFactory {
+ private static class TestCeWorkerFactory implements CeWorkerFactory {
private final Iterator<CeWorker> ceWorkers;
private TestCeWorkerFactory(CeWorker... ceWorkers) {
diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfilingPreparedStatementHandler.java b/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfilingPreparedStatementHandler.java
index fe3f2845d8e..5b665121e8f 100644
--- a/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfilingPreparedStatementHandler.java
+++ b/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfilingPreparedStatementHandler.java
@@ -40,7 +40,7 @@ class ProfilingPreparedStatementHandler implements InvocationHandler {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getName().startsWith("execute")) {
Profiler profiler = Profiler.create(ProfiledDataSource.SQL_LOGGER).start();
- Object result = null;
+ Object result;
try {
result = InvocationUtils.invokeQuietly(statement, method, args);
} finally {
diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfilingStatementHandler.java b/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfilingStatementHandler.java
index 92b4373b311..88b2119027e 100644
--- a/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfilingStatementHandler.java
+++ b/server/sonar-db-core/src/main/java/org/sonar/db/profiling/ProfilingStatementHandler.java
@@ -36,7 +36,7 @@ class ProfilingStatementHandler implements InvocationHandler {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getName().startsWith("execute")) {
Profiler profiler = Profiler.create(ProfiledDataSource.SQL_LOGGER).start();
- Object result = null;
+ Object result;
try {
result = InvocationUtils.invokeQuietly(statement, method, args);
} finally {
diff --git a/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseUtilsTest.java b/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseUtilsTest.java
index 40ee287d0e6..3d3fe1d03f5 100644
--- a/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseUtilsTest.java
+++ b/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseUtilsTest.java
@@ -146,7 +146,7 @@ public class DatabaseUtilsTest {
public void toUniqueAndSortedList_throws_NPE_if_arg_is_a_set_containing_a_null() {
expectedException.expect(NullPointerException.class);
- toUniqueAndSortedList(new HashSet<>(asList("A", (String) null, "C")));
+ toUniqueAndSortedList(new HashSet<>(asList("A", null, "C")));
}
@Test
diff --git a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java
index 0b9bb16bc6e..4c7b2f35584 100644
--- a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java
+++ b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java
@@ -37,6 +37,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -54,8 +55,6 @@ import org.sonar.core.util.stream.MoreCollectors;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.Lists.asList;
-import static com.google.common.collect.Lists.newArrayList;
-import static com.google.common.collect.Maps.newHashMap;
import static java.sql.ResultSetMetaData.columnNoNulls;
import static java.sql.ResultSetMetaData.columnNullable;
import static org.assertj.core.api.Assertions.assertThat;
@@ -209,9 +208,9 @@ public class AbstractDbTester<T extends TestDb> extends ExternalResource {
private static List<Map<String, Object>> getHashMap(ResultSet resultSet) throws Exception {
ResultSetMetaData metaData = resultSet.getMetaData();
int colCount = metaData.getColumnCount();
- List<Map<String, Object>> rows = newArrayList();
+ List<Map<String, Object>> rows = new ArrayList<>();
while (resultSet.next()) {
- Map<String, Object> columns = newHashMap();
+ Map<String, Object> columns = new HashMap<>();
for (int i = 1; i <= colCount; i++) {
Object value = resultSet.getObject(i);
if (value instanceof Clob) {
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java
index 214dfb66006..115d1661ac0 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentKeyUpdaterDao.java
@@ -22,7 +22,6 @@ package org.sonar.db.component;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -128,7 +127,7 @@ public class ComponentKeyUpdaterDao implements Dao {
branchModules.forEach(module -> branchBaseKeys.put(module.getKey(), branchBaseKey(module.getKey())));
});
- Map<ResourceDto, List<ResourceDto>> allResourcesByModuleMap = Maps.newHashMap();
+ Map<ResourceDto, List<ResourceDto>> allResourcesByModuleMap = new HashMap<>();
for (ResourceDto module : modules) {
allResourcesByModuleMap.put(module, mapper.selectProjectResources(module.getUuid()));
}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricDao.java
index ea7584a007c..e99075f7a52 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/metric/MetricDao.java
@@ -22,9 +22,9 @@ package org.sonar.db.metric;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -68,9 +68,11 @@ public class MetricDao implements Dao {
}
public List<MetricDto> selectEnabled(DbSession session, @Nullable Boolean isCustom, int offset, int limit) {
- Map<String, Object> properties = Maps.newHashMapWithExpectedSize(1);
+ Map<String, Object> properties;
if (isCustom != null) {
- properties.put("isCustom", isCustom);
+ properties = Collections.singletonMap("isCustom", isCustom);
+ } else {
+ properties = Collections.emptyMap();
}
return mapper(session).selectAllEnabled(properties, new RowBounds(offset, limit));
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java
index 77129395c49..2b2e7d57bf3 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java
@@ -303,9 +303,9 @@ public class PropertiesDao implements Dao {
public void saveGlobalProperties(Map<String, String> properties) {
try (DbSession session = mybatis.openSession(false)) {
PropertiesMapper mapper = getMapper(session);
- properties.entrySet().forEach(entry -> {
- mapper.deleteGlobalProperty(entry.getKey());
- save(mapper, entry.getKey(), null, null, entry.getValue());
+ properties.forEach((key, value) -> {
+ mapper.deleteGlobalProperty(key);
+ save(mapper, key, null, null, value);
});
session.commit();
}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipDao.java
index c1807736483..3b735c1213b 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/user/GroupMembershipDao.java
@@ -21,10 +21,10 @@ package org.sonar.db.user;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multiset;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
@@ -56,7 +56,7 @@ public class GroupMembershipDao implements Dao {
}
public Map<String, Integer> countUsersByGroups(DbSession session, Collection<Integer> groupIds) {
- Map<String, Integer> result = Maps.newHashMap();
+ Map<String, Integer> result = new HashMap<>();
executeLargeInputs(
groupIds,
input -> {
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingDaoTest.java
index df6b6ebd527..f51a0ff4314 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/alm/ProjectAlmBindingDaoTest.java
@@ -236,7 +236,7 @@ public class ProjectAlmBindingDaoTest {
underTest.insertOrUpdate(dbSession, BITBUCKETCLOUD, ANOTHER_REPO, "foo", null, "http://foo");
assertThat(underTest.selectByRepoIds(dbSession, GITHUB, Arrays.asList(A_REPO, ANOTHER_REPO, "foo")))
- .extracting(ProjectAlmBindingDto::getUuid, t -> t.getAlm(), ProjectAlmBindingDto::getRepoId, ProjectAlmBindingDto::getProjectUuid,
+ .extracting(ProjectAlmBindingDto::getUuid, ProjectAlmBindingDto::getAlm, ProjectAlmBindingDto::getRepoId, ProjectAlmBindingDto::getProjectUuid,
ProjectAlmBindingDto::getUrl, ProjectAlmBindingDto::getGithubSlug)
.containsExactlyInAnyOrder(
tuple("uuid1", GITHUB, A_REPO, A_UUID, A_URL, A_GITHUB_SLUG),
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java
index cff43fe24cb..b6a85927a0e 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java
@@ -64,7 +64,7 @@ public class ComponentKeyUpdaterDaoTest {
dbSession.commit();
assertThat(db.select("select uuid as \"UUID\", kee as \"KEE\" from projects"))
- .extracting(t -> (String) t.get("UUID"), t -> (String) t.get("KEE"))
+ .extracting(t -> t.get("UUID"), t -> t.get("KEE"))
.containsOnly(
Tuple.tuple("A", "org.struts:struts"),
Tuple.tuple("B", "struts:core"),
@@ -278,7 +278,7 @@ public class ComponentKeyUpdaterDaoTest {
dbSession.commit();
assertThat(db.select("select uuid as \"UUID\", kee as \"KEE\" from projects"))
- .extracting(t -> (String) t.get("UUID"), t -> (String) t.get("KEE"))
+ .extracting(t -> t.get("UUID"), t -> t.get("KEE"))
.containsOnly(
Tuple.tuple("A", "org.apache.struts:struts"),
Tuple.tuple("B", "org.apache.struts:struts-core"),
@@ -298,7 +298,7 @@ public class ComponentKeyUpdaterDaoTest {
dbSession.commit();
assertThat(db.select("select uuid as \"UUID\", kee as \"KEE\" from projects"))
- .extracting(t -> (String) t.get("UUID"), t -> (String) t.get("KEE"))
+ .extracting(t -> t.get("UUID"), t -> t.get("KEE"))
.containsOnly(
Tuple.tuple("A", "org.struts:struts"),
Tuple.tuple("B", "org.struts:struts-core"),
@@ -337,7 +337,7 @@ public class ComponentKeyUpdaterDaoTest {
dbSession.commit();
assertThat(db.select("select uuid as \"UUID\", kee as \"KEE\" from projects"))
- .extracting(t -> (String) t.get("UUID"), t -> (String) t.get("KEE"))
+ .extracting(t -> t.get("UUID"), t -> t.get("KEE"))
.containsOnly(
Tuple.tuple("A", "org.apache.struts:struts"),
Tuple.tuple("B", "org.apache.struts:struts-core"),
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/dump/DumpSQSchema.java b/server/sonar-db-dao/src/test/java/org/sonar/db/dump/DumpSQSchema.java
index 49ebe22c378..cd16a5794db 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/dump/DumpSQSchema.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/dump/DumpSQSchema.java
@@ -25,6 +25,8 @@ import java.nio.charset.Charset;
import java.sql.SQLException;
import org.apache.commons.io.FileUtils;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
public class DumpSQSchema {
public static void main(String[] args) {
@@ -36,7 +38,7 @@ public class DumpSQSchema {
System.exit(1);
}
- Charset charset = Charset.forName("UTF8");
+ Charset charset = UTF_8;
String oldContent = FileUtils.readFileToString(targetFile, charset);
String newContent = dumper.dumpToText();
boolean upToDate = newContent.equals(oldContent);
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueMapperTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueMapperTest.java
index 04bd0f63e8b..413de4c4ea1 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueMapperTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueMapperTest.java
@@ -73,7 +73,7 @@ public class IssueMapperTest {
private System2 system2 = new AlwaysIncreasingSystem2();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
OrganizationDto organizationDto = dbTester.organizations().insert();
project = ComponentTesting.newPrivateProjectDto(organizationDto);
dbTester.getDbClient().componentDao().insert(dbSession, project);
@@ -458,7 +458,7 @@ public class IssueMapperTest {
ComponentDto component = randomComponent(organization);
IssueDto issue = insertNewClosedIssue(component, ruleType);
Date date = new Date();
- IssueChangeDto changes[] = new IssueChangeDto[] {
+ IssueChangeDto[] changes = new IssueChangeDto[] {
insertToClosedDiff(issue, DateUtils.addDays(date, -10)),
insertToClosedDiff(issue, DateUtils.addDays(date, -60)),
insertToClosedDiff(issue, date),
@@ -485,7 +485,7 @@ public class IssueMapperTest {
ComponentDto component = randomComponent(organization);
IssueDto issue = insertNewClosedIssue(component, ruleType);
Date date = new Date();
- IssueChangeDto changes[] = new IssueChangeDto[] {
+ IssueChangeDto[] changes = new IssueChangeDto[] {
insertToClosedDiff(issue, DateUtils.addDays(date, -10), Issue.STATUS_CLOSED, Issue.STATUS_REOPENED),
insertToClosedDiff(issue, DateUtils.addDays(date, -60)),
insertToClosedDiff(issue, date),
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java
index 464f4e8be6c..e5d2dd85496 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java
@@ -58,7 +58,7 @@ public class LiveMeasureDaoTest {
private MetricDto metric;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
metric = db.measures().insertMetric();
}
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java
index e023c37d88e..2b860045ac7 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java
@@ -77,7 +77,7 @@ public class AuthorizationDaoTest {
private String randomPermission = "p" + random.nextInt();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
organization = db.organizations().insert();
user = db.users().insertUser();
group1 = db.users().insertGroup(organization, "group1");
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java
index 8f25059396d..93964365795 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java
@@ -66,7 +66,7 @@ public class GroupPermissionDaoTest {
private String defaultOrganizationUuid;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
defaultOrganizationUuid = db.getDefaultOrganization().getUuid();
}
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoTest.java
index b78fa9cf962..0f8681d9763 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoTest.java
@@ -745,13 +745,13 @@ public class UserPermissionDaoTest {
assertThat(underTest.selectUserIdsByQuery(dbSession, query)).containsExactly(expectedUserIds.toArray(new Integer[0]));
List<UserPermissionDto> currentPermissions = underTest.selectUserPermissionsByQuery(dbSession, query, expectedUserIds);
assertThat(currentPermissions).hasSize(expectedPermissions.length);
- List<Tuple> expectedPermissionsAsTuple = Arrays.stream(expectedPermissions)
+ Tuple[] expectedPermissionsAsTuple = Arrays.stream(expectedPermissions)
.map(expectedPermission -> tuple(expectedPermission.getUserId(), expectedPermission.getPermission(), expectedPermission.getComponentId(),
expectedPermission.getOrganizationUuid()))
- .collect(Collectors.toList());
+ .toArray(Tuple[]::new);
assertThat(currentPermissions)
.extracting(UserPermissionDto::getUserId, UserPermissionDto::getPermission, UserPermissionDto::getComponentId, UserPermissionDto::getOrganizationUuid)
- .containsOnly(expectedPermissionsAsTuple.toArray(new Tuple[0]));
+ .containsOnly(expectedPermissionsAsTuple);
// test method "countUsers()"
long distinctUsers = stream(expectedPermissions).mapToLong(UserPermissionDto::getUserId).distinct().count();
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java
index 978855b5092..f29b64e4b38 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java
@@ -65,7 +65,7 @@ public class PermissionTemplateDaoTest {
private PermissionTemplateDao underTest = new PermissionTemplateDao(system2);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(system2.now()).thenReturn(NOW.getTime());
}
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java
index 01914170265..9b82297eab2 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java
@@ -83,7 +83,7 @@ public class PurgeCommandsTest {
}
@Before
- public void setUp() throws Exception {
+ public void setUp() {
}
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java
index c3babddf4ea..c4591ff4cfe 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java
@@ -237,7 +237,7 @@ public class PurgeDaoTest {
dbSession.commit();
assertThat(db.select("select metric_id as \"METRIC\",analysis_uuid as \"ANALYSIS\" from project_measures"))
- .extracting(t -> ((Long) t.get("METRIC")).intValue(), t -> (String) t.get("ANALYSIS"))
+ .extracting(t -> ((Long) t.get("METRIC")).intValue(), t -> t.get("ANALYSIS"))
.containsOnly(
tuple(metricWithHistory.getId(), lastAnalysis.getUuid()),
tuple(metricWithoutHistory.getId(), lastAnalysis.getUuid()),
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeMapperTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeMapperTest.java
index 8560f10c75d..d0d5461dc1a 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeMapperTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeMapperTest.java
@@ -41,7 +41,7 @@ public class PurgeMapperTest {
private PurgeMapper purgeMapper;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
dbSession = db.getDbClient().openSession(false);
purgeMapper = dbSession.getMapper(PurgeMapper.class);
}
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeProfilerTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeProfilerTest.java
index 48fdcfd856c..02ffbc73a81 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeProfilerTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeProfilerTest.java
@@ -80,7 +80,7 @@ public class PurgeProfilerTest {
verify(logger).info(contains("bar: 5ms"));
}
- private class MockedClock extends PurgeProfiler.Clock {
+ private static class MockedClock extends PurgeProfiler.Clock {
private long now = 0;
@Override
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java
index 4d26dcc207a..efeb18d0b40 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java
@@ -33,7 +33,6 @@ import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
import static java.util.Arrays.asList;
-import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
public class QProfileChangeDaoTest {
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java
index 72251e6be34..95fba0dad72 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java
@@ -51,7 +51,7 @@ public class GroupMembershipDaoTest {
private GroupMembershipDao underTest = db.getDbClient().groupMembershipDao();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
organizationDto = db.organizations().insert();
user1 = db.users().insertUser(u -> u.setLogin("admin login").setName("Admin name").setEmail("admin@email.com"));
user2 = db.users().insertUser(u -> u.setLogin("not.admin").setName("Not Admin").setEmail("Not Admin"));
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java
index ca072da52a1..20e303303f1 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java
@@ -320,7 +320,7 @@ public class UserDaoTest {
@Test
public void insert_user() {
- Long date = DateUtils.parseDate("2014-06-20").getTime();
+ long date = DateUtils.parseDate("2014-06-20").getTime();
UserDto userDto = new UserDto()
.setId(1)
diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java
index 4a4fd2eae79..677f3b4ab45 100644
--- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java
+++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java
@@ -172,7 +172,7 @@ public class SQDatabase extends DefaultDatabase {
new MigrationHistoryTableImpl(noopDatabase).start();
}
- private class NoopDatabase implements Database {
+ private static class NoopDatabase implements Database {
private final Dialect dialect;
private final DataSource dataSource;
diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java
index d984564bb08..7cd1e29e891 100644
--- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java
+++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java
@@ -89,7 +89,7 @@ class TestDbImpl extends CoreTestDb {
MyBatisConfExtension[] extensionArray = confExtensions.length == 0 ? null : confExtensions;
if (schemaPath == null) {
if (defaultSchemaBaseTestDb == null) {
- defaultSchemaBaseTestDb = new TestDbImpl((String) null);
+ defaultSchemaBaseTestDb = new TestDbImpl(null);
}
if (extensionArray != null) {
return defaultSchemaTestDbsWithExtensions.computeIfAbsent(
diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/notification/NotificationDbTester.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/notification/NotificationDbTester.java
index 4449bbaafc2..edcdba0316f 100644
--- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/notification/NotificationDbTester.java
+++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/notification/NotificationDbTester.java
@@ -34,12 +34,10 @@ import static org.assertj.core.api.Assertions.assertThat;
public class NotificationDbTester {
private static final String PROP_NOTIFICATION_PREFIX = "notification";
- private final DbTester db;
private final DbClient dbClient;
private final DbSession dbSession;
public NotificationDbTester(DbTester db) {
- this.db = db;
this.dbClient = db.getDbClient();
this.dbSession = db.getSession();
}
diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/user/GroupTesting.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/user/GroupTesting.java
index cfb6379e188..4e8c6e5219d 100644
--- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/user/GroupTesting.java
+++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/user/GroupTesting.java
@@ -32,13 +32,12 @@ public class GroupTesting {
}
public static GroupDto newGroupDto() {
- GroupDto group = new GroupDto()
+ return new GroupDto()
.setId(nextInt())
.setOrganizationUuid(randomAlphanumeric(40))
.setName(randomAlphanumeric(255))
.setDescription(randomAlphanumeric(200))
.setCreatedAt(new Date(nextLong()))
.setUpdatedAt(new Date(nextLong()));
- return group;
}
}
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandlerTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandlerTest.java
index 61d43082291..4350ada0cec 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandlerTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/charset/MssqlCharsetHandlerTest.java
@@ -152,7 +152,7 @@ public class MssqlCharsetHandlerTest {
});
}
}
- return res.stream().toArray(Object[][]::new);
+ return res.toArray(new Object[0][]);
}
@Test
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImplTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImplTest.java
index 75fb66b43ae..7d8c7703c75 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImplTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerImplTest.java
@@ -27,12 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class MigrationContainerImplTest {
private ComponentContainer parent = new ComponentContainer();
- private MigrationContainerPopulator populator = new MigrationContainerPopulator() {
- @Override
- public void populateContainer(MigrationContainer container) {
- container.add(StartCallCounter.class);
- }
- };
+ private MigrationContainerPopulator populator = container -> container.add(StartCallCounter.class);
private MigrationContainerImpl underTest = new MigrationContainerImpl(parent, populator);
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerPopulatorImplTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerPopulatorImplTest.java
index 26be6a4f96e..a0e7cf59a1d 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerPopulatorImplTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationContainerPopulatorImplTest.java
@@ -19,7 +19,6 @@
*/
package org.sonar.server.platform.db.migration.engine;
-import java.sql.SQLException;
import java.util.stream.Stream;
import org.junit.Before;
import org.junit.Test;
@@ -43,7 +42,7 @@ public class MigrationContainerPopulatorImplTest {
private MigrationContainerPopulatorImpl underTest = new MigrationContainerPopulatorImpl();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
migrationContainer.add(migrationSteps);
}
@@ -116,7 +115,7 @@ public class MigrationContainerPopulatorImplTest {
private static abstract class NoopMigrationStep implements MigrationStep {
@Override
- public void execute() throws SQLException {
+ public void execute() {
throw new UnsupportedOperationException("execute not implemented");
}
}
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImplTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImplTest.java
index 9f02622b7a8..1d4302bd6ce 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImplTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/engine/MigrationEngineImplTest.java
@@ -19,7 +19,6 @@
*/
package org.sonar.server.platform.db.migration.engine;
-import java.sql.SQLException;
import java.util.List;
import java.util.Optional;
import org.junit.Test;
@@ -47,12 +46,7 @@ public class MigrationEngineImplTest {
private MigrationHistory migrationHistory = mock(MigrationHistory.class);
private ComponentContainer serverContainer = new ComponentContainer();
private MigrationStepsExecutor stepsExecutor = mock(MigrationStepsExecutor.class);
- private MigrationContainerPopulator populator = new MigrationContainerPopulator() {
- @Override
- public void populateContainer(MigrationContainer container) {
- container.add(stepsExecutor);
- }
- };
+ private MigrationContainerPopulator populator = container -> container.add(stepsExecutor);
private MigrationSteps migrationSteps = mock(MigrationSteps.class);
private MapSettings settings = new MapSettings();
@@ -117,7 +111,7 @@ public class MigrationEngineImplTest {
private static class TestBlueGreenMigrationStep implements MigrationStep {
@Override
- public void execute() throws SQLException {
+ public void execute() {
}
}
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/DataChangeTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/DataChangeTest.java
index dbb50739b78..568e82a9ff1 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/DataChangeTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/DataChangeTest.java
@@ -119,11 +119,8 @@ public class DataChangeTest {
new DataChange(db.database()) {
@Override
public void execute(Context context) throws SQLException {
- context.prepareSelect("select id from persons where id>=?").setLong(1, 2L).get(new RowReader<Long>() {
- @Override
- public Long read(Row row) {
- throw new IllegalStateException("Unexpected error");
- }
+ context.prepareSelect("select id from persons where id>=?").setLong(1, 2L).get((RowReader<Long>) row -> {
+ throw new IllegalStateException("Unexpected error");
});
}
}.execute();
@@ -140,11 +137,8 @@ public class DataChangeTest {
new DataChange(db.database()) {
@Override
public void execute(Context context) throws SQLException {
- context.prepareSelect("select id from persons where id>=?").setLong(1, 2L).list(new RowReader<Long>() {
- @Override
- public Long read(Row row) {
- throw new IllegalStateException("Unexpected error");
- }
+ context.prepareSelect("select id from persons where id>=?").setLong(1, 2L).list((RowReader<Long>) row -> {
+ throw new IllegalStateException("Unexpected error");
});
}
}.execute();
@@ -155,12 +149,11 @@ public class DataChangeTest {
public void bad_parameterized_query() throws Exception {
insertPersons();
- final List<Long> ids = new ArrayList<>();
DataChange change = new DataChange(db.database()) {
@Override
public void execute(Context context) throws SQLException {
// parameter value is not set
- ids.addAll(context.prepareSelect("select id from persons where id>=?").list(Select.LONG_READER));
+ context.prepareSelect("select id from persons where id>=?").list(Select.LONG_READER);
}
};
@@ -177,12 +170,7 @@ public class DataChangeTest {
new DataChange(db.database()) {
@Override
public void execute(Context context) throws SQLException {
- context.prepareSelect("select id from persons order by id desc").scroll(new Select.RowHandler() {
- @Override
- public void handle(Row row) throws SQLException {
- ids.add(row.getNullableLong(1));
- }
- });
+ context.prepareSelect("select id from persons order by id desc").scroll(row -> ids.add(row.getNullableLong(1)));
}
}.execute();
assertThat(ids).containsExactly(3L, 2L, 1L);
@@ -372,11 +360,8 @@ public class DataChangeTest {
@Override
public void execute(Context context) throws SQLException {
final Upsert upsert = context.prepareUpsert("update persons set login=?, age=? where id=?");
- context.prepareSelect("select id from persons").scroll(new Select.RowHandler() {
- @Override
- public void handle(Row row) {
- throw new IllegalStateException("Unexpected error");
- }
+ context.prepareSelect("select id from persons").scroll(row -> {
+ throw new IllegalStateException("Unexpected error");
});
upsert.commit().close();
}
@@ -393,16 +378,13 @@ public class DataChangeTest {
MassUpdate massUpdate = context.prepareMassUpdate();
massUpdate.select("select id from persons where id>=?").setLong(1, 2L);
massUpdate.update("update persons set login=?, age=? where id=?");
- massUpdate.execute(new MassUpdate.Handler() {
- @Override
- public boolean handle(Row row, SqlStatement update) throws SQLException {
- long id = row.getNullableLong(1);
- update
- .setString(1, "login" + id)
- .setInt(2, 10 + (int) id)
- .setLong(3, id);
- return true;
- }
+ massUpdate.execute((row, update) -> {
+ long id = row.getNullableLong(1);
+ update
+ .setString(1, "login" + id)
+ .setInt(2, 10 + (int) id)
+ .setLong(3, id);
+ return true;
});
}
}.execute();
@@ -425,11 +407,8 @@ public class DataChangeTest {
MassUpdate massUpdate = context.prepareMassUpdate();
massUpdate.select("select id from persons where id>=?").setLong(1, 2L);
massUpdate.update("update persons set login=?, age=? where id=?");
- massUpdate.execute(new MassUpdate.Handler() {
- @Override
- public boolean handle(Row row, SqlStatement update) {
- throw new IllegalStateException("Unexpected error");
- }
+ massUpdate.execute((row, update) -> {
+ throw new IllegalStateException("Unexpected error");
});
}
}.execute();
@@ -445,12 +424,7 @@ public class DataChangeTest {
MassUpdate massUpdate = context.prepareMassUpdate();
massUpdate.select("select id from persons where id>=?").setLong(1, 2L);
massUpdate.update("update persons set login=?, age=? where id=?");
- massUpdate.execute(new MassUpdate.Handler() {
- @Override
- public boolean handle(Row row, SqlStatement update) {
- return false;
- }
- });
+ massUpdate.execute((row, update) -> false);
}
}.execute();
@@ -467,12 +441,7 @@ public class DataChangeTest {
MassUpdate massUpdate = context.prepareMassUpdate();
massUpdate.select("select id from persons where id>=?").setLong(1, 2L);
// update is not set
- massUpdate.execute(new MassUpdate.Handler() {
- @Override
- public boolean handle(Row row, SqlStatement update) {
- return false;
- }
- });
+ massUpdate.execute((row, update) -> false);
}
};
try {
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepRegistryImplTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepRegistryImplTest.java
index 3ea74ba75e9..10da24889de 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepRegistryImplTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepRegistryImplTest.java
@@ -19,7 +19,6 @@
*/
package org.sonar.server.platform.db.migration.step;
-import java.sql.SQLException;
import java.util.List;
import java.util.Random;
import org.junit.Rule;
@@ -109,7 +108,7 @@ public class MigrationStepRegistryImplTest {
private static abstract class NoopMigrationStep implements MigrationStep {
@Override
- public void execute() throws SQLException {
+ public void execute() {
throw new IllegalStateException("execute is not implemented");
}
}
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImplTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImplTest.java
index f14bc8ba76e..cc668de1c0d 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImplTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/step/MigrationStepsExecutorImplTest.java
@@ -165,7 +165,7 @@ public class MigrationStepsExecutorImplTest {
private boolean called = false;
@Override
- public void execute() throws SQLException {
+ public void execute() {
checkState(!called, "execute must not be called twice");
this.called = true;
calledSteps.add(getClass());
@@ -205,7 +205,7 @@ public class MigrationStepsExecutorImplTest {
private static final RuntimeException THROWN_EXCEPTION = new RuntimeException("Faking failing migration step");
@Override
- public void execute() throws SQLException {
+ public void execute() {
throw THROWN_EXCEPTION;
}
}
diff --git a/server/sonar-main/src/test/java/org/sonar/application/ProcessLauncherImplTest.java b/server/sonar-main/src/test/java/org/sonar/application/ProcessLauncherImplTest.java
index 3b17fc77d9e..657bd8cef74 100644
--- a/server/sonar-main/src/test/java/org/sonar/application/ProcessLauncherImplTest.java
+++ b/server/sonar-main/src/test/java/org/sonar/application/ProcessLauncherImplTest.java
@@ -164,7 +164,7 @@ public class ProcessLauncherImplTest {
File homeDir = temp.newFolder();
File dataDir = temp.newFolder();
File logDir = temp.newFolder();
- ProcessLauncher underTest = new ProcessLauncherImpl(tempDir, commands, () -> new TestProcessBuilder());
+ ProcessLauncher underTest = new ProcessLauncherImpl(tempDir, commands, TestProcessBuilder::new);
EsScriptCommand command = createEsScriptCommand(tempDir, homeDir, dataDir, logDir);
File outdatedEsDir = new File(dataDir, "es");
diff --git a/server/sonar-main/src/test/java/org/sonar/application/cluster/AppNodesClusterHostsConsistencyTest.java b/server/sonar-main/src/test/java/org/sonar/application/cluster/AppNodesClusterHostsConsistencyTest.java
index ad86c41ffd2..4aa1eaaef74 100644
--- a/server/sonar-main/src/test/java/org/sonar/application/cluster/AppNodesClusterHostsConsistencyTest.java
+++ b/server/sonar-main/src/test/java/org/sonar/application/cluster/AppNodesClusterHostsConsistencyTest.java
@@ -144,7 +144,7 @@ public class AppNodesClusterHostsConsistencyTest {
return member;
}
- private class TestHazelcastMember implements HazelcastMember {
+ private static class TestHazelcastMember implements HazelcastMember {
private final Map<Member, List<String>> hostsPerMember;
private final Cluster cluster = mock(Cluster.class);
diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java
index 5ab518cbb16..21e89533baf 100644
--- a/server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java
+++ b/server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java
@@ -52,7 +52,7 @@ public class WebJvmOptionsTest {
}
@Test
- public void constructor_sets_mandatory_JVM_options_for_java11() throws IOException {
+ public void constructor_sets_mandatory_JVM_options_for_java11() {
when(javaVersion.isAtLeastJava11()).thenReturn(true);
underTest = new WebJvmOptions(tmpDir, javaVersion);
diff --git a/server/sonar-main/src/test/java/org/sonar/application/process/EsManagedProcessTest.java b/server/sonar-main/src/test/java/org/sonar/application/process/EsManagedProcessTest.java
index f3c36b6442d..8f5bb52bdb1 100644
--- a/server/sonar-main/src/test/java/org/sonar/application/process/EsManagedProcessTest.java
+++ b/server/sonar-main/src/test/java/org/sonar/application/process/EsManagedProcessTest.java
@@ -125,7 +125,7 @@ public class EsManagedProcessTest {
);
}
- private class MemoryAppender<E> extends AppenderBase<E> {
+ private static class MemoryAppender<E> extends AppenderBase<E> {
private final List<E> events = new ArrayList();
@Override
diff --git a/server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java b/server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java
index c5b24a04d95..18a46ae849a 100644
--- a/server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java
+++ b/server/sonar-process/src/main/java/org/sonar/process/logging/Log4JPropertiesBuilder.java
@@ -150,7 +150,7 @@ public class Log4JPropertiesBuilder extends AbstractLogHelper {
}
private void applyLevelByProperty(Props props, String loggerKey, List<String> properties) {
- putLevel(loggerKey, resolveLevel(props, properties.stream().toArray(String[]::new)));
+ putLevel(loggerKey, resolveLevel(props, properties.toArray(new String[0])));
}
private void applyHardcodedLevel(String loggerName, Level newLevel) {
diff --git a/server/sonar-process/src/main/java/org/sonar/process/logging/LogbackHelper.java b/server/sonar-process/src/main/java/org/sonar/process/logging/LogbackHelper.java
index e1810fd3ffa..0e6af6b5f77 100644
--- a/server/sonar-process/src/main/java/org/sonar/process/logging/LogbackHelper.java
+++ b/server/sonar-process/src/main/java/org/sonar/process/logging/LogbackHelper.java
@@ -124,8 +124,8 @@ public class LogbackHelper extends AbstractLogHelper {
return rootContext;
}
- private void applyLevelByProperty(Props props, Logger logger, List<String> properties) {
- logger.setLevel(resolveLevel(props, properties.stream().toArray(String[]::new)));
+ private static void applyLevelByProperty(Props props, Logger logger, List<String> properties) {
+ logger.setLevel(resolveLevel(props, properties.toArray(new String[0])));
}
private static void applyHardcodedLevel(LoggerContext rootContext, String loggerName, Level newLevel) {
diff --git a/server/sonar-process/src/test/java/org/sonar/process/ConfigurationUtilsTest.java b/server/sonar-process/src/test/java/org/sonar/process/ConfigurationUtilsTest.java
index 9de9e9ea187..42b52e0ad76 100644
--- a/server/sonar-process/src/test/java/org/sonar/process/ConfigurationUtilsTest.java
+++ b/server/sonar-process/src/test/java/org/sonar/process/ConfigurationUtilsTest.java
@@ -19,17 +19,17 @@
*/
package org.sonar.process;
-import com.google.common.collect.Maps;
+import java.io.File;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
import org.apache.commons.io.FileUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.sonar.test.TestUtils;
-import java.io.File;
-import java.util.Map;
-import java.util.Properties;
-
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
@@ -44,7 +44,7 @@ public class ConfigurationUtilsTest {
input.setProperty("hello", "world");
input.setProperty("url", "${env:SONAR_JDBC_URL}");
input.setProperty("do_not_change", "${SONAR_JDBC_URL}");
- Map<String, String> variables = Maps.newHashMap();
+ Map<String, String> variables = new HashMap<>();
variables.put("SONAR_JDBC_URL", "jdbc:h2:mem");
Properties output = ConfigurationUtils.interpolateVariables(input, variables);
@@ -74,7 +74,7 @@ public class ConfigurationUtilsTest {
@Test
public void loadPropsFromCommandLineArgs_load_properties_from_file() throws Exception {
File propsFile = temp.newFile();
- FileUtils.write(propsFile, "foo=bar");
+ FileUtils.write(propsFile, "foo=bar", StandardCharsets.UTF_8);
Props result = ConfigurationUtils.loadPropsFromCommandLineArgs(new String[] {propsFile.getAbsolutePath()});
assertThat(result.value("foo")).isEqualTo("bar");
@@ -87,7 +87,7 @@ public class ConfigurationUtilsTest {
FileUtils.deleteQuietly(propsFile);
try {
- ConfigurationUtils.loadPropsFromCommandLineArgs(new String[]{propsFile.getAbsolutePath()});
+ ConfigurationUtils.loadPropsFromCommandLineArgs(new String[] {propsFile.getAbsolutePath()});
fail();
} catch (IllegalStateException e) {
assertThat(e).hasMessage("Could not read properties from file: " + propsFile.getAbsolutePath());
diff --git a/server/sonar-process/src/test/java/org/sonar/process/ProcessEntryPointTest.java b/server/sonar-process/src/test/java/org/sonar/process/ProcessEntryPointTest.java
index 43b7dd06118..22f66eebe88 100644
--- a/server/sonar-process/src/test/java/org/sonar/process/ProcessEntryPointTest.java
+++ b/server/sonar-process/src/test/java/org/sonar/process/ProcessEntryPointTest.java
@@ -140,13 +140,10 @@ public class ProcessEntryPointTest {
final ProcessEntryPoint entryPoint = new ProcessEntryPoint(props, exit, commands, runtime);
final StandardProcess process = new StandardProcess();
- Thread runner = new Thread() {
- @Override
- public void run() {
- // starts and waits until terminated
- entryPoint.launch(process);
- }
- };
+ Thread runner = new Thread(() -> {
+ // starts and waits until terminated
+ entryPoint.launch(process);
+ });
runner.start();
waitForOperational(process, commands);
diff --git a/server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java b/server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java
index dd4b39b1de1..943950243f8 100644
--- a/server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java
+++ b/server/sonar-process/src/test/java/org/sonar/process/ProcessPropertiesTest.java
@@ -115,7 +115,7 @@ public class ProcessPropertiesTest {
processProperties.completeDefaults(p);
}
- private class FakeExtension1 implements CoreExtension {
+ private static class FakeExtension1 implements CoreExtension {
@Override
public String getName() {
@@ -135,7 +135,7 @@ public class ProcessPropertiesTest {
}
}
- private class FakeExtension2 implements CoreExtension {
+ private static class FakeExtension2 implements CoreExtension {
@Override
public String getName() {
@@ -155,7 +155,7 @@ public class ProcessPropertiesTest {
}
}
- private class FakeExtension3 implements CoreExtension {
+ private static class FakeExtension3 implements CoreExtension {
@Override
public String getName() {
diff --git a/server/sonar-process/src/test/java/org/sonar/process/cluster/health/SharedHealthStateImplTest.java b/server/sonar-process/src/test/java/org/sonar/process/cluster/health/SharedHealthStateImplTest.java
index 8090920dc39..b94af6ec8f0 100644
--- a/server/sonar-process/src/test/java/org/sonar/process/cluster/health/SharedHealthStateImplTest.java
+++ b/server/sonar-process/src/test/java/org/sonar/process/cluster/health/SharedHealthStateImplTest.java
@@ -115,7 +115,7 @@ public class SharedHealthStateImplTest {
when(hazelcastMember.getClusterTime()).thenReturn(clusterTime);
assertThat(underTest.readAll())
- .containsOnly(expected.values().stream().toArray(NodeHealth[]::new));
+ .containsOnly(expected.values().toArray(new NodeHealth[0]));
assertThat(logging.getLogs()).isEmpty();
}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/es/IndexDefinition.java b/server/sonar-server-common/src/main/java/org/sonar/server/es/IndexDefinition.java
index 09005233a0e..1a8b92e2976 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/es/IndexDefinition.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/es/IndexDefinition.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.es;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.Map;
import org.sonar.api.server.ServerSide;
import org.sonar.server.es.newindex.NewAuthorizedIndex;
@@ -33,7 +33,7 @@ import static com.google.common.base.Preconditions.checkArgument;
public interface IndexDefinition {
class IndexDefinitionContext {
- private final Map<String, NewIndex> byKey = Maps.newHashMap();
+ private final Map<String, NewIndex> byKey = new HashMap<>();
public NewRegularIndex create(Index index, SettingsConfiguration settingsConfiguration) {
String indexName = index.getName();
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/es/IndexDefinitionHash.java b/server/sonar-server-common/src/main/java/org/sonar/server/es/IndexDefinitionHash.java
index 2465e70cbd2..29ab3d874a8 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/es/IndexDefinitionHash.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/es/IndexDefinitionHash.java
@@ -49,15 +49,15 @@ class IndexDefinitionHash {
index.getAttributes());
}
- private static String of(String str, Map<?,?>... maps) {
+ private static String of(String str, Map<?, ?>... maps) {
StringBuilder sb = new StringBuilder(str);
- for (Map<?,?> map : maps) {
+ for (Map<?, ?> map : maps) {
appendMap(sb, map);
}
return DigestUtils.sha256Hex(sb.toString());
}
- private static void appendMap(StringBuilder sb, Map<?,?> attributes) {
+ private static void appendMap(StringBuilder sb, Map<?, ?> attributes) {
for (Object entry : sort(attributes).entrySet()) {
sb.append(((Map.Entry) entry).getKey());
sb.append(DELIMITER);
@@ -74,13 +74,13 @@ class IndexDefinitionHash {
} else if (value instanceof IndexType) {
sb.append(((IndexType) value).format());
} else {
- sb.append(String.valueOf(value));
+ sb.append(value);
}
}
- private static SortedMap<?,?> sort(Map<?,?> map) {
+ private static SortedMap<?, ?> sort(Map<?, ?> map) {
if (map instanceof ImmutableSortedMap) {
- return (ImmutableSortedMap<?,?>) map;
+ return (ImmutableSortedMap<?, ?>) map;
}
return ImmutableSortedMap.copyOf(map);
}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIteratorForSingleChunk.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIteratorForSingleChunk.java
index ee54f4a6d9f..1b410e8c77f 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIteratorForSingleChunk.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIteratorForSingleChunk.java
@@ -22,11 +22,11 @@ package org.sonar.server.issue.index;
import com.google.common.base.CharMatcher;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterators;
-import com.google.common.collect.Maps;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@@ -190,7 +190,7 @@ class IssueIteratorForSingleChunk implements IssueIterator {
@Override
protected IssueDoc read(ResultSet rs) throws SQLException {
- IssueDoc doc = new IssueDoc(Maps.newHashMapWithExpectedSize(30));
+ IssueDoc doc = new IssueDoc(new HashMap<>(30));
String key = rs.getString(1);
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java
index 646979ecbcc..400aa3fa3c6 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java
@@ -35,6 +35,7 @@ import org.sonar.core.i18n.I18n;
import org.sonar.server.issue.notification.NewIssuesStatistics.Metric;
import static com.google.common.base.Preconditions.checkNotNull;
+import static java.nio.charset.StandardCharsets.UTF_8;
/**
* Base class to create emails for new issues
@@ -65,7 +66,7 @@ public abstract class AbstractNewIssuesEmailTemplate implements EmailTemplate {
public static String encode(String toEncode) {
try {
- return URLEncoder.encode(toEncode, "UTF-8");
+ return URLEncoder.encode(toEncode, UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("Encoding not supported", e);
}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java
index 2ef310f5964..f2aa43a65da 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java
@@ -41,6 +41,7 @@ import org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.Proj
import org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.Rule;
import static java.net.URLEncoder.encode;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.sonar.core.util.stream.MoreCollectors.index;
public abstract class IssueChangesEmailTemplate implements EmailTemplate {
@@ -200,7 +201,7 @@ public abstract class IssueChangesEmailTemplate implements EmailTemplate {
private static String urlEncode(String str) {
try {
- return encode(str, "UTF-8");
+ return encode(str, UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssuesChangesNotificationBuilder.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssuesChangesNotificationBuilder.java
index a0fadc8fd92..c894b33867f 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssuesChangesNotificationBuilder.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssuesChangesNotificationBuilder.java
@@ -371,7 +371,7 @@ public class IssuesChangesNotificationBuilder {
protected final long date;
private Change(long date) {
- this.date = requireNonNull(date, "date can't be null");
+ this.date = date;
}
public long getDate() {
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/notification/NotificationDispatcherMetadata.java b/server/sonar-server-common/src/main/java/org/sonar/server/notification/NotificationDispatcherMetadata.java
index 6b225d9e367..19d6f000f9f 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/notification/NotificationDispatcherMetadata.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/notification/NotificationDispatcherMetadata.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.notification;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.Map;
import org.sonar.api.ce.ComputeEngineSide;
import org.sonar.api.server.ServerSide;
@@ -43,7 +43,7 @@ public final class NotificationDispatcherMetadata {
private NotificationDispatcherMetadata(String dispatcherKey) {
this.dispatcherKey = dispatcherKey;
- this.properties = Maps.newHashMap();
+ this.properties = new HashMap<>();
}
/**
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleExtensionDoc.java b/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleExtensionDoc.java
index d75627e3291..c34aa929763 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleExtensionDoc.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleExtensionDoc.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.rule.index;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
@@ -36,7 +36,7 @@ public class RuleExtensionDoc extends BaseDoc {
}
public RuleExtensionDoc() {
- super(TYPE_RULE_EXTENSION, Maps.newHashMapWithExpectedSize(4));
+ super(TYPE_RULE_EXTENSION, new HashMap<>(4));
}
@Override
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/user/index/UserDoc.java b/server/sonar-server-common/src/main/java/org/sonar/server/user/index/UserDoc.java
index ed435fadfa7..5bcecedff3a 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/user/index/UserDoc.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/user/index/UserDoc.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.user.index;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
@@ -35,7 +35,7 @@ public class UserDoc extends BaseDoc {
}
public UserDoc() {
- this(Maps.newHashMap());
+ this(new HashMap<>());
}
@Override
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/view/index/ViewDoc.java b/server/sonar-server-common/src/main/java/org/sonar/server/view/index/ViewDoc.java
index bff2c49ac2b..db9d0e0f33e 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/view/index/ViewDoc.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/view/index/ViewDoc.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.view.index;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.sonar.server.es.BaseDoc;
@@ -33,7 +33,7 @@ public class ViewDoc extends BaseDoc {
}
public ViewDoc() {
- super(TYPE_VIEW, Maps.newHashMap());
+ super(TYPE_VIEW, new HashMap<>());
}
@Override
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/view/index/ViewIndexer.java b/server/sonar-server-common/src/main/java/org/sonar/server/view/index/ViewIndexer.java
index 5a7c581ac84..2dc241e6880 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/view/index/ViewIndexer.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/view/index/ViewIndexer.java
@@ -21,6 +21,7 @@ package org.sonar.server.view.index;
import com.google.common.collect.ImmutableSet;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -40,7 +41,6 @@ import org.sonar.server.es.IndexingResult;
import org.sonar.server.es.OneToOneResilientIndexingListener;
import org.sonar.server.es.ResilientIndexer;
-import static com.google.common.collect.Maps.newHashMap;
import static org.sonar.core.util.stream.MoreCollectors.toHashSet;
import static org.sonar.server.view.index.ViewIndexDefinition.TYPE_VIEW;
@@ -62,7 +62,7 @@ public class ViewIndexer implements ResilientIndexer {
@Override
public void indexOnStartup(Set<IndexType> uninitializedIndexTypes) {
try (DbSession dbSession = dbClient.openSession(false)) {
- Map<String, String> viewAndProjectViewUuidMap = newHashMap();
+ Map<String, String> viewAndProjectViewUuidMap = new HashMap<>();
for (UuidWithProjectUuidDto uuidWithProjectUuidDto : dbClient.componentDao().selectAllViewsAndSubViews(dbSession)) {
viewAndProjectViewUuidMap.put(uuidWithProjectUuidDto.getUuid(), uuidWithProjectUuidDto.getProjectUuid());
}
@@ -78,7 +78,7 @@ public class ViewIndexer implements ResilientIndexer {
*/
public void index(String rootViewUuid) {
try (DbSession dbSession = dbClient.openSession(false)) {
- Map<String, String> viewAndProjectViewUuidMap = newHashMap();
+ Map<String, String> viewAndProjectViewUuidMap = new HashMap<>();
for (ComponentDto viewOrSubView : dbClient.componentDao().selectEnabledDescendantModules(dbSession, rootViewUuid)) {
viewAndProjectViewUuidMap.put(viewOrSubView.uuid(), viewOrSubView.projectUuid());
}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/webhook/WebhookPayloadFactoryImpl.java b/server/sonar-server-common/src/main/java/org/sonar/server/webhook/WebhookPayloadFactoryImpl.java
index 774b98ccd8a..f436837c6cb 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/webhook/WebhookPayloadFactoryImpl.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/webhook/WebhookPayloadFactoryImpl.java
@@ -36,6 +36,7 @@ import org.sonar.server.qualitygate.EvaluatedCondition;
import org.sonar.server.qualitygate.EvaluatedQualityGate;
import static java.lang.String.format;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.sonar.core.config.CorePropertyDefinitions.SONAR_ANALYSIS;
@ServerSide
@@ -164,7 +165,7 @@ public class WebhookPayloadFactoryImpl implements WebhookPayloadFactory {
private static String encode(String toEncode) {
try {
- return URLEncoder.encode(toEncode, "UTF-8");
+ return URLEncoder.encode(toEncode, UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("Encoding not supported", e);
}
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/es/OneToManyResilientIndexingListenerTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/es/OneToManyResilientIndexingListenerTest.java
index 8bceb9261e4..3e6ea8f7b4d 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/es/OneToManyResilientIndexingListenerTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/es/OneToManyResilientIndexingListenerTest.java
@@ -112,7 +112,7 @@ public class OneToManyResilientIndexingListenerTest {
try (DbSession otherSession = db.getDbClient().openSession(false)) {
List<String> uuidsInDb = db.getDbClient().esQueueDao().selectForRecovery(otherSession, Long.MAX_VALUE, 10)
.stream().map(EsQueueDto::getUuid).collect(toList());
- String expectedUuids[] = Arrays.stream(expected).map(EsQueueDto::getUuid).toArray(String[]::new);
+ String[] expectedUuids = Arrays.stream(expected).map(EsQueueDto::getUuid).toArray(String[]::new);
assertThat(uuidsInDb).containsExactlyInAnyOrder(expectedUuids);
}
}
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/es/OneToOneResilientIndexingListenerTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/es/OneToOneResilientIndexingListenerTest.java
index c46a0ad3732..1cd9569c373 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/es/OneToOneResilientIndexingListenerTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/es/OneToOneResilientIndexingListenerTest.java
@@ -107,7 +107,7 @@ public class OneToOneResilientIndexingListenerTest {
try (DbSession otherSession = db.getDbClient().openSession(false)) {
List<String> uuidsInDb = db.getDbClient().esQueueDao().selectForRecovery(otherSession, Long.MAX_VALUE, 10)
.stream().map(EsQueueDto::getUuid).collect(toList());
- String expectedUuids[] = Arrays.stream(expected).map(EsQueueDto::getUuid).toArray(String[]::new);
+ String[] expectedUuids = Arrays.stream(expected).map(EsQueueDto::getUuid).toArray(String[]::new);
assertThat(uuidsInDb).containsExactlyInAnyOrder(expectedUuids);
}
}
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/es/SortingTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/es/SortingTest.java
index 7b17b13bf87..56c74591f5a 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/es/SortingTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/es/SortingTest.java
@@ -47,7 +47,7 @@ public class SortingTest {
}
@Test
- public void ascending_sort_on_single_field() throws Exception {
+ public void ascending_sort_on_single_field() {
Sorting sorting = new Sorting();
sorting.add("updatedAt");
@@ -57,7 +57,7 @@ public class SortingTest {
}
@Test
- public void descending_sort_on_single_field() throws Exception {
+ public void descending_sort_on_single_field() {
Sorting sorting = new Sorting();
sorting.add("updatedAt");
@@ -67,7 +67,7 @@ public class SortingTest {
}
@Test
- public void ascending_sort_on_single_field_with_missing_in_last_position() throws Exception {
+ public void ascending_sort_on_single_field_with_missing_in_last_position() {
Sorting sorting = new Sorting();
sorting.add("updatedAt").missingLast();
@@ -77,7 +77,7 @@ public class SortingTest {
}
@Test
- public void descending_sort_on_single_field_with_missing_in_last_position() throws Exception {
+ public void descending_sort_on_single_field_with_missing_in_last_position() {
Sorting sorting = new Sorting();
sorting.add("updatedAt").missingLast();
@@ -87,7 +87,7 @@ public class SortingTest {
}
@Test
- public void sort_on_multiple_fields() throws Exception {
+ public void sort_on_multiple_fields() {
// asc => file asc, line asc, severity desc, key asc
Sorting sorting = new Sorting();
sorting.add("fileLine", "file");
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandlerTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandlerTest.java
index 9f51b5b233b..e658991e580 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandlerTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandlerTest.java
@@ -447,8 +447,7 @@ public class ChangesOnMyIssueNotificationHandlerTest {
}
private static IssuesChangesNotification newNotification(@Nullable String projectKey, @Nullable String assignee, @Nullable String changeAuthor) {
- IssuesChangesNotification notification = mock(IssuesChangesNotification.class);
- return notification;
+ return mock(IssuesChangesNotification.class);
}
private static NotificationManager.EmailRecipient emailRecipientOf(String login) {
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java
index ec1fc186f39..9ac507b85fc 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java
@@ -53,7 +53,7 @@ public class MyNewIssuesEmailTemplateTest {
private MyNewIssuesEmailTemplate underTest = new MyNewIssuesEmailTemplate(new EmailSettings(settings.asConfig(), server), i18n);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(server.getPublicRootUrl()).thenReturn("http://nemo.sonarsource.org");
}
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java
index df611026d05..7650eb90a26 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java
@@ -54,7 +54,7 @@ public class NewIssuesEmailTemplateTest {
private NewIssuesEmailTemplate template = new NewIssuesEmailTemplate(new EmailSettings(settings.asConfig(), server), i18n);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(server.getPublicRootUrl()).thenReturn("http://nemo.sonarsource.org");
}
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java
index 60c6596b710..68b15254840 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/workflow/IssueWorkflowTest.java
@@ -19,7 +19,6 @@
*/
package org.sonar.server.issue.workflow;
-import com.google.common.base.Function;
import com.google.common.collect.Collections2;
import com.tngtech.java.junit.dataprovider.DataProvider;
import com.tngtech.java.junit.dataprovider.DataProviderRunner;
@@ -473,11 +472,6 @@ public class IssueWorkflowTest {
}
private Collection<String> keys(List<Transition> transitions) {
- return Collections2.transform(transitions, new Function<Transition, String>() {
- @Override
- public String apply(@Nullable Transition transition) {
- return transition.key();
- }
- });
+ return Collections2.transform(transitions, Transition::key);
}
}
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/property/InternalPropertiesImplTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/property/InternalPropertiesImplTest.java
index 849a0d70d22..f891369cf1e 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/property/InternalPropertiesImplTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/property/InternalPropertiesImplTest.java
@@ -47,7 +47,7 @@ public class InternalPropertiesImplTest {
private InternalPropertiesImpl underTest = new InternalPropertiesImpl(dbClient);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(dbClient.openSession(false)).thenReturn(dbSession);
when(dbClient.internalPropertiesDao()).thenReturn(internalPropertiesDao);
}
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/qualitygate/notification/QGChangeEmailTemplateTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/qualitygate/notification/QGChangeEmailTemplateTest.java
index 212f49b3699..03aedec2284 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/qualitygate/notification/QGChangeEmailTemplateTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/qualitygate/notification/QGChangeEmailTemplateTest.java
@@ -196,7 +196,7 @@ public class QGChangeEmailTemplateTest {
}
private Notification createNotification(String alertName, String alertText, String alertLevel, String isNewAlert) {
- Notification notification = new Notification("alerts")
+ return new Notification("alerts")
.setFieldValue("projectName", "Foo")
.setFieldValue("projectKey", "org.sonar.foo:foo")
.setFieldValue("projectId", "45")
@@ -205,7 +205,6 @@ public class QGChangeEmailTemplateTest {
.setFieldValue("alertText", alertText)
.setFieldValue("alertLevel", alertLevel)
.setFieldValue("isNewAlert", isNewAlert);
- return notification;
}
}
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/qualityprofile/index/ActiveRuleIndexerTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/qualityprofile/index/ActiveRuleIndexerTest.java
index 060f0e290e3..d491b47943f 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/qualityprofile/index/ActiveRuleIndexerTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/qualityprofile/index/ActiveRuleIndexerTest.java
@@ -58,7 +58,6 @@ public class ActiveRuleIndexerTest {
private ActiveRuleIndexer underTest = new ActiveRuleIndexer(db.getDbClient(), es.client());
private RuleDefinitionDto rule1;
private RuleDefinitionDto rule2;
- private OrganizationDto org;
private QProfileDto profile1;
private QProfileDto profile2;
@@ -66,7 +65,7 @@ public class ActiveRuleIndexerTest {
public void before() {
rule1 = db.rules().insert();
rule2 = db.rules().insert();
- org = db.organizations().insert();
+ OrganizationDto org = db.organizations().insert();
profile1 = db.qualityProfiles().insert(org);
profile2 = db.qualityProfiles().insert(org);
}
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/setting/ThreadLocalSettingsTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/setting/ThreadLocalSettingsTest.java
index b3f95151083..1aab8c4f366 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/setting/ThreadLocalSettingsTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/setting/ThreadLocalSettingsTest.java
@@ -375,7 +375,7 @@ public class ThreadLocalSettingsTest {
captor.verifyValue(settings, expectedValue);
}
- private class CacheCaptorThread extends Thread {
+ private static class CacheCaptorThread extends Thread {
private final CountDownLatch latch = new CountDownLatch(1);
private ThreadLocalSettings settings;
private String value;
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/util/AbstractStoppableExecutorServiceTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/util/AbstractStoppableExecutorServiceTest.java
index 637eda5e533..35fac76f8b0 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/util/AbstractStoppableExecutorServiceTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/util/AbstractStoppableExecutorServiceTest.java
@@ -35,20 +35,12 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class AbstractStoppableExecutorServiceTest {
- private static final Callable<String> SOME_CALLABLE = new Callable<String>() {
- @Override
- public String call() {
- return null;
- }
- };
- private static final Runnable SOME_RUNNABLE = new Runnable() {
- @Override
- public void run() {
+ private static final Callable<String> SOME_CALLABLE = () -> null;
+ private static final Runnable SOME_RUNNABLE = () -> {
- }
};
private static final String SOME_STRING = "some string";
- private static final long SOME_LONG = 100l;
+ private static final long SOME_LONG = 100L;
private static final int TIMEOUT = 5;
private static final TimeUnit TIMEOUT_UNIT = TimeUnit.SECONDS;
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java
index b33aec78e8f..09cf223f94c 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/webhook/WebhookPayloadFactoryImplTest.java
@@ -49,7 +49,7 @@ public class WebhookPayloadFactoryImplTest {
private WebhookPayloadFactory underTest = new WebhookPayloadFactoryImpl(server, system2);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(server.getPublicRootUrl()).thenReturn("http://foo");
when(system2.now()).thenReturn(1_500_999L);
}
diff --git a/server/sonar-server-common/src/testFixtures/java/org/elasticsearch/transport/MockTcpTransport.java b/server/sonar-server-common/src/testFixtures/java/org/elasticsearch/transport/MockTcpTransport.java
index b5d89ef054d..3ab2dd12797 100644
--- a/server/sonar-server-common/src/testFixtures/java/org/elasticsearch/transport/MockTcpTransport.java
+++ b/server/sonar-server-common/src/testFixtures/java/org/elasticsearch/transport/MockTcpTransport.java
@@ -199,7 +199,7 @@ public class MockTcpTransport extends TcpTransport {
configureSocket(socket);
success = true;
} finally {
- if (success == false) {
+ if (!success) {
IOUtils.close(socket);
}
}
@@ -233,7 +233,7 @@ public class MockTcpTransport extends TcpTransport {
}
// make sure we maintain at least the types that are supported by this profile even if we only use a single channel for them.
builder.addConnections(1, allTypesWithConnection.toArray(new TransportRequestOptions.Type[0]));
- if (allTypesWithoutConnection.isEmpty() == false) {
+ if (!allTypesWithoutConnection.isEmpty()) {
builder.addConnections(0, allTypesWithoutConnection.toArray(new TransportRequestOptions.Type[0]));
}
builder.setHandshakeTimeout(connectionProfile.getHandshakeTimeout());
@@ -479,7 +479,7 @@ public class MockTcpTransport extends TcpTransport {
super.doStart();
success = true;
} finally {
- if (success == false) {
+ if (!success) {
doStop();
}
}
diff --git a/server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/FakeDoc.java b/server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/FakeDoc.java
index d199ed9323a..01fa5a56611 100644
--- a/server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/FakeDoc.java
+++ b/server/sonar-server-common/src/testFixtures/java/org/sonar/server/es/FakeDoc.java
@@ -19,14 +19,14 @@
*/
package org.sonar.server.es;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import static org.sonar.server.es.newindex.FakeIndexDefinition.INT_FIELD;
import static org.sonar.server.es.newindex.FakeIndexDefinition.TYPE_FAKE;
public class FakeDoc extends BaseDoc {
public FakeDoc() {
- super(TYPE_FAKE, Maps.newHashMap());
+ super(TYPE_FAKE, new HashMap<>());
}
@Override
diff --git a/server/sonar-server-common/src/testFixtures/java/org/sonar/server/issue/IssueDocTesting.java b/server/sonar-server-common/src/testFixtures/java/org/sonar/server/issue/IssueDocTesting.java
index c63f12e950c..d50bd557c38 100644
--- a/server/sonar-server-common/src/testFixtures/java/org/sonar/server/issue/IssueDocTesting.java
+++ b/server/sonar-server-common/src/testFixtures/java/org/sonar/server/issue/IssueDocTesting.java
@@ -19,8 +19,8 @@
*/
package org.sonar.server.issue;
-import com.google.common.collect.Maps;
import java.util.Date;
+import java.util.HashMap;
import org.sonar.api.resources.Scopes;
import org.sonar.api.rule.Severity;
import org.sonar.api.rules.RuleType;
@@ -54,7 +54,7 @@ public class IssueDocTesting {
}
public static IssueDoc newDoc() {
- IssueDoc doc = new IssueDoc(Maps.newHashMap());
+ IssueDoc doc = new IssueDoc(new HashMap<>());
doc.setKey(Uuids.createFast());
doc.setRuleId(nextInt(1000));
doc.setType(RuleType.CODE_SMELL);
diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java
index f984cd9bd1e..c8e171332a4 100644
--- a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java
+++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginDownloaderTest.java
@@ -306,7 +306,7 @@ public class PluginDownloaderTest {
assertThat(new File(downloadDir, "testdep-1.0.jar")).exists();
}
- class HasFileName implements ArgumentMatcher<File> {
+ static class HasFileName implements ArgumentMatcher<File> {
private final String name;
HasFileName(String name) {
diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginFileSystemTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginFileSystemTest.java
index bc353f99778..05b5a95f81b 100644
--- a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginFileSystemTest.java
+++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/PluginFileSystemTest.java
@@ -40,15 +40,12 @@ public class PluginFileSystemTest {
public TemporaryFolder temp = new TemporaryFolder();
private MapSettings settings = new MapSettings();
- private Path targetJarPath;
- private Path targetFolder;
- private Path sourceFolder;
@Before
public void setUp() throws IOException {
- sourceFolder = temp.newFolder("source").toPath();
- targetFolder = temp.newFolder("target").toPath();
- targetJarPath = targetFolder.resolve("test.jar");
+ Path sourceFolder = temp.newFolder("source").toPath();
+ Path targetFolder = temp.newFolder("target").toPath();
+ Path targetJarPath = targetFolder.resolve("test.jar");
Files.createFile(targetJarPath);
}
diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/UpdateCenterServlet.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/UpdateCenterServlet.java
index d6d9904452d..17c87fa7431 100644
--- a/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/UpdateCenterServlet.java
+++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/plugins/UpdateCenterServlet.java
@@ -20,7 +20,6 @@
package org.sonar.server.plugins;
import javax.servlet.GenericServlet;
-import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImplTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImplTest.java
index 964637487fb..d27267a5c20 100644
--- a/server/sonar-webserver-api/src/test/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImplTest.java
+++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/qualitygate/changeevent/QGChangeEventListenersImplTest.java
@@ -45,7 +45,6 @@ import org.sonar.db.component.ComponentDto;
import org.sonar.server.qualitygate.changeevent.QGChangeEventListener.ChangedIssue;
import org.sonar.server.qualitygate.changeevent.QGChangeEventListenersImpl.ChangedIssueImpl;
-import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.emptySet;
import static java.util.Collections.singletonList;
@@ -307,7 +306,7 @@ public class QGChangeEventListenersImplTest {
.containsOnly(expected);
}
- private static final String[] POSSIBLE_STATUSES = asList(Issue.STATUS_CONFIRMED, Issue.STATUS_REOPENED, Issue.STATUS_RESOLVED).stream().toArray(String[]::new);
+ private static final String[] POSSIBLE_STATUSES = Stream.of(Issue.STATUS_CONFIRMED, Issue.STATUS_REOPENED, Issue.STATUS_RESOLVED).toArray(String[]::new);
private static int issueIdCounter = 0;
private static DefaultIssue newDefaultIssue(String projectUuid) {
diff --git a/server/sonar-webserver-api/src/test/java/org/sonar/server/setting/ProjectConfigurationLoaderImplTest.java b/server/sonar-webserver-api/src/test/java/org/sonar/server/setting/ProjectConfigurationLoaderImplTest.java
index 0fb88ee9b05..523bcd85c8e 100644
--- a/server/sonar-webserver-api/src/test/java/org/sonar/server/setting/ProjectConfigurationLoaderImplTest.java
+++ b/server/sonar-webserver-api/src/test/java/org/sonar/server/setting/ProjectConfigurationLoaderImplTest.java
@@ -54,7 +54,7 @@ public class ProjectConfigurationLoaderImplTest {
private ProjectConfigurationLoaderImpl underTest = new ProjectConfigurationLoaderImpl(globalSettings, dbClient);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(dbClient.openSession(anyBoolean()))
.thenThrow(new IllegalStateException("ProjectConfigurationLoaderImpl should not open DB session"));
when(dbClient.propertiesDao()).thenReturn(propertiesDao);
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/HttpHeadersAuthentication.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/HttpHeadersAuthentication.java
index b0e4203678a..8a23f93fd24 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/HttpHeadersAuthentication.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/HttpHeadersAuthentication.java
@@ -185,7 +185,7 @@ public class HttpHeadersAuthentication implements Startable {
}
private boolean hasHeader(Map<String, String> headerValuesByNames, String settingKey) {
- return headerValuesByNames.keySet().contains(settingsByKey.get(settingKey).toLowerCase(Locale.ENGLISH));
+ return headerValuesByNames.containsKey(settingsByKey.get(settingKey).toLowerCase(Locale.ENGLISH));
}
private static class SsoIdentityProvider implements IdentityProvider {
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileDefinitionsBridge.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileDefinitionsBridge.java
index 58feb3b73f1..5c456259430 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileDefinitionsBridge.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/qualityprofile/BuiltInQProfileDefinitionsBridge.java
@@ -73,7 +73,7 @@ public class BuiltInQProfileDefinitionsBridge implements BuiltInQualityProfilesD
private static void define(Context context, RulesProfile profile) {
NewBuiltInQualityProfile newQp = context.createBuiltInQualityProfile(profile.getName(), profile.getLanguage())
- .setDefault(profile.getDefaultProfile().booleanValue());
+ .setDefault(profile.getDefaultProfile());
for (org.sonar.api.rules.ActiveRule ar : profile.getActiveRules()) {
NewBuiltInActiveRule newActiveRule = newQp.activateRule(ar.getRepositoryKey(), ar.getRuleKey());
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java
index dd016d5cfc1..0fe11caeb4b 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/BaseContextFactoryTest.java
@@ -65,7 +65,7 @@ public class BaseContextFactoryTest {
private BaseContextFactory underTest = new BaseContextFactory(userIdentityAuthenticator, server, jwtHttpHandler, threadLocalUserSession, userSessionFactory);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(server.getPublicRootUrl()).thenReturn(PUBLIC_ROOT_URL);
when(identityProvider.getName()).thenReturn("GitHub");
when(identityProvider.getKey()).thenReturn("github");
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/HttpHeadersAuthenticationTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/HttpHeadersAuthenticationTest.java
index ef3d77e2f35..dd5e89af1b5 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/HttpHeadersAuthenticationTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/HttpHeadersAuthenticationTest.java
@@ -116,7 +116,7 @@ public class HttpHeadersAuthenticationTest {
private HttpHeadersAuthentication underTest = new HttpHeadersAuthentication(system2, settings.asConfig(), userIdentityAuthenticator, jwtHttpHandler, authenticationEvent);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(system2.now()).thenReturn(NOW);
group1 = db.users().insertGroup(db.getDefaultOrganization(), GROUP1);
group2 = db.users().insertGroup(db.getDefaultOrganization(), GROUP2);
@@ -414,7 +414,7 @@ public class HttpHeadersAuthenticationTest {
}
private static void setHeaders(HttpServletRequest request, Map<String, String> valuesByName) {
- valuesByName.entrySet().forEach(entry -> when(request.getHeader(entry.getKey())).thenReturn(entry.getValue()));
+ valuesByName.forEach((key, value) -> when(request.getHeader(key)).thenReturn(value));
when(request.getHeaderNames()).thenReturn(Collections.enumeration(valuesByName.keySet()));
}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/JwtCsrfVerifierTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/JwtCsrfVerifierTest.java
index cdf97bc3b59..0285164bc76 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/JwtCsrfVerifierTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/JwtCsrfVerifierTest.java
@@ -54,7 +54,7 @@ public class JwtCsrfVerifierTest {
private JwtCsrfVerifier underTest = new JwtCsrfVerifier();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(request.getContextPath()).thenReturn("");
}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/JwtHttpHandlerTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/JwtHttpHandlerTest.java
index ed1f5c22084..a25aa0a5ff6 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/JwtHttpHandlerTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/JwtHttpHandlerTest.java
@@ -84,7 +84,7 @@ public class JwtHttpHandlerTest {
private JwtHttpHandler underTest = new JwtHttpHandler(system2, dbClient, settings.asConfig(), jwtSerializer, jwtCsrfVerifier);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(system2.now()).thenReturn(NOW);
when(request.getSession()).thenReturn(httpSession);
when(jwtSerializer.encode(any(JwtSerializer.JwtSession.class))).thenReturn(JWT_TOKEN);
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java
index 07a6fbe79e8..4e4f4b70f67 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2AuthenticationParametersImplTest.java
@@ -45,7 +45,7 @@ public class OAuth2AuthenticationParametersImplTest {
private OAuth2AuthenticationParameters underTest = new OAuth2AuthenticationParametersImpl();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(request.getContextPath()).thenReturn("");
}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java
index 47c745b5d60..3819f227b7f 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2CallbackFilterTest.java
@@ -78,7 +78,7 @@ public class OAuth2CallbackFilterTest {
threadLocalUserSession);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(oAuth2ContextFactory.newCallback(request, response, oAuth2IdentityProvider)).thenReturn(mock(OAuth2IdentityProvider.CallbackContext.class));
when(request.getContextPath()).thenReturn("");
}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java
index 8d5d6229eb4..b15cd73a5e3 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuth2ContextFactoryTest.java
@@ -78,7 +78,7 @@ public class OAuth2ContextFactoryTest {
oAuthParameters);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(request.getSession()).thenReturn(session);
when(identityProvider.getKey()).thenReturn(PROVIDER_KEY);
when(identityProvider.getName()).thenReturn(PROVIDER_NAME);
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java
index d1165e1aea6..496f5f94b34 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/OAuthCsrfVerifierTest.java
@@ -55,7 +55,7 @@ public class OAuthCsrfVerifierTest {
private OAuthCsrfVerifier underTest = new OAuthCsrfVerifier();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(server.getContextPath()).thenReturn("");
when(identityProvider.getName()).thenReturn(PROVIDER_NAME);
}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/RequestAuthenticatorImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/RequestAuthenticatorImplTest.java
index be9a12754db..b7a65aaaf54 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/RequestAuthenticatorImplTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/RequestAuthenticatorImplTest.java
@@ -56,7 +56,7 @@ public class RequestAuthenticatorImplTest {
new CustomAuthentication[]{customAuthentication1, customAuthentication2});
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(sessionFactory.create(A_USER)).thenReturn(new MockUserSession(A_USER));
when(sessionFactory.createAnonymous()).thenReturn(new AnonymousMockUserSession());
}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserSessionInitializerTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserSessionInitializerTest.java
index cac1b7ceaf7..a1de284de7f 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserSessionInitializerTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserSessionInitializerTest.java
@@ -64,7 +64,7 @@ public class UserSessionInitializerTest {
private UserSessionInitializer underTest = new UserSessionInitializer(settings.asConfig(), threadLocalSession, authenticationEvent, authenticator);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(request.getContextPath()).thenReturn("");
when(request.getRequestURI()).thenReturn("/measures");
}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/event/AuthenticationEventImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/event/AuthenticationEventImplTest.java
index 7ea7b9be47a..25a4a209124 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/event/AuthenticationEventImplTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/event/AuthenticationEventImplTest.java
@@ -53,7 +53,7 @@ public class AuthenticationEventImplTest {
private AuthenticationEventImpl underTest = new AuthenticationEventImpl();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
logTester.setLevel(LoggerLevel.DEBUG);
}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQPChangeNotificationTemplateTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQPChangeNotificationTemplateTest.java
index 3324486882b..ca0b822d4f6 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQPChangeNotificationTemplateTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQPChangeNotificationTemplateTest.java
@@ -39,7 +39,7 @@ public class BuiltInQPChangeNotificationTemplateTest {
private BuiltInQPChangeNotificationTemplate underTest = new BuiltInQPChangeNotificationTemplate(server);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(server.getPublicRootUrl()).thenReturn("http://" + randomAlphanumeric(10));
}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileDefinitionsBridgeTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileDefinitionsBridgeTest.java
index 7d0791b2007..7cbd3dad208 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileDefinitionsBridgeTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/qualityprofile/BuiltInQProfileDefinitionsBridgeTest.java
@@ -73,7 +73,7 @@ public class BuiltInQProfileDefinitionsBridgeTest {
.extracting(BuiltInQualityProfilesDefinition.OverriddenParam::key, BuiltInQualityProfilesDefinition.OverriddenParam::overriddenValue).containsOnly(tuple("param", "value"));
}
- private class Profile1 extends ProfileDefinition {
+ private static class Profile1 extends ProfileDefinition {
@Override
public RulesProfile createProfile(ValidationMessages validation) {
RulesProfile profile1 = RulesProfile.create("Profile 1", "xoo");
@@ -89,14 +89,14 @@ public class BuiltInQProfileDefinitionsBridgeTest {
}
}
- private class NullProfile extends ProfileDefinition {
+ private static class NullProfile extends ProfileDefinition {
@Override
public RulesProfile createProfile(ValidationMessages validation) {
return null;
}
}
- private class ProfileWithError extends ProfileDefinition {
+ private static class ProfileWithError extends ProfileDefinition {
@Override
public RulesProfile createProfile(ValidationMessages validation) {
validation.addErrorText("Foo");
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java
index 8db859ef91f..c2e09d39037 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContext.java
@@ -19,12 +19,12 @@
*/
package org.sonar.server.tester;
-import com.google.common.collect.Maps;
import java.io.InputStream;
import java.net.URL;
import java.util.Collections;
import java.util.Enumeration;
import java.util.EventListener;
+import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.servlet.Filter;
@@ -167,7 +167,7 @@ class AttributeHolderServletContext implements ServletContext {
return Collections.enumeration(this.attributes.keySet());
}
- private final Map<String, Object> attributes = Maps.newHashMap();
+ private final Map<String, Object> attributes = new HashMap<>();
@Override
public void setAttribute(String s, Object o) {
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java
index adc98994b25..b6bedbe246d 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/tester/AttributeHolderServletContextTest.java
@@ -28,7 +28,6 @@ import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.SessionTrackingMode;
@@ -84,7 +83,7 @@ public class AttributeHolderServletContextTest {
}
@Test(expected = UnsupportedOperationException.class)
- public void getResource_is_not_supported() throws Exception {
+ public void getResource_is_not_supported() {
servletContext.getResource(SOME_STRING);
}
@@ -106,7 +105,7 @@ public class AttributeHolderServletContextTest {
}
@Test(expected = UnsupportedOperationException.class)
- public void getServlet_is_not_supported() throws ServletException {
+ public void getServlet_is_not_supported() {
servletContext.getServlet(SOME_STRING);
}
@@ -250,7 +249,7 @@ public class AttributeHolderServletContextTest {
}
@Test(expected = UnsupportedOperationException.class)
- public void createServlet_is_not_supported() throws ServletException {
+ public void createServlet_is_not_supported() {
servletContext.createServlet(Servlet.class);
}
@@ -295,7 +294,7 @@ public class AttributeHolderServletContextTest {
}
@Test(expected = UnsupportedOperationException.class)
- public void createFilter_is_not_supported() throws ServletException {
+ public void createFilter_is_not_supported() {
servletContext.createFilter(Filter.class);
}
@@ -346,7 +345,7 @@ public class AttributeHolderServletContextTest {
}
@Test(expected = UnsupportedOperationException.class)
- public void createListener_is_not_supported() throws ServletException {
+ public void createListener_is_not_supported() {
servletContext.createListener(EventListener.class);
}
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java
index d280c1af117..fd38826ebc1 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java
@@ -70,7 +70,7 @@ public class UserUpdaterReactivateTest {
private MapSettings settings = new MapSettings();
private CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient());
private UserUpdater underTest = new UserUpdater(system2, newUserNotifier, dbClient, userIndexer, organizationFlags, defaultOrganizationProvider,
- new DefaultGroupFinder(dbClient), settings.asConfig(), localAuthentication);;
+ new DefaultGroupFinder(dbClient), settings.asConfig(), localAuthentication);
@Test
public void reactivate_user() {
diff --git a/server/sonar-webserver-auth/src/testFixtures/java/org/sonar/server/tester/AbstractMockUserSession.java b/server/sonar-webserver-auth/src/testFixtures/java/org/sonar/server/tester/AbstractMockUserSession.java
index 26c8e103942..d1468d95fbd 100644
--- a/server/sonar-webserver-auth/src/testFixtures/java/org/sonar/server/tester/AbstractMockUserSession.java
+++ b/server/sonar-webserver-auth/src/testFixtures/java/org/sonar/server/tester/AbstractMockUserSession.java
@@ -22,6 +22,7 @@ package org.sonar.server.tester;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableSet;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
@@ -33,7 +34,6 @@ import org.sonar.db.permission.OrganizationPermission;
import org.sonar.server.user.AbstractUserSession;
import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.collect.Maps.newHashMap;
public abstract class AbstractMockUserSession<T extends AbstractMockUserSession> extends AbstractUserSession {
private static final Set<String> PUBLIC_PERMISSIONS = ImmutableSet.of(UserRole.USER, UserRole.CODEVIEWER); // FIXME to check with Simon
@@ -41,7 +41,7 @@ public abstract class AbstractMockUserSession<T extends AbstractMockUserSession>
private final Class<T> clazz;
private HashMultimap<String, String> projectUuidByPermission = HashMultimap.create();
private final HashMultimap<String, OrganizationPermission> permissionsByOrganizationUuid = HashMultimap.create();
- private Map<String, String> projectUuidByComponentUuid = newHashMap();
+ private Map<String, String> projectUuidByComponentUuid = new HashMap<>();
private Set<String> projectPermissions = new HashSet<>();
private Set<String> organizationMembership = new HashSet<>();
private boolean systemAdministrator = false;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java
index 1b99932ed9b..9ae4525969d 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java
@@ -21,7 +21,6 @@ package org.sonar.server.rule;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import java.util.ArrayList;
import java.util.Collection;
@@ -224,7 +223,7 @@ public class RegisterRules implements Startable {
RuleDefinitionDto rule = dbRulesByRuleId.get(ruleId);
if (rule == null) {
LOG.warn("Could not retrieve rule with id %s referenced by a deprecated rule key. " +
- "The following deprecated rule keys seem to be referencing a non-existing rule",
+ "The following deprecated rule keys seem to be referencing a non-existing rule",
ruleId, entry.getValue());
} else {
entry.getValue().forEach(d -> builder.put(d.getOldRuleKeyAsRuleKey(), rule));
@@ -537,7 +536,7 @@ public class RegisterRules implements Startable {
private void mergeParams(RulesDefinition.Rule ruleDef, RuleDefinitionDto rule, DbSession session) {
List<RuleParamDto> paramDtos = dbClient.ruleDao().selectRuleParamsByRuleKey(session, rule.getKey());
- Map<String, RuleParamDto> existingParamsByName = Maps.newHashMap();
+ Map<String, RuleParamDto> existingParamsByName = new HashMap<>();
Profiler profiler = Profiler.create(Loggers.get(getClass()));
for (RuleParamDto paramDto : paramDtos) {
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java
index 615d91cef80..37ead127fa9 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java
@@ -20,7 +20,6 @@
package org.sonar.server.startup;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.Maps;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -113,7 +112,7 @@ public class RegisterMetrics implements Startable {
@VisibleForTesting
List<Metric> getPluginMetrics() {
List<Metric> metricsToRegister = newArrayList();
- Map<String, Metrics> metricsByRepository = Maps.newHashMap();
+ Map<String, Metrics> metricsByRepository = new HashMap<>();
for (Metrics metrics : metricsRepositories) {
checkMetrics(metricsByRepository, metrics);
metricsToRegister.addAll(metrics.getMetrics());
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/debt/DebtModelPluginRepositoryTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/debt/DebtModelPluginRepositoryTest.java
index 5275d006954..702408f7b0e 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/debt/DebtModelPluginRepositoryTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/debt/DebtModelPluginRepositoryTest.java
@@ -20,12 +20,12 @@
package org.sonar.server.debt;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import com.google.common.io.Resources;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.Reader;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
@@ -111,7 +111,7 @@ public class DebtModelPluginRepositoryTest {
}
private void initModel() {
- Map<String, ClassLoader> contributingPluginKeyToClassLoader = Maps.newHashMap();
+ Map<String, ClassLoader> contributingPluginKeyToClassLoader = new HashMap<>();
contributingPluginKeyToClassLoader.put("csharp", newClassLoader());
contributingPluginKeyToClassLoader.put("java", newClassLoader());
underTest = new DebtModelPluginRepository(contributingPluginKeyToClassLoader, TEST_XML_PREFIX_PATH);
@@ -119,15 +119,12 @@ public class DebtModelPluginRepositoryTest {
private ClassLoader newClassLoader() {
ClassLoader loader = mock(ClassLoader.class);
- when(loader.getResourceAsStream(anyString())).thenAnswer(new Answer<InputStream>() {
- public InputStream answer(InvocationOnMock invocation) throws Throwable {
- return new FileInputStream(Resources.getResource((String) invocation.getArguments()[0]).getPath());
- }
- });
+ when(loader.getResourceAsStream(anyString())).thenAnswer(
+ (Answer<InputStream>) invocation -> new FileInputStream(Resources.getResource((String) invocation.getArguments()[0]).getPath()));
return loader;
}
- class FakePlugin implements Plugin {
+ static class FakePlugin implements Plugin {
@Override public void define(Context context) {
}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/es/IndexerStartupTaskTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/es/IndexerStartupTaskTest.java
index de10b8e1905..71a77c31e99 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/es/IndexerStartupTaskTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/es/IndexerStartupTaskTest.java
@@ -47,7 +47,7 @@ public class IndexerStartupTaskTest {
private final IndexerStartupTask underTest = new IndexerStartupTask(es.client(), settings.asConfig(), metadataIndex, indexer);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
doReturn(ImmutableSet.of(TYPE_FAKE)).when(indexer).getIndexTypes();
}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationChannelTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationChannelTest.java
index 9d90900df71..49592d6fc9b 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationChannelTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationChannelTest.java
@@ -34,7 +34,7 @@ public class NotificationChannelTest {
assertThat(channel.toString()).isEqualTo("FakeNotificationChannel");
}
- private class FakeNotificationChannel extends NotificationChannel {
+ private static class FakeNotificationChannel extends NotificationChannel {
@Override
public boolean deliver(Notification notification, String username) {
return true;
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationDaemonTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationDaemonTest.java
index 8a24e6b092c..499b1f8e135 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationDaemonTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationDaemonTest.java
@@ -42,7 +42,7 @@ public class NotificationDaemonTest {
private InOrder inOrder;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
MapSettings settings = new MapSettings(new PropertyDefinitions(NotificationDaemon.class)).setProperty("sonar.notifications.delay", 1L);
underTest = new NotificationDaemon(settings.asConfig(), manager, notificationService);
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DefaultServerUpgradeStatusTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DefaultServerUpgradeStatusTest.java
index 050fc56cbac..c5782c68e5c 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DefaultServerUpgradeStatusTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/DefaultServerUpgradeStatusTest.java
@@ -39,7 +39,7 @@ public class DefaultServerUpgradeStatusTest {
private DefaultServerUpgradeStatus underTest = new DefaultServerUpgradeStatus(dbVersion, migrationSteps, new ConfigurationBridge(settings));
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(migrationSteps.getMaxMigrationNumber()).thenReturn(LAST_VERSION);
}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdManagerTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdManagerTest.java
index 0875ad0fcb2..ed0919cffff 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdManagerTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdManagerTest.java
@@ -346,7 +346,7 @@ public class ServerIdManagerTest {
}
private void insertServerId(String serverId) {
- dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto().setKey(CoreProperties.SERVER_ID).setValue(serverId.toString()));
+ dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto().setKey(CoreProperties.SERVER_ID).setValue(serverId));
dbSession.commit();
}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/qualitygate/ProjectsInWarningDaemonTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/qualitygate/ProjectsInWarningDaemonTest.java
index b86a3a547a2..07f543ac10c 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/qualitygate/ProjectsInWarningDaemonTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/qualitygate/ProjectsInWarningDaemonTest.java
@@ -72,7 +72,7 @@ public class ProjectsInWarningDaemonTest {
private ProjectsInWarningDaemon underTest = new ProjectsInWarningDaemon(db.getDbClient(), projectMeasuresIndex, settings.asConfig(), lockManager, projectsInWarning);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
settings.setProperty("sonar.projectsInWarning.frequencyInMilliseconds", "100");
}
@@ -100,7 +100,6 @@ public class ProjectsInWarningDaemonTest {
public void update_projects_in_warning_when_new_project_in_warning() throws InterruptedException {
allowLockToBeAcquired();
MetricDto qualityGateStatus = insertQualityGateStatusMetric();
- ;
insertProjectInWarning(qualityGateStatus);
insertProjectInWarning(qualityGateStatus);
// Setting does not exist
@@ -118,7 +117,6 @@ public class ProjectsInWarningDaemonTest {
public void stop_thread_when_number_of_projects_in_warning_reach_zero() throws InterruptedException {
allowLockToBeAcquired();
MetricDto qualityGateStatus = insertQualityGateStatusMetric();
- ;
ComponentDto project = insertProjectInWarning(qualityGateStatus);
underTest.notifyStart();
@@ -167,7 +165,6 @@ public class ProjectsInWarningDaemonTest {
public void do_not_compute_projects_in_warning_when_internal_property_is_zero() throws InterruptedException {
allowLockToBeAcquired();
MetricDto qualityGateStatus = insertQualityGateStatusMetric();
- ;
insertProjectInWarning(qualityGateStatus);
// Setting contains 0, even if there are projects in warning it will stay 0 (as it's not possible to have new projects in warning)
db.getDbClient().internalPropertiesDao().save(db.getSession(), PROJECTS_IN_WARNING_INTERNAL_PROPERTY, "0");
@@ -183,7 +180,6 @@ public class ProjectsInWarningDaemonTest {
public void do_not_store_projects_in_warning_in_db_when_cannot_acquire_lock() throws InterruptedException {
when(lockManager.tryLock(any(), anyInt())).thenReturn(false);
MetricDto qualityGateStatus = insertQualityGateStatusMetric();
- ;
insertProjectInWarning(qualityGateStatus);
underTest.notifyStart();
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/CachingRuleFinderTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/CachingRuleFinderTest.java
index 6c19c1a0ef0..7dbd209503e 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/CachingRuleFinderTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/CachingRuleFinderTest.java
@@ -408,7 +408,7 @@ public class CachingRuleFinderTest {
assertThat(rule.getUpdatedAt().getTime()).isEqualTo(ruleDefinition.getUpdatedAt());
assertThat(rule.getRepositoryKey()).isEqualTo(ruleDefinition.getRepositoryKey());
assertThat(rule.getSeverity().name()).isEqualTo(ruleDefinition.getSeverityString());
- assertThat(rule.getSystemTags()).isEqualTo(ruleDefinition.getSystemTags().stream().toArray(String[]::new));
+ assertThat(rule.getSystemTags()).isEqualTo(ruleDefinition.getSystemTags().toArray(new String[0]));
assertThat(rule.getTags()).isEmpty();
assertThat(rule.getId()).isEqualTo(ruleDefinition.getId());
assertThat(rule.getDescription()).isEqualTo(ruleDefinition.getDescription());
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java
index 43987b4889f..b1401160563 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java
@@ -367,7 +367,7 @@ public class RegisterRulesTest {
@Test
public void add_new_tag() {
- execute((RulesDefinition) context -> {
+ execute(context -> {
NewRepository repo = context.createRepository("fake", "java");
repo.createRule("rule1")
.setName("Rule One")
@@ -380,7 +380,7 @@ public class RegisterRulesTest {
RuleDto rule = dbClient.ruleDao().selectOrFailByKey(db.getSession(), defaultOrganization, RULE_KEY1);
assertThat(rule.getSystemTags()).containsOnly("tag1");
- execute((RulesDefinition) context -> {
+ execute(context -> {
NewRepository repo = context.createRepository("fake", "java");
repo.createRule("rule1")
.setName("Rule One")
@@ -395,7 +395,7 @@ public class RegisterRulesTest {
@Test
public void add_new_security_standards() {
- execute((RulesDefinition) context -> {
+ execute(context -> {
NewRepository repo = context.createRepository("fake", "java");
repo.createRule("rule1")
.setName("Rule One")
@@ -409,7 +409,7 @@ public class RegisterRulesTest {
RuleDto rule = dbClient.ruleDao().selectOrFailByKey(db.getSession(), defaultOrganization, RULE_KEY1);
assertThat(rule.getSecurityStandards()).containsOnly("cwe:123", "owaspTop10:a1");
- execute((RulesDefinition) context -> {
+ execute(context -> {
NewRepository repo = context.createRepository("fake", "java");
repo.createRule("rule1")
.setName("Rule One")
@@ -426,7 +426,7 @@ public class RegisterRulesTest {
@Test
public void update_only_rule_name() {
when(system.now()).thenReturn(DATE1.getTime());
- execute((RulesDefinition) context -> {
+ execute(context -> {
NewRepository repo = context.createRepository("fake", "java");
repo.createRule("rule")
.setName("Name1")
@@ -435,7 +435,7 @@ public class RegisterRulesTest {
});
when(system.now()).thenReturn(DATE2.getTime());
- execute((RulesDefinition) context -> {
+ execute(context -> {
NewRepository repo = context.createRepository("fake", "java");
repo.createRule("rule")
.setName("Name2")
@@ -459,8 +459,8 @@ public class RegisterRulesTest {
String repository = "fake";
when(system.now()).thenReturn(DATE1.getTime());
- execute((RulesDefinition) context -> {
- RulesDefinition.NewRepository repo = context.createRepository(repository, "java");
+ execute(context -> {
+ NewRepository repo = context.createRepository(repository, "java");
repo.createRule(ruleKey1)
.setName("Name1")
.setHtmlDescription("Description");
@@ -473,8 +473,8 @@ public class RegisterRulesTest {
assertThat(searchRule1.getTotal()).isEqualTo(1);
when(system.now()).thenReturn(DATE2.getTime());
- execute((RulesDefinition) context -> {
- RulesDefinition.NewRepository repo = context.createRepository(repository, "java");
+ execute(context -> {
+ NewRepository repo = context.createRepository(repository, "java");
repo.createRule(ruleKey2)
.setName("Name2")
.setHtmlDescription("Description")
@@ -501,8 +501,8 @@ public class RegisterRulesTest {
String repository2 = "fake2";
when(system.now()).thenReturn(DATE1.getTime());
- execute((RulesDefinition) context -> {
- RulesDefinition.NewRepository repo = context.createRepository(repository1, "java");
+ execute(context -> {
+ NewRepository repo = context.createRepository(repository1, "java");
repo.createRule(ruleKey)
.setName("Name1")
.setHtmlDescription("Description");
@@ -515,8 +515,8 @@ public class RegisterRulesTest {
assertThat(searchRule1.getTotal()).isEqualTo(1);
when(system.now()).thenReturn(DATE2.getTime());
- execute((RulesDefinition) context -> {
- RulesDefinition.NewRepository repo = context.createRepository(repository2, "java");
+ execute(context -> {
+ NewRepository repo = context.createRepository(repository2, "java");
repo.createRule(ruleKey)
.setName("Name2")
.setHtmlDescription("Description")
@@ -542,8 +542,8 @@ public class RegisterRulesTest {
String name = "Name1";
String description = "Description";
when(system.now()).thenReturn(DATE1.getTime());
- execute((RulesDefinition) context -> {
- RulesDefinition.NewRepository repo = context.createRepository(repo1, "java");
+ execute(context -> {
+ NewRepository repo = context.createRepository(repo1, "java");
repo.createRule(ruleKey1)
.setName(name)
.setHtmlDescription(description);
@@ -555,8 +555,8 @@ public class RegisterRulesTest {
.containsOnly(rule1.getId());
when(system.now()).thenReturn(DATE2.getTime());
- execute((RulesDefinition) context -> {
- RulesDefinition.NewRepository repo = context.createRepository(repo2, "java");
+ execute(context -> {
+ NewRepository repo = context.createRepository(repo2, "java");
repo.createRule(ruleKey2)
.setName(name)
.setHtmlDescription(description)
@@ -591,8 +591,8 @@ public class RegisterRulesTest {
String repository2 = "fake2";
when(system.now()).thenReturn(DATE1.getTime());
- execute((RulesDefinition) context -> {
- RulesDefinition.NewRepository repo = context.createRepository(repository1, "java");
+ execute(context -> {
+ NewRepository repo = context.createRepository(repository1, "java");
repo.createRule(ruleKey1)
.setName("Name1")
.setHtmlDescription("Description");
@@ -604,8 +604,8 @@ public class RegisterRulesTest {
.containsOnly(rule1.getId());
when(system.now()).thenReturn(DATE2.getTime());
- execute((RulesDefinition) context -> {
- RulesDefinition.NewRepository repo = context.createRepository(repository2, "java");
+ execute(context -> {
+ NewRepository repo = context.createRepository(repository2, "java");
repo.createRule(ruleKey2)
.setName("Name2")
.setHtmlDescription("Description")
@@ -626,7 +626,7 @@ public class RegisterRulesTest {
@Test
public void update_only_rule_description() {
when(system.now()).thenReturn(DATE1.getTime());
- execute((RulesDefinition) context -> {
+ execute(context -> {
NewRepository repo = context.createRepository("fake", "java");
repo.createRule("rule")
.setName("Name")
@@ -635,7 +635,7 @@ public class RegisterRulesTest {
});
when(system.now()).thenReturn(DATE2.getTime());
- execute((RulesDefinition) context -> {
+ execute(context -> {
NewRepository repo = context.createRepository("fake", "java");
repo.createRule("rule")
.setName("Name")
@@ -656,7 +656,7 @@ public class RegisterRulesTest {
public void rule_previously_created_as_adhoc_becomes_none_adhoc() {
RuleDefinitionDto rule = db.rules().insert(r -> r.setRepositoryKey("external_fake").setIsExternal(true).setIsAdHoc(true));
when(system.now()).thenReturn(DATE2.getTime());
- execute((RulesDefinition) context -> {
+ execute(context -> {
NewRepository repo = context.createExternalRepository("fake", rule.getLanguage());
repo.createRule(rule.getRuleKey())
.setName(rule.getName())
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/WebServerRuleFinderImplTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/WebServerRuleFinderImplTest.java
index 5fdac77d9e8..80fe7bce48c 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/WebServerRuleFinderImplTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/WebServerRuleFinderImplTest.java
@@ -37,7 +37,7 @@ public class WebServerRuleFinderImplTest {
private WebServerRuleFinderImpl underTest = new WebServerRuleFinderImpl(dbClient, defaultOrganizationProvider);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(dbClient.ruleDao()).thenReturn(mock(RuleDao.class));
}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/search/BaseDocTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/search/BaseDocTest.java
index 450bf1b96d2..9c09a330891 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/search/BaseDocTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/search/BaseDocTest.java
@@ -20,9 +20,9 @@
package org.sonar.server.search;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
import java.util.Collections;
import java.util.Date;
+import java.util.HashMap;
import java.util.Map;
import org.junit.Rule;
import org.junit.Test;
@@ -43,7 +43,7 @@ public class BaseDocTest {
@Test
public void getField() {
- Map<String, Object> fields = Maps.newHashMap();
+ Map<String, Object> fields = new HashMap<>();
fields.put("a_string", "foo");
fields.put("a_int", 42);
fields.put("a_null", null);
@@ -81,7 +81,7 @@ public class BaseDocTest {
@Test
public void getFieldAsDate() {
- BaseDoc doc = new BaseDoc(someType, Maps.newHashMap()) {
+ BaseDoc doc = new BaseDoc(someType, new HashMap<>()) {
@Override
public String getId() {
return null;
@@ -98,7 +98,7 @@ public class BaseDocTest {
@Test
public void getNullableFieldAsDate() {
- BaseDoc doc = new BaseDoc(someType, Maps.newHashMap()) {
+ BaseDoc doc = new BaseDoc(someType, new HashMap<>()) {
@Override
public String getId() {
return null;
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/startup/RegisterMetricsTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/startup/RegisterMetricsTest.java
index b5fc51496cd..7bbac6a2b2b 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/startup/RegisterMetricsTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/startup/RegisterMetricsTest.java
@@ -196,7 +196,7 @@ public class RegisterMetricsTest {
new RegisterMetrics(dbClient, new Metrics[] {plugin}).start();
}
- private class TestMetrics implements Metrics {
+ private static class TestMetrics implements Metrics {
private final List<Metric> metrics;
public TestMetrics(Metric... metrics) {
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java
index 079be37fd2b..31f7f87e2ed 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/webhook/WebhookQGChangeEventListenerTest.java
@@ -107,8 +107,8 @@ public class WebhookQGChangeEventListenerTest {
.toArray(Metric.Level[]::new);
Object[][] res = new Object[levelsAndNull.length * levelsAndNull.length][2];
int i = 0;
- for (Metric.Level previousStatus : Arrays.asList(levelsAndNull)) {
- for (Metric.Level newStatus : Arrays.asList(levelsAndNull)) {
+ for (Metric.Level previousStatus : levelsAndNull) {
+ for (Metric.Level newStatus : levelsAndNull) {
res[i][0] = previousStatus;
res[i][1] = newStatus;
i++;
diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java b/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java
index 0a45e823dbe..afa9977ca48 100644
--- a/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java
+++ b/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexCreator.java
@@ -114,7 +114,7 @@ public class IndexCreator implements Startable {
String indexName = mainType.getIndex().getName();
String readOnly = client.nativeClient().admin().indices().getSettings(new GetSettingsRequest().indices(indexName)).actionGet()
.getSetting(indexName, "index.blocks.read_only_allow_delete");
- return readOnly != null && "true".equalsIgnoreCase(readOnly);
+ return "true".equalsIgnoreCase(readOnly);
}
private void removeReadOnly(IndexType.IndexMainType mainType) {
diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexDefinitions.java b/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexDefinitions.java
index 22b8b59b0c3..bbd8b1dbd39 100644
--- a/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexDefinitions.java
+++ b/server/sonar-webserver-es/src/main/java/org/sonar/server/es/IndexDefinitions.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.es;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.Map;
import org.picocontainer.Startable;
import org.sonar.api.config.Configuration;
@@ -33,7 +33,7 @@ import org.sonar.server.es.newindex.NewIndex;
@ServerSide
public class IndexDefinitions implements Startable {
- private final Map<String, BuiltIndex> byKey = Maps.newHashMap();
+ private final Map<String, BuiltIndex> byKey = new HashMap<>();
private final IndexDefinition[] defs;
private final Configuration config;
diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java b/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java
index 295c8576cb2..6406a47025b 100644
--- a/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java
+++ b/server/sonar-webserver-es/src/main/java/org/sonar/server/issue/index/IssueIndex.java
@@ -510,7 +510,7 @@ public class IssueIndex {
String facetName = ASSIGNEES.getName();
// Same as in super.stickyFacetBuilder
- Map<String, QueryBuilder> assigneeFilters = Maps.newHashMap(filters);
+ Map<String, QueryBuilder> assigneeFilters = new HashMap<>(filters);
assigneeFilters.remove(IS_ASSIGNED_FILTER);
assigneeFilters.remove(fieldName);
StickyFacetBuilder stickyFacetBuilder = newStickyFacetBuilder(query, assigneeFilters, queryBuilder);
@@ -895,8 +895,8 @@ public class IssueIndex {
private static AggregationBuilder createAggregation(String categoryField, String category, boolean includeCwe, Optional<Map<String, Set<String>>> categoryToCwesMap) {
return addSecurityReportSubAggregations(AggregationBuilders
- .filter(category, boolQuery()
- .filter(termQuery(categoryField, category))),
+ .filter(category, boolQuery()
+ .filter(termQuery(categoryField, category))),
includeCwe, categoryToCwesMap.map(m -> m.get(category)));
}
diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/es/RecoveryIndexerTest.java b/server/sonar-webserver-es/src/test/java/org/sonar/server/es/RecoveryIndexerTest.java
index 8f9bf8b324f..d680ccbd0a4 100644
--- a/server/sonar-webserver-es/src/test/java/org/sonar/server/es/RecoveryIndexerTest.java
+++ b/server/sonar-webserver-es/src/test/java/org/sonar/server/es/RecoveryIndexerTest.java
@@ -450,7 +450,7 @@ public class RecoveryIndexerTest {
}
}
- private class HardFailingFakeIndexer implements ResilientIndexer {
+ private static class HardFailingFakeIndexer implements ResilientIndexer {
private final Set<IndexType> types;
private final List<Collection<EsQueueDto>> called = new ArrayList<>();
@@ -476,7 +476,7 @@ public class RecoveryIndexerTest {
}
}
- private class SoftFailingFakeIndexer implements ResilientIndexer {
+ private static class SoftFailingFakeIndexer implements ResilientIndexer {
private final Set<IndexType> types;
private final List<Collection<EsQueueDto>> called = new ArrayList<>();
diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java b/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java
index 1dda0b4e89a..d7070fad5bb 100644
--- a/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java
+++ b/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java
@@ -391,8 +391,7 @@ public class PermissionIndexerTest {
}
private ComponentDto createUnindexedPublicProject() {
- ComponentDto project = db.components().insertPublicProject();
- return project;
+ return db.components().insertPublicProject();
}
private ComponentDto createAndIndexPrivateProject() {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/IssuesAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/IssuesAction.java
index b1f127ef490..a4005789e54 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/IssuesAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/IssuesAction.java
@@ -23,6 +23,7 @@ import com.google.common.base.Splitter;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.sonar.api.resources.Scopes;
@@ -42,7 +43,6 @@ import org.sonar.server.user.UserSession;
import org.sonarqube.ws.MediaTypes;
import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.collect.Maps.newHashMap;
import static java.lang.String.format;
import static java.util.Optional.ofNullable;
import static java.util.stream.Collectors.toList;
@@ -160,7 +160,7 @@ public class IssuesAction implements BatchWsAction {
}
private Map<String, String> keysByUUid(DbSession session, ComponentDto component) {
- Map<String, String> keysByUUid = newHashMap();
+ Map<String, String> keysByUUid = new HashMap<>();
if (Scopes.PROJECT.equals(component.scope())) {
List<ComponentDto> modulesTree = dbClient.componentDao().selectDescendantModules(session, component.uuid());
for (ComponentDto componentDto : modulesTree) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/ProjectDataLoader.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/ProjectDataLoader.java
index a262c8f7121..0947915b3b7 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/ProjectDataLoader.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/batch/ProjectDataLoader.java
@@ -20,6 +20,7 @@
package org.sonar.server.batch;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
@@ -39,7 +40,6 @@ import org.sonar.server.component.ComponentFinder;
import org.sonar.server.exceptions.ForbiddenException;
import org.sonar.server.user.UserSession;
-import static com.google.common.collect.Maps.newHashMap;
import static org.sonar.process.ProcessProperties.Property.SONARCLOUD_ENABLED;
import static org.sonar.server.exceptions.BadRequestException.checkRequest;
@@ -98,7 +98,7 @@ public class ProjectDataLoader {
}
private static void addFileDataPerModule(MultiModuleProjectRepository data, List<ComponentDto> moduleChildren, List<FilePathWithHashDto> files) {
- Map<String, String> moduleKeysByUuid = newHashMap();
+ Map<String, String> moduleKeysByUuid = new HashMap<>();
for (ComponentDto module : moduleChildren) {
moduleKeysByUuid.put(module.uuid(), module.getKey());
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/IssuesFinderSort.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/IssuesFinderSort.java
index 3694122ddfe..d7724ecc73a 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/IssuesFinderSort.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/IssuesFinderSort.java
@@ -84,12 +84,7 @@ class IssuesFinderSort {
abstract static class TextSortIssueProcessor implements IssueProcessor {
@Override
public Function sortFieldFunction() {
- return new Function<IssueDto, String>() {
- @Override
- public String apply(IssueDto issueDto) {
- return sortField(issueDto);
- }
- };
+ return (Function<IssueDto, String>) this::sortField;
}
abstract String sortField(IssueDto issueDto);
@@ -130,12 +125,7 @@ class IssuesFinderSort {
abstract static class DateSortRowProcessor implements IssueProcessor {
@Override
public Function sortFieldFunction() {
- return new Function<IssueDto, Date>() {
- @Override
- public Date apply(IssueDto issueDto) {
- return sortField(issueDto);
- }
- };
+ return (Function<IssueDto, Date>) this::sortField;
}
abstract Date sortField(IssueDto issueDto);
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/Result.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/Result.java
index 4d09fa750ab..9a95f873d22 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/Result.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/Result.java
@@ -32,7 +32,7 @@ import static com.google.common.collect.Lists.newArrayList;
*/
public class Result<T> {
- private T object = null;
+ private T object;
private final List<Message> errors = newArrayList();
private Result(@Nullable T object) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java
index 1144a6f83a0..5d6735c96d1 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java
@@ -258,7 +258,7 @@ public class SearchAction implements IssuesWsAction, Startable {
action.createParam(PARAM_TYPES)
.setDescription("Comma-separated list of types.")
.setSince("5.5")
- .setPossibleValues((Object[]) RuleType.values())
+ .setPossibleValues(RuleType.values())
.setExampleValue(format("%s,%s", RuleType.CODE_SMELL, RuleType.BUG));
action.createParam(PARAM_OWASP_TOP_10)
.setDescription("Comma-separated list of OWASP Top 10 lowercase categories.")
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseData.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseData.java
index 15b2c5f0c01..efd6413abed 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseData.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchResponseData.java
@@ -185,10 +185,6 @@ public class SearchResponseData {
@CheckForNull
UserDto getUserByUuid(@Nullable String userUuid) {
- UserDto userDto = usersByUuid.get(userUuid);
- if (userDto == null) {
- return null;
- }
- return userDto;
+ return usersByUuid.get(userUuid);
}
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java
index 436eba98c33..e125040bc3f 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SetTagsAction.java
@@ -92,7 +92,7 @@ public class SetTagsAction implements IssuesWsAction {
@Override
public void handle(Request request, Response response) throws Exception {
String key = request.mandatoryParam(PARAM_ISSUE);
- List<String> tags = MoreObjects.firstNonNull(request.paramAsStrings(PARAM_TAGS), Collections.<String>emptyList());
+ List<String> tags = MoreObjects.firstNonNull(request.paramAsStrings(PARAM_TAGS), Collections.emptyList());
SearchResponseData preloadedSearchResponseData = setTags(key, tags);
responseWriter.write(key, preloadedSearchResponseData, request, response);
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/custom/ws/CustomMeasureJsonWriter.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/custom/ws/CustomMeasureJsonWriter.java
index 41098e90d5e..32817d8df51 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/custom/ws/CustomMeasureJsonWriter.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/custom/ws/CustomMeasureJsonWriter.java
@@ -83,7 +83,7 @@ public class CustomMeasureJsonWriter {
private static String measureValue(CustomMeasureDto measure, MetricDto metric) {
Metric.ValueType metricType = Metric.ValueType.valueOf(metric.getValueType());
- Double doubleValue = measure.getValue();
+ double doubleValue = measure.getValue();
String stringValue = measure.getTextValue();
switch (metricType) {
@@ -91,9 +91,8 @@ public class CustomMeasureJsonWriter {
return doubleValue == 1.0d ? "true" : "false";
case INT:
case MILLISEC:
- return String.valueOf(doubleValue.intValue());
+ return String.valueOf((int) doubleValue);
case WORK_DUR:
- return String.valueOf(doubleValue.longValue());
case FLOAT:
case PERCENT:
case RATING:
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/MeasureMatrix.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/MeasureMatrix.java
index 7dac198818c..a6c51580fae 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/MeasureMatrix.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/live/MeasureMatrix.java
@@ -103,7 +103,7 @@ class MeasureMatrix {
void setValue(ComponentDto component, String metricKey, Rating value) {
changeCell(component, metricKey, m -> {
Double initialValue = m.getValue();
- if (initialValue != null && Double.compare(initialValue, (double) value.getIndex()) == 0) {
+ if (initialValue != null && Double.compare(initialValue, value.getIndex()) == 0) {
return false;
}
m.setData(value.name());
@@ -141,7 +141,7 @@ class MeasureMatrix {
}
void setLeakValue(ComponentDto component, String metricKey, Rating variation) {
- setLeakValue(component, metricKey, (double) variation.getIndex());
+ setLeakValue(component, metricKey, variation.getIndex());
}
Stream<LiveMeasureDto> getChanged() {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java
index 9f885f3214d..d8400dfbb6a 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java
@@ -91,8 +91,8 @@ public class ComponentAction implements MeasuresWsAction {
@Override
public void define(WebService.NewController context) {
WebService.NewAction action = context.createAction(ACTION_COMPONENT)
- .setDescription(format("Return component with specified measures.<br>" +
- "Requires the following permission: 'Browse' on the project of specified component."))
+ .setDescription("Return component with specified measures.<br>" +
+ "Requires the following permission: 'Browse' on the project of specified component.")
.setResponseExample(getClass().getResource("component-example.json"))
.setSince("5.4")
.setChangelog(
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/notification/ws/ListAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/notification/ws/ListAction.java
index 015742db8f8..c4b9e898ef9 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/notification/ws/ListAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/notification/ws/ListAction.java
@@ -136,8 +136,8 @@ public class ListAction implements NotificationsWsAction {
.filter(isComponentInDb)
.map(toWsNotification(notification, organizationsByUuid, componentsById))
.sorted(comparing(Notification::getProject, nullsFirst(naturalOrder()))
- .thenComparing(comparing(Notification::getChannel))
- .thenComparing(comparing(Notification::getType)))
+ .thenComparing(Notification::getChannel)
+ .thenComparing(Notification::getType))
.forEach(response::addNotifications);
return response;
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/UpdateAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/UpdateAction.java
index fcfbdf0cdeb..b1f56aba029 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/UpdateAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/organization/ws/UpdateAction.java
@@ -119,7 +119,7 @@ public class UpdateAction implements OrganizationsWsAction {
private OrganizationDto getDto(DbSession dbSession, String key) {
Optional<OrganizationDto> organizationDto = dbClient.organizationDao().selectByKey(dbSession, key);
if (!organizationDto.isPresent()) {
- throw new NotFoundException(format("Organization not found for key '%s'", (Object) key));
+ throw new NotFoundException(format("Organization not found for key '%s'", key));
}
return organizationDto.get();
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/DbMigrationStatusAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/DbMigrationStatusAction.java
index aeecbd20b92..f6a84af15ca 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/DbMigrationStatusAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/DbMigrationStatusAction.java
@@ -68,8 +68,7 @@ public class DbMigrationStatusAction implements SystemWsAction {
Optional<Long> currentVersion = databaseVersion.getVersion();
checkState(currentVersion.isPresent(), NO_CONNECTION_TO_DB);
- JsonWriter json = response.newJsonWriter();
- try {
+ try (JsonWriter json = response.newJsonWriter()) {
DatabaseVersion.Status status = databaseVersion.getStatus();
if (status == DatabaseVersion.Status.UP_TO_DATE || status == DatabaseVersion.Status.REQUIRES_DOWNGRADE) {
write(json, databaseMigrationState);
@@ -89,8 +88,6 @@ public class DbMigrationStatusAction implements SystemWsAction {
throw new IllegalArgumentException(UNSUPPORTED_DATABASE_MIGRATION_STATUS);
}
}
- } finally {
- json.close();
}
}
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/MigrateDbAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/MigrateDbAction.java
index 3f0b3be8010..949de46d33d 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/MigrateDbAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/platform/ws/MigrateDbAction.java
@@ -76,8 +76,7 @@ public class MigrateDbAction implements SystemWsAction {
Optional<Long> currentVersion = databaseVersion.getVersion();
checkState(currentVersion.isPresent(), NO_CONNECTION_TO_DB);
- JsonWriter json = response.newJsonWriter();
- try {
+ try (JsonWriter json = response.newJsonWriter()) {
DatabaseVersion.Status status = databaseVersion.getStatus();
if (status == DatabaseVersion.Status.UP_TO_DATE || status == DatabaseVersion.Status.REQUIRES_DOWNGRADE) {
write(json, migrationState);
@@ -98,8 +97,6 @@ public class MigrateDbAction implements SystemWsAction {
throw new IllegalArgumentException(UNSUPPORTED_DATABASE_MIGRATION_STATUS);
}
}
- } finally {
- json.close();
}
}
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java
index df2e98b29e7..45ad0e16390 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/AvailableAction.java
@@ -68,7 +68,7 @@ public class AvailableAction implements PluginsWsAction {
}
@Override
- public void handle(Request request, Response response) throws Exception {
+ public void handle(Request request, Response response) {
userSession.checkIsSystemAdministrator();
JsonWriter jsonWriter = response.newJsonWriter();
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PluginUpdateAggregator.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PluginUpdateAggregator.java
index 50efcf6588d..992af65a1a2 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PluginUpdateAggregator.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/plugins/ws/PluginUpdateAggregator.java
@@ -22,9 +22,9 @@ package org.sonar.server.plugins.ws;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
@@ -43,7 +43,7 @@ public class PluginUpdateAggregator {
return Collections.emptyList();
}
- Map<Plugin, PluginUpdateAggregateBuilder> builders = Maps.newHashMap();
+ Map<Plugin, PluginUpdateAggregateBuilder> builders = new HashMap<>();
for (PluginUpdate pluginUpdate : pluginUpdates) {
Plugin plugin = pluginUpdate.getPlugin();
PluginUpdateAggregateBuilder builder = builders.get(plugin);
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java
index 01a960c6061..ac0ffa53337 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/SearchAction.java
@@ -33,7 +33,6 @@ import org.sonar.api.server.ws.WebService.Param;
import org.sonar.api.web.UserRole;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
-import org.sonar.db.component.BranchDao;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.SnapshotDto;
import org.sonar.db.component.SnapshotQuery;
@@ -65,13 +64,11 @@ public class SearchAction implements ProjectAnalysesWsAction {
private final DbClient dbClient;
private final ComponentFinder componentFinder;
private final UserSession userSession;
- private final BranchDao branchDao;
- public SearchAction(DbClient dbClient, ComponentFinder componentFinder, UserSession userSession, BranchDao branchDao) {
+ public SearchAction(DbClient dbClient, ComponentFinder componentFinder, UserSession userSession) {
this.dbClient = dbClient;
this.componentFinder = componentFinder;
this.userSession = userSession;
- this.branchDao = branchDao;
}
@Override
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java
index fb9400b9525..57877966536 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java
@@ -231,10 +231,9 @@ public class QualityGateConditionsUpdater {
return isNullOrEmpty(value) || RATING_VALID_INT_VALUES.contains(value);
}
- @SuppressWarnings("unchecked")
private static boolean check(boolean expression, List<String> errors, String message, String... args) {
if (!expression) {
- errors.add(format(message, (Object[]) args));
+ errors.add(format(message, args));
}
return expression;
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileComparison.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileComparison.java
index 03bd79fcd43..a214e334dcb 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileComparison.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/QProfileComparison.java
@@ -93,10 +93,10 @@ public class QProfileComparison {
private final QProfileDto left;
private final QProfileDto right;
- private final Map<RuleKey, ActiveRuleDto> inLeft = Maps.newHashMap();
- private final Map<RuleKey, ActiveRuleDto> inRight = Maps.newHashMap();
- private final Map<RuleKey, ActiveRuleDiff> modified = Maps.newHashMap();
- private final Map<RuleKey, ActiveRuleDto> same = Maps.newHashMap();
+ private final Map<RuleKey, ActiveRuleDto> inLeft = new HashMap<>();
+ private final Map<RuleKey, ActiveRuleDto> inRight = new HashMap<>();
+ private final Map<RuleKey, ActiveRuleDiff> modified = new HashMap<>();
+ private final Map<RuleKey, ActiveRuleDto> same = new HashMap<>();
public QProfileComparisonResult(QProfileDto left, QProfileDto right) {
this.left = left;
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/NewCustomRule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/NewCustomRule.java
index e64880ceb07..67171f4cec9 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/NewCustomRule.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/NewCustomRule.java
@@ -21,7 +21,7 @@ package org.sonar.server.rule;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.Map;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
@@ -39,7 +39,7 @@ public class NewCustomRule {
private String severity;
private RuleStatus status;
private RuleType type;
- private final Map<String, String> parameters = Maps.newHashMap();
+ private final Map<String, String> parameters = new HashMap<>();
private boolean preventReactivation = false;
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/RuleUpdate.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/RuleUpdate.java
index 9df29ada1a9..2d1a8dfcddb 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/RuleUpdate.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/RuleUpdate.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.rule;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.annotation.CheckForNull;
@@ -55,7 +55,7 @@ public class RuleUpdate {
private String markdownDescription;
private String severity;
private RuleStatus status;
- private final Map<String, String> parameters = Maps.newHashMap();
+ private final Map<String, String> parameters = new HashMap<>();
private OrganizationDto organization;
private RuleUpdate(RuleKey ruleKey, RuleUpdateUseCase useCase) {
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java
index 94d70e4ba5f..f02babaef76 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/CurrentAction.java
@@ -168,7 +168,7 @@ public class CurrentAction implements UsersWsAction {
}
private Optional<CurrentWsResponse.Homepage> projectHomepage(DbSession dbSession, UserDto user) {
- Optional<ComponentDto> projectOptional = ofNullable(dbClient.componentDao().selectByUuid(dbSession, of(user.getHomepageParameter()).orElse(EMPTY)).orElse(null));
+ Optional<ComponentDto> projectOptional = dbClient.componentDao().selectByUuid(dbSession, of(user.getHomepageParameter()).orElse(EMPTY));
if (shouldCleanProjectHomepage(projectOptional)) {
cleanUserHomepageInDb(dbSession, user);
return empty();
@@ -186,7 +186,7 @@ public class CurrentAction implements UsersWsAction {
}
private Optional<CurrentWsResponse.Homepage> applicationAndPortfolioHomepage(DbSession dbSession, UserDto user) {
- Optional<ComponentDto> componentOptional = ofNullable(dbClient.componentDao().selectByUuid(dbSession, of(user.getHomepageParameter()).orElse(EMPTY)).orElse(null));
+ Optional<ComponentDto> componentOptional = dbClient.componentDao().selectByUuid(dbSession, of(user.getHomepageParameter()).orElse(EMPTY));
if (shouldCleanApplicationOrPortfolioHomepage(componentOptional)) {
cleanUserHomepageInDb(dbSession, user);
return empty();
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/DeactivateAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/DeactivateAction.java
index 6b3d29f6292..6110d91ce64 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/DeactivateAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/DeactivateAction.java
@@ -146,8 +146,7 @@ public class DeactivateAction implements UsersWsAction {
try (JsonWriter json = response.newJsonWriter()) {
json.beginObject();
json.name("user");
- Set<String> groups = new HashSet<>();
- groups.addAll(dbClient.groupMembershipDao().selectGroupsByLogins(dbSession, singletonList(login)).get(login));
+ Set<String> groups = new HashSet<>(dbClient.groupMembershipDao().selectGroupsByLogins(dbSession, singletonList(login)).get(login));
userWriter.write(json, user, groups, UserJsonWriter.FIELDS);
json.endObject();
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UpdateLoginAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UpdateLoginAction.java
index 21410bf8a2f..e849b7d59af 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UpdateLoginAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/user/ws/UpdateLoginAction.java
@@ -26,7 +26,6 @@ import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.user.UserDto;
import org.sonar.server.exceptions.NotFoundException;
-import org.sonar.server.organization.OrganizationUpdater;
import org.sonar.server.user.UpdateUser;
import org.sonar.server.user.UserSession;
import org.sonar.server.user.UserUpdater;
@@ -43,13 +42,11 @@ public class UpdateLoginAction implements UsersWsAction {
private final DbClient dbClient;
private final UserSession userSession;
private final UserUpdater userUpdater;
- private final OrganizationUpdater organizationUpdater;
- public UpdateLoginAction(DbClient dbClient, UserSession userSession, UserUpdater userUpdater, OrganizationUpdater organizationUpdater) {
+ public UpdateLoginAction(DbClient dbClient, UserSession userSession, UserUpdater userUpdater) {
this.dbClient = dbClient;
this.userSession = userSession;
this.userUpdater = userUpdater;
- this.organizationUpdater = organizationUpdater;
}
@Override
@@ -81,7 +78,8 @@ public class UpdateLoginAction implements UsersWsAction {
String newLogin = request.mandatoryParam(PARAM_NEW_LOGIN);
try (DbSession dbSession = dbClient.openSession(false)) {
UserDto user = getUser(dbSession, login);
- userUpdater.updateAndCommit(dbSession, user, new UpdateUser().setLogin(newLogin), u -> {});
+ userUpdater.updateAndCommit(dbSession, user, new UpdateUser().setLogin(newLogin), u -> {
+ });
response.noContent();
}
}
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/DeleteAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/DeleteAction.java
index 33d4efc43ee..26295408dba 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/DeleteAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/DeleteAction.java
@@ -30,7 +30,6 @@ import org.sonar.db.organization.OrganizationDto;
import org.sonar.db.webhook.WebhookDto;
import org.sonar.server.user.UserSession;
-import static java.util.Optional.ofNullable;
import static org.sonar.server.webhook.ws.WebhooksWsParameters.DELETE_ACTION;
import static org.sonar.server.webhook.ws.WebhooksWsParameters.KEY_PARAM;
import static org.sonar.server.webhook.ws.WebhooksWsParameters.KEY_PARAM_MAXIMUM_LENGTH;
@@ -87,7 +86,7 @@ public class DeleteAction implements WebhooksWsAction {
String projectUuid = webhookDto.getProjectUuid();
if (projectUuid != null) {
- Optional<ComponentDto> optionalDto = ofNullable(dbClient.componentDao().selectByUuid(dbSession, projectUuid).orElse(null));
+ Optional<ComponentDto> optionalDto = dbClient.componentDao().selectByUuid(dbSession, projectUuid);
ComponentDto componentDto = checkStateWithOptional(optionalDto, "the requested project '%s' was not found", projectUuid);
webhookSupport.checkPermission(componentDto);
deleteWebhook(dbSession, webhookDto);
diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/UpdateAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/UpdateAction.java
index 89fa228a260..d839856c9b1 100644
--- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/UpdateAction.java
+++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/UpdateAction.java
@@ -31,7 +31,6 @@ import org.sonar.db.organization.OrganizationDto;
import org.sonar.db.webhook.WebhookDto;
import org.sonar.server.user.UserSession;
-import static java.util.Optional.ofNullable;
import static org.sonar.server.webhook.ws.WebhooksWsParameters.KEY_PARAM;
import static org.sonar.server.webhook.ws.WebhooksWsParameters.KEY_PARAM_MAXIMUM_LENGTH;
import static org.sonar.server.webhook.ws.WebhooksWsParameters.NAME_PARAM;
@@ -122,7 +121,7 @@ public class UpdateAction implements WebhooksWsAction {
String projectUuid = webhookDto.getProjectUuid();
if (projectUuid != null) {
- Optional<ComponentDto> optionalDto = ofNullable(dbClient.componentDao().selectByUuid(dbSession, projectUuid).orElse(null));
+ Optional<ComponentDto> optionalDto = dbClient.componentDao().selectByUuid(dbSession, projectUuid);
ComponentDto componentDto = checkStateWithOptional(optionalDto, "the requested project '%s' was not found", projectUuid);
webhookSupport.checkPermission(componentDto);
updateWebhook(dbSession, webhookDto, name, url, secret);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LoginActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LoginActionTest.java
index 4c77e88e5e2..f6c7038007b 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LoginActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LoginActionTest.java
@@ -19,9 +19,7 @@
*/
package org.sonar.server.authentication.ws;
-import java.io.IOException;
import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
@@ -81,7 +79,7 @@ public class LoginActionTest {
private LoginAction underTest = new LoginAction(credentialsAuthentication, jwtHttpHandler, threadLocalUserSession, authenticationEvent, userSessionFactory);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
threadLocalUserSession.unload();
dbClient.userDao().insert(dbSession, user);
dbSession.commit();
@@ -171,7 +169,7 @@ public class LoginActionTest {
verify(authenticationEvent).loginFailure(eq(request), any(AuthenticationException.class));
}
- private void executeRequest(String login, String password) throws IOException, ServletException {
+ private void executeRequest(String login, String password) {
when(request.getMethod()).thenReturn("POST");
when(request.getParameter("login")).thenReturn(login);
when(request.getParameter("password")).thenReturn(password);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LogoutActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LogoutActionTest.java
index 9ad434f109f..244eca45859 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LogoutActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/LogoutActionTest.java
@@ -19,11 +19,9 @@
*/
package org.sonar.server.authentication.ws;
-import java.io.IOException;
import java.util.Collections;
import java.util.Optional;
import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Rule;
@@ -88,7 +86,7 @@ public class LogoutActionTest {
}
@Test
- public void return_400_on_get_request() throws Exception {
+ public void return_400_on_get_request() {
when(request.getMethod()).thenReturn("GET");
underTest.doFilter(request, response, chain);
@@ -132,7 +130,7 @@ public class LogoutActionTest {
verifyZeroInteractions(chain);
}
- private void executeRequest() throws IOException, ServletException {
+ private void executeRequest() {
when(request.getMethod()).thenReturn("POST");
underTest.doFilter(request, response, chain);
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/queue/ReportSubmitterTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/queue/ReportSubmitterTest.java
index a874f2b6071..4dc2b5afc54 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/queue/ReportSubmitterTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/queue/ReportSubmitterTest.java
@@ -98,7 +98,7 @@ public class ReportSubmitterTest {
private ReportSubmitter underTest = new ReportSubmitter(queue, userSession, componentUpdater, permissionTemplateService, db.getDbClient(), ossEditionBranchSupport);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
defaultOrganizationKey = db.getDefaultOrganization().getKey();
defaultOrganizationUuid = db.getDefaultOrganization().getUuid();
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java
index 099874e2161..64bdaa26704 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java
@@ -292,7 +292,7 @@ public class TaskFormatterTest {
.setAnalysisUuid("U1");
}
- private class TestActivityDto extends CeActivityDto {
+ private static class TestActivityDto extends CeActivityDto {
public TestActivityDto(CeQueueDto queueDto) {
super(queueDto);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ComponentServiceUpdateKeyTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ComponentServiceUpdateKeyTest.java
index 66583ddfbf2..89c843b92ea 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ComponentServiceUpdateKeyTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ComponentServiceUpdateKeyTest.java
@@ -228,8 +228,7 @@ public class ComponentServiceUpdateKeyTest {
}
private ComponentDto insertProject(String key) {
- ComponentDto project = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey(key));
- return project;
+ return componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey(key));
}
private void assertComponentKeyHasBeenUpdated(String oldKey, String newKey) {
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java
index 2fb20536bf0..b628cea3975 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/component/ws/SearchProjectsActionTest.java
@@ -138,7 +138,7 @@ public class SearchProjectsActionTest {
private RequestBuilder request = SearchProjectsRequest.builder();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
projectsInWarning.update(0L);
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/duplication/ws/ShowActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/duplication/ws/ShowActionTest.java
index 994e9d83e92..f726834f35a 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/duplication/ws/ShowActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/duplication/ws/ShowActionTest.java
@@ -81,13 +81,13 @@ public class ShowActionTest {
}
@Test
- public void get_duplications_by_file_key() throws Exception {
+ public void get_duplications_by_file_key() {
TestRequest request = newBaseRequest();
verifyCallToFileWithDuplications(file -> request.setParam("key", file.getDbKey()));
}
@Test
- public void get_duplications_by_file_id() throws Exception {
+ public void get_duplications_by_file_id() {
TestRequest request = newBaseRequest();
verifyCallToFileWithDuplications(file -> request.setParam("uuid", file.uuid()));
}
@@ -238,7 +238,7 @@ public class ShowActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
userSessionRule.addProjectPermission(UserRole.CODEVIEWER, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/favorite/ws/AddActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/favorite/ws/AddActionTest.java
index e16069b3233..4d852c87c82 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/favorite/ws/AddActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/favorite/ws/AddActionTest.java
@@ -137,7 +137,7 @@ public class AddActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
ComponentDto branch = db.components().insertProjectBranch(project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/favorite/ws/RemoveActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/favorite/ws/RemoveActionTest.java
index 05e050e2e63..148e9e2f2ef 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/favorite/ws/RemoveActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/favorite/ws/RemoveActionTest.java
@@ -106,7 +106,7 @@ public class RemoveActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
userSession.logIn().addProjectPermission(UserRole.USER, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/health/HealthCheckerImplTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/health/HealthCheckerImplTest.java
index 84893a43792..220a4216c39 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/health/HealthCheckerImplTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/health/HealthCheckerImplTest.java
@@ -202,7 +202,7 @@ public class HealthCheckerImplTest {
.map(HardcodedHealthClusterCheck::new)
.map(ClusterHealthCheck.class::cast)
.toArray(ClusterHealthCheck[]::new);
- String[] expectedCauses = causesGroups.stream().flatMap(Arrays::stream).collect(Collectors.toSet()).stream().toArray(String[]::new);
+ String[] expectedCauses = causesGroups.stream().flatMap(Arrays::stream).toArray(String[]::new);
HealthCheckerImpl underTest = new HealthCheckerImpl(webServer, new NodeHealthCheck[0], clusterHealthChecks, sharedHealthState);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/AddTagsActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/AddTagsActionTest.java
index fe6a79e456f..c831bb4ddf0 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/AddTagsActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/AddTagsActionTest.java
@@ -41,7 +41,6 @@ public class AddTagsActionTest {
private AddTagsAction underTest = new AddTagsAction(issueUpdater);
@Test
- @SuppressWarnings("unchecked")
public void should_execute() {
Map<String, Object> properties = new HashMap<>();
properties.put("tags", "tag2,tag3");
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/AssignActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/AssignActionTest.java
index cdfe07d39a4..36e950eae5f 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/AssignActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/AssignActionTest.java
@@ -59,7 +59,6 @@ public class AssignActionTest {
private IssueChangeContext issueChangeContext = IssueChangeContext.createUser(new Date(), "user_uuid");
private DefaultIssue issue = new DefaultIssue().setKey("ABC").setAssigneeUuid(ISSUE_CURRENT_ASSIGNEE_UUID);
- private ComponentDto project;
private Action.Context context;
private OrganizationDto issueOrganizationDto;
@@ -68,7 +67,7 @@ public class AssignActionTest {
@Before
public void setUp() throws Exception {
issueOrganizationDto = db.organizations().insert();
- project = db.components().insertPrivateProject(issueOrganizationDto);
+ ComponentDto project = db.components().insertPrivateProject(issueOrganizationDto);
context = new ActionContext(issue, issueChangeContext, project);
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/CommentActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/CommentActionTest.java
index 2e1d68afb1f..8e9675bcbe1 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/CommentActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/CommentActionTest.java
@@ -19,7 +19,8 @@
*/
package org.sonar.server.issue;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
@@ -27,7 +28,7 @@ import org.sonar.api.issue.Issue;
import org.sonar.core.issue.DefaultIssue;
import org.sonar.server.tester.AnonymousMockUserSession;
-import static com.google.common.collect.Maps.newHashMap;
+import static java.util.Collections.singletonMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
@@ -51,7 +52,7 @@ public class CommentActionTest {
@Test
public void should_execute() {
String comment = "My bulk change comment";
- Map<String, Object> properties = newHashMap();
+ Map<String, Object> properties = new HashMap<>();
properties.put("comment", comment);
DefaultIssue issue = mock(DefaultIssue.class);
@@ -64,10 +65,9 @@ public class CommentActionTest {
@Test
public void should_verify_fail_if_parameter_not_found() {
- Map<String, Object> properties = newHashMap();
- properties.put("unknwown", "unknown value");
+ Map<String, Object> properties = singletonMap("unknwown", "unknown value");
try {
- action.verify(properties, Lists.newArrayList(), new AnonymousMockUserSession());
+ action.verify(properties, new ArrayList<>(), new AnonymousMockUserSession());
fail();
} catch (Exception e) {
assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("Missing parameter : 'comment'");
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/IssueFinderTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/IssueFinderTest.java
index 51f1566f9d0..e0394b512f9 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/IssueFinderTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/IssueFinderTest.java
@@ -61,8 +61,7 @@ public class IssueFinderTest {
@Test
public void get_by_issue_key() {
IssueDto issueDto = insertIssue();
- String permission = USER;
- addProjectPermission(issueDto, permission);
+ addProjectPermission(issueDto, USER);
IssueDto result = underTest.getByKey(db.getSession(), issueDto.getKey());
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/RemoveTagsActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/RemoveTagsActionTest.java
index 9ad3bc3d751..141bb69604e 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/RemoveTagsActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/RemoveTagsActionTest.java
@@ -20,6 +20,7 @@
package org.sonar.server.issue;
import com.google.common.collect.ImmutableSet;
+import java.util.HashMap;
import java.util.Map;
import org.junit.Rule;
import org.junit.Test;
@@ -27,7 +28,6 @@ import org.junit.rules.ExpectedException;
import org.mockito.Mockito;
import org.sonar.core.issue.DefaultIssue;
-import static com.google.common.collect.Maps.newHashMap;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -41,9 +41,8 @@ public class RemoveTagsActionTest {
private RemoveTagsAction action = new RemoveTagsAction(issueUpdater);
@Test
- @SuppressWarnings("unchecked")
public void should_execute() {
- Map<String, Object> properties = newHashMap();
+ Map<String, Object> properties = new HashMap<>();
properties.put("tags", "tag2,tag3");
DefaultIssue issue = mock(DefaultIssue.class);
@@ -61,7 +60,7 @@ public class RemoveTagsActionTest {
throwable.expect(IllegalArgumentException.class);
throwable.expectMessage("Tag 'th ag' is invalid. Rule tags accept only the characters: a-z, 0-9, '+', '-', '#', '.'");
- Map<String, Object> properties = newHashMap();
+ Map<String, Object> properties = new HashMap<>();
properties.put("tags", "th ag");
DefaultIssue issue = mock(DefaultIssue.class);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/TransitionActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/TransitionActionTest.java
index 8a2866dfd97..9d7b2f3c9ea 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/TransitionActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/TransitionActionTest.java
@@ -66,7 +66,7 @@ public class TransitionActionTest {
private TransitionAction action = new TransitionAction(transitionService);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
workflow.start();
when(context.issue()).thenReturn(issue);
when(context.issueChangeContext()).thenReturn(IssueChangeContext.createUser(new Date(), "user_uuid"));
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/TransitionServiceTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/TransitionServiceTest.java
index 69729235480..3abbaff55f8 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/TransitionServiceTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/TransitionServiceTest.java
@@ -58,7 +58,7 @@ public class TransitionServiceTest {
private TransitionService underTest = new TransitionService(userSession, workflow);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
workflow.start();
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/AddCommentActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/AddCommentActionTest.java
index d5f01f3cf05..752cd8d68c8 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/AddCommentActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/AddCommentActionTest.java
@@ -103,7 +103,7 @@ public class AddCommentActionTest {
new AddCommentAction(system2, userSession, dbClient, new IssueFinder(dbClient, userSession), issueUpdater, new IssueFieldsSetter(), responseWriter));
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(system2.now()).thenReturn(NOW);
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/AssignActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/AssignActionTest.java
index 3919c8fea27..08942433b09 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/AssignActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/AssignActionTest.java
@@ -265,13 +265,12 @@ public class AssignActionTest {
}
private IssueDto newIssue(String assignee) {
- IssueDto issue = db.issues().insertIssue(
+ return db.issues().insertIssue(
issueDto -> issueDto
.setAssigneeUuid(assignee)
.setCreatedAt(PAST).setIssueCreationTime(PAST)
.setUpdatedAt(PAST).setIssueUpdateTime(PAST)
.setType(CODE_SMELL));
- return issue;
}
private IssueDto newIssueWithBrowsePermission() {
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/ChangelogActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/ChangelogActionTest.java
index 158ff824d0f..6ce3f852583 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/ChangelogActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/issue/ws/ChangelogActionTest.java
@@ -72,7 +72,7 @@ public class ChangelogActionTest {
private WsActionTester tester = new WsActionTester(new ChangelogAction(db.getDbClient(), new IssueFinder(db.getDbClient(), userSession), new AvatarResolverImpl(), userSession));
@Before
- public void setUp() throws Exception {
+ public void setUp() {
project = db.components().insertPrivateProject();
file = db.components().insertComponent(newFileDto(project));
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/custom/ws/MetricsActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/custom/ws/MetricsActionTest.java
index 089552f1433..e0fb95d29b3 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/custom/ws/MetricsActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/custom/ws/MetricsActionTest.java
@@ -64,7 +64,7 @@ public class MetricsActionTest {
private WsActionTester tester = new WsActionTester(underTest);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
defaultProject = insertDefaultProject();
userSession.logIn().addProjectPermission(UserRole.ADMIN, defaultProject);
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/live/LiveMeasureComputerImplTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/live/LiveMeasureComputerImplTest.java
index c3b7eb46d78..b09e262be13 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/live/LiveMeasureComputerImplTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/live/LiveMeasureComputerImplTest.java
@@ -94,7 +94,7 @@ public class LiveMeasureComputerImplTest {
private EvaluatedQualityGate newQualityGate = mock(EvaluatedQualityGate.class);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
intMetric = db.measures().insertMetric(m -> m.setValueType(Metric.ValueType.INT.name()));
ratingMetric = db.measures().insertMetric(m -> m.setValueType(Metric.ValueType.RATING.name()));
alertStatusMetric = db.measures().insertMetric(m -> m.setKey(CoreMetrics.ALERT_STATUS_KEY));
@@ -452,7 +452,7 @@ public class LiveMeasureComputerImplTest {
Metric metric = new Metric.Builder(intMetric.getKey(), intMetric.getShortName(), Metric.ValueType.valueOf(intMetric.getValueType())).create();
AtomicInteger counter = new AtomicInteger();
return new IssueMetricFormula(metric, false, (ctx, issues) -> {
- ctx.setValue((double) counter.incrementAndGet());
+ ctx.setValue(counter.incrementAndGet());
});
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java
index 0d82256257c..85836c997fe 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java
@@ -395,7 +395,7 @@ public class ComponentActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
userSession.logIn().addProjectPermission(UserRole.USER, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java
index 31103bb0667..a9b39764220 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/SearchActionTest.java
@@ -44,7 +44,6 @@ import org.sonarqube.ws.Measures.Measure;
import org.sonarqube.ws.Measures.SearchWsResponse;
import static com.google.common.collect.Lists.newArrayList;
-import static com.google.common.collect.Lists.transform;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java
index c06454e681d..a23ecc0f7d2 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/measure/ws/SearchHistoryActionTest.java
@@ -341,7 +341,7 @@ public class SearchHistoryActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
userSession.logIn().addProjectPermission(UserRole.USER, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/notification/ws/AddActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/notification/ws/AddActionTest.java
index c93517fbb0f..c8554263d3e 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/notification/ws/AddActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/notification/ws/AddActionTest.java
@@ -327,7 +327,7 @@ public class AddActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
UserDto user = db.users().insertUser();
userSession.logIn(user);
when(dispatchers.getProjectDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES));
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/notification/ws/RemoveActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/notification/ws/RemoveActionTest.java
index b08766bfbaa..215791d7db5 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/notification/ws/RemoveActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/notification/ws/RemoveActionTest.java
@@ -307,7 +307,7 @@ public class RemoveActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
UserDto user = db.users().insertUser();
userSession.logIn(user);
when(dispatchers.getGlobalDispatchers()).thenReturn(singletonList(NOTIF_MY_NEW_ISSUES));
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/GroupPermissionChangerTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/GroupPermissionChangerTest.java
index b6f9600af1a..367f07d328a 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/GroupPermissionChangerTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/GroupPermissionChangerTest.java
@@ -61,7 +61,7 @@ public class GroupPermissionChangerTest {
private ComponentDto publicProject;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
org = db.organizations().insert();
group = db.users().insertGroup(org, "a-group");
privateProject = db.components().insertPrivateProject(org);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/UserPermissionChangerTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/UserPermissionChangerTest.java
index 41d48efd496..877b0f1cb1e 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/UserPermissionChangerTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/UserPermissionChangerTest.java
@@ -68,7 +68,7 @@ public class UserPermissionChangerTest {
private ComponentDto publicProject;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
org1 = db.organizations().insert();
org2 = db.organizations().insert();
user1 = db.users().insertUser();
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java
index 51efdf27471..bdc01864e60 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/AddGroupActionTest.java
@@ -217,7 +217,7 @@ public class AddGroupActionTest extends BasePermissionWsTest<AddGroupAction> {
}
@Test
- public void adding_a_project_permission_fails_if_project_is_not_set() throws Exception {
+ public void adding_a_project_permission_fails_if_project_is_not_set() {
GroupDto group = db.users().insertGroup(db.getDefaultOrganization(), "sonar-administrators");
loginAsAdmin(db.getDefaultOrganization());
@@ -456,7 +456,7 @@ public class AddGroupActionTest extends BasePermissionWsTest<AddGroupAction> {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
GroupDto group = db.users().insertGroup(organization);
ComponentDto project = db.components().insertMainBranch(organization);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java
index c18be504182..f94a4ed0598 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/AddUserActionTest.java
@@ -404,7 +404,7 @@ public class AddUserActionTest extends BasePermissionWsTest<AddUserAction> {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
addUserAsMemberOfOrganization(organization);
ComponentDto project = db.components().insertMainBranch(organization);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java
index fd0cc81d2de..732fba0d30e 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/RemoveGroupActionTest.java
@@ -157,7 +157,7 @@ public class RemoveGroupActionTest extends BasePermissionWsTest<RemoveGroupActio
}
@Test
- public void fail_to_remove_last_admin_permission() throws Exception {
+ public void fail_to_remove_last_admin_permission() {
db.users().insertPermissionOnGroup(aGroup, ADMINISTER);
db.users().insertPermissionOnGroup(aGroup, PROVISION_PROJECTS);
loginAsAdmin(db.getDefaultOrganization());
@@ -183,7 +183,7 @@ public class RemoveGroupActionTest extends BasePermissionWsTest<RemoveGroupActio
}
@Test
- public void fail_when_project_project_permission_without_project() throws Exception {
+ public void fail_when_project_project_permission_without_project() {
loginAsAdmin(db.getDefaultOrganization());
expectedException.expect(BadRequestException.class);
@@ -434,7 +434,7 @@ public class RemoveGroupActionTest extends BasePermissionWsTest<RemoveGroupActio
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
GroupDto group = db.users().insertGroup(organization);
ComponentDto project = db.components().insertMainBranch(organization);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java
index c6f011d6dfe..e0ea8ee5804 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/RemoveUserActionTest.java
@@ -353,7 +353,7 @@ public class RemoveUserActionTest extends BasePermissionWsTest<RemoveUserAction>
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java
index 1f37a11b249..72907647f7c 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/SearchProjectPermissionsActionTest.java
@@ -291,7 +291,7 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
ComponentDto project = db.components().insertMainBranch();
userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
ComponentDto branch = db.components().insertProjectBranch(project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/AddUserToTemplateActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/AddUserToTemplateActionTest.java
index 623d9dc8cb9..8623e569e66 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/AddUserToTemplateActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/AddUserToTemplateActionTest.java
@@ -70,7 +70,7 @@ public class AddUserToTemplateActionTest extends BasePermissionWsTest<AddUserToT
}
@Test
- public void add_user_to_template() throws Exception {
+ public void add_user_to_template() {
loginAsAdmin(db.getDefaultOrganization());
newRequest(user.getLogin(), permissionTemplate.getUuid(), CODEVIEWER);
@@ -109,7 +109,7 @@ public class AddUserToTemplateActionTest extends BasePermissionWsTest<AddUserToT
}
@Test
- public void does_not_add_a_user_twice() throws Exception {
+ public void does_not_add_a_user_twice() {
loginAsAdmin(db.getDefaultOrganization());
newRequest(user.getLogin(), permissionTemplate.getUuid(), ISSUE_ADMIN);
@@ -119,7 +119,7 @@ public class AddUserToTemplateActionTest extends BasePermissionWsTest<AddUserToT
}
@Test
- public void fail_if_not_a_project_permission() throws Exception {
+ public void fail_if_not_a_project_permission() {
loginAsAdmin(db.getDefaultOrganization());
expectedException.expect(IllegalArgumentException.class);
@@ -128,7 +128,7 @@ public class AddUserToTemplateActionTest extends BasePermissionWsTest<AddUserToT
}
@Test
- public void fail_if_not_admin_of_default_organization() throws Exception {
+ public void fail_if_not_admin_of_default_organization() {
userSession.logIn().addPermission(ADMINISTER_QUALITY_PROFILES, db.getDefaultOrganization());
expectedException.expect(ForbiddenException.class);
@@ -137,7 +137,7 @@ public class AddUserToTemplateActionTest extends BasePermissionWsTest<AddUserToT
}
@Test
- public void fail_if_user_missing() throws Exception {
+ public void fail_if_user_missing() {
loginAsAdmin(db.getDefaultOrganization());
expectedException.expect(IllegalArgumentException.class);
@@ -146,7 +146,7 @@ public class AddUserToTemplateActionTest extends BasePermissionWsTest<AddUserToT
}
@Test
- public void fail_if_permission_missing() throws Exception {
+ public void fail_if_permission_missing() {
loginAsAdmin(db.getDefaultOrganization());
expectedException.expect(IllegalArgumentException.class);
@@ -155,7 +155,7 @@ public class AddUserToTemplateActionTest extends BasePermissionWsTest<AddUserToT
}
@Test
- public void fail_if_template_uuid_and_name_are_missing() throws Exception {
+ public void fail_if_template_uuid_and_name_are_missing() {
loginAsAdmin(db.getDefaultOrganization());
expectedException.expect(BadRequestException.class);
@@ -164,7 +164,7 @@ public class AddUserToTemplateActionTest extends BasePermissionWsTest<AddUserToT
}
@Test
- public void fail_if_user_does_not_exist() throws Exception {
+ public void fail_if_user_does_not_exist() {
loginAsAdmin(db.getDefaultOrganization());
expectedException.expect(NotFoundException.class);
@@ -174,7 +174,7 @@ public class AddUserToTemplateActionTest extends BasePermissionWsTest<AddUserToT
}
@Test
- public void fail_if_template_key_does_not_exist() throws Exception {
+ public void fail_if_template_key_does_not_exist() {
loginAsAdmin(db.getDefaultOrganization());
expectedException.expect(NotFoundException.class);
@@ -195,7 +195,8 @@ public class AddUserToTemplateActionTest extends BasePermissionWsTest<AddUserToT
.setParam(PARAM_PERMISSION, CODEVIEWER)
.setParam(PARAM_TEMPLATE_NAME, permissionTemplate.getName().toUpperCase())
.setParam(PARAM_ORGANIZATION, "Unknown")
- .execute(); }
+ .execute();
+ }
@Test
public void fail_to_add_permission_when_user_is_not_member_of_given_organization() {
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/DeleteTemplateActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/DeleteTemplateActionTest.java
index 11f4c26b89f..d9c0e3f68b0 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/DeleteTemplateActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/permission/ws/template/DeleteTemplateActionTest.java
@@ -80,7 +80,7 @@ public class DeleteTemplateActionTest {
private WsActionTester underTestWithViews;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
GroupWsSupport groupWsSupport = new GroupWsSupport(dbClient, TestDefaultOrganizationProvider.from(db), new DefaultGroupFinder(db.getDbClient()));
this.underTestWithoutViews = new WsActionTester(new DeleteTemplateAction(dbClient, userSession,
new PermissionWsSupport(dbClient, new ComponentFinder(dbClient, resourceTypes), groupWsSupport), defaultTemplatesResolver));
@@ -184,12 +184,12 @@ public class DeleteTemplateActionTest {
}
@Test
- public void fail_to_delete_by_uuid_if_template_is_default_template_for_project_without_views() throws Exception {
+ public void fail_to_delete_by_uuid_if_template_is_default_template_for_project_without_views() {
fail_to_delete_by_uuid_if_template_is_default_template_for_project(this.underTestWithoutViews);
}
@Test
- public void fail_to_delete_by_uuid_if_template_is_default_template_for_project_with_views() throws Exception {
+ public void fail_to_delete_by_uuid_if_template_is_default_template_for_project_with_views() {
fail_to_delete_by_uuid_if_template_is_default_template_for_project(this.underTestWithViews);
}
@@ -207,12 +207,12 @@ public class DeleteTemplateActionTest {
}
@Test
- public void fail_to_delete_by_name_if_template_is_default_template_for_project_without_views() throws Exception {
+ public void fail_to_delete_by_name_if_template_is_default_template_for_project_without_views() {
fail_to_delete_by_name_if_template_is_default_template_for_project(this.underTestWithoutViews);
}
@Test
- public void fail_to_delete_by_name_if_template_is_default_template_for_project_with_views() throws Exception {
+ public void fail_to_delete_by_name_if_template_is_default_template_for_project_with_views() {
fail_to_delete_by_name_if_template_is_default_template_for_project(this.underTestWithViews);
}
@@ -435,8 +435,7 @@ public class DeleteTemplateActionTest {
return request.execute();
}
- private TestResponse newRequestByName(WsActionTester actionTester, @Nullable OrganizationDto organizationDto, @Nullable PermissionTemplateDto permissionTemplateDto)
- throws Exception {
+ private TestResponse newRequestByName(WsActionTester actionTester, @Nullable OrganizationDto organizationDto, @Nullable PermissionTemplateDto permissionTemplateDto) {
return newRequestByName(
actionTester,
organizationDto == null ? null : organizationDto.getKey(),
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/HealthActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/HealthActionTest.java
index 86204efb938..3f35d799822 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/HealthActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/HealthActionTest.java
@@ -264,7 +264,7 @@ public class HealthActionTest {
assertThat(node.getHealth().name()).isEqualTo(nodeHealth.getStatus().name());
assertThat(node.getCausesList())
.extracting(System.Cause::getMessage)
- .containsOnly(nodeHealth.getCauses().stream().toArray(String[]::new));
+ .containsOnly(nodeHealth.getCauses().toArray(new String[0]));
assertThat(node.getName()).isEqualTo(nodeHealth.getDetails().getName());
assertThat(node.getHost()).isEqualTo(nodeHealth.getDetails().getHost());
assertThat(node.getPort()).isEqualTo(nodeHealth.getDetails().getPort());
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/InfoActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/InfoActionTest.java
index 3a1cc765eec..e467ea9075c 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/InfoActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/InfoActionTest.java
@@ -22,7 +22,6 @@ package org.sonar.server.platform.ws;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.sonar.api.utils.text.JsonWriter;
import org.sonar.server.exceptions.ForbiddenException;
import org.sonar.server.platform.SystemInfoWriter;
import org.sonar.server.tester.UserSessionRule;
@@ -39,12 +38,7 @@ public class InfoActionTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
- private SystemInfoWriter jsonWriter = new SystemInfoWriter() {
- @Override
- public void write(JsonWriter json) {
- json.prop("key", "value");
- }
- };
+ private SystemInfoWriter jsonWriter = json -> json.prop("key", "value");
private InfoAction underTest = new InfoAction(userSessionRule, jsonWriter);
private WsActionTester ws = new WsActionTester(underTest);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/StatusActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/StatusActionTest.java
index ff6f668236b..86a75a0a874 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/StatusActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/StatusActionTest.java
@@ -80,14 +80,14 @@ public class StatusActionTest {
}
@Test
- public void status_is_UP_if_platform_is_UP_and_restartFlag_is_false_whatever_databaseMigration_status_is() throws Exception {
+ public void status_is_UP_if_platform_is_UP_and_restartFlag_is_false_whatever_databaseMigration_status_is() {
for (DatabaseMigrationState.Status databaseMigrationStatus : DatabaseMigrationState.Status.values()) {
verifyStatus(Platform.Status.UP, databaseMigrationStatus, STATUS_UP);
}
}
@Test
- public void status_is_RESTARTING_if_platform_is_UP_and_restartFlag_is_true_whatever_databaseMigration_status_is() throws Exception {
+ public void status_is_RESTARTING_if_platform_is_UP_and_restartFlag_is_true_whatever_databaseMigration_status_is() {
restartFlagHolder.set();
for (DatabaseMigrationState.Status databaseMigrationStatus : DatabaseMigrationState.Status.values()) {
@@ -96,54 +96,54 @@ public class StatusActionTest {
}
@Test
- public void status_is_DOWN_if_platform_is_BOOTING_whatever_databaseMigration_status_is() throws Exception {
+ public void status_is_DOWN_if_platform_is_BOOTING_whatever_databaseMigration_status_is() {
for (DatabaseMigrationState.Status databaseMigrationStatus : DatabaseMigrationState.Status.values()) {
verifyStatus(Platform.Status.BOOTING, databaseMigrationStatus, STATUS_DOWN);
}
}
@Test
- public void status_is_DB_MIGRATION_NEEDED_if_platform_is_SAFEMODE_and_databaseMigration_is_NONE() throws Exception {
+ public void status_is_DB_MIGRATION_NEEDED_if_platform_is_SAFEMODE_and_databaseMigration_is_NONE() {
verifyStatus(Platform.Status.SAFEMODE, DatabaseMigrationState.Status.NONE, STATUS_MIGRATION_NEEDED);
}
@Test
- public void status_is_DB_MIGRATION_RUNNING_if_platform_is_SAFEMODE_and_databaseMigration_is_RUNNING() throws Exception {
+ public void status_is_DB_MIGRATION_RUNNING_if_platform_is_SAFEMODE_and_databaseMigration_is_RUNNING() {
verifyStatus(Platform.Status.SAFEMODE, DatabaseMigrationState.Status.RUNNING, STATUS_MIGRATION_RUNNING);
}
@Test
- public void status_is_STATUS_STARTING_if_platform_is_SAFEMODE_and_databaseMigration_is_SUCCEEDED() throws Exception {
+ public void status_is_STATUS_STARTING_if_platform_is_SAFEMODE_and_databaseMigration_is_SUCCEEDED() {
verifyStatus(Platform.Status.SAFEMODE, DatabaseMigrationState.Status.SUCCEEDED, STATUS_STARTING);
}
@Test
- public void status_is_DOWN_if_platform_is_SAFEMODE_and_databaseMigration_is_FAILED() throws Exception {
+ public void status_is_DOWN_if_platform_is_SAFEMODE_and_databaseMigration_is_FAILED() {
verifyStatus(Platform.Status.SAFEMODE, DatabaseMigrationState.Status.FAILED, STATUS_DOWN);
}
@Test
- public void status_is_STARTING_if_platform_is_STARTING_and_databaseMigration_is_NONE() throws Exception {
+ public void status_is_STARTING_if_platform_is_STARTING_and_databaseMigration_is_NONE() {
verifyStatus(Platform.Status.STARTING, DatabaseMigrationState.Status.NONE, STATUS_STARTING);
}
@Test
- public void status_is_DB_MIGRATION_RUNNING_if_platform_is_STARTING_and_databaseMigration_is_RUNNING() throws Exception {
+ public void status_is_DB_MIGRATION_RUNNING_if_platform_is_STARTING_and_databaseMigration_is_RUNNING() {
verifyStatus(Platform.Status.STARTING, DatabaseMigrationState.Status.RUNNING, STATUS_MIGRATION_RUNNING);
}
@Test
- public void status_is_STARTING_if_platform_is_STARTING_and_databaseMigration_is_SUCCEEDED() throws Exception {
+ public void status_is_STARTING_if_platform_is_STARTING_and_databaseMigration_is_SUCCEEDED() {
verifyStatus(Platform.Status.STARTING, DatabaseMigrationState.Status.SUCCEEDED, STATUS_STARTING);
}
@Test
- public void status_is_DOWN_if_platform_is_STARTING_and_databaseMigration_is_FAILED() throws Exception {
+ public void status_is_DOWN_if_platform_is_STARTING_and_databaseMigration_is_FAILED() {
verifyStatus(Platform.Status.STARTING, DatabaseMigrationState.Status.FAILED, STATUS_DOWN);
}
@Test
- public void safety_test_for_new_platform_status() throws Exception {
+ public void safety_test_for_new_platform_status() {
for (Platform.Status platformStatus : filter(asList(Platform.Status.values()), not(in(SUPPORTED_PLATFORM_STATUSES)))) {
for (DatabaseMigrationState.Status databaseMigrationStatus : DatabaseMigrationState.Status.values()) {
verifyStatus(platformStatus, databaseMigrationStatus, STATUS_DOWN);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/UpgradesActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/UpgradesActionTest.java
index 8596f047fd4..37bf7d5ddb7 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/UpgradesActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/platform/ws/UpgradesActionTest.java
@@ -45,7 +45,6 @@ public class UpgradesActionTest {
private static final String JSON_EMPTY_UPGRADE_LIST = "{" +
" \"upgrades\":" + "[]" +
"}";
- private static Release release;
private UpdateCenterMatrixFactory updateCenterFactory = mock(UpdateCenterMatrixFactory.class);
private UpdateCenter updateCenter = mock(UpdateCenter.class);
@@ -75,7 +74,7 @@ public class UpgradesActionTest {
.setTermsConditionsUrl("http://dist.sonarsource.com/SonarSource_Terms_And_Conditions.pdf")
.setIssueTrackerUrl("http://jira.sonarsource.com/browse/VIEWS");
- release = new Release(new Sonar(), Version.create("5.1.0.5498"))
+ Release release = new Release(new Sonar(), Version.create("5.1.0.5498"))
.setDate(DateUtils.parseDate("2015-04-02"))
.setDescription("New overall layout, merge Issues Drilldown [...]")
.setDownloadUrl("http://dist.sonar.codehaus.org/sonarqube-5.1.zip")
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/UpdateKeyActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/UpdateKeyActionTest.java
index 749d4b653eb..242f8c7cb29 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/UpdateKeyActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/UpdateKeyActionTest.java
@@ -124,7 +124,7 @@ public class UpdateKeyActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
ComponentDto project = db.components().insertMainBranch();
ComponentDto branch = db.components().insertProjectBranch(project);
userSessionRule.addProjectPermission(UserRole.ADMIN, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/UpdateVisibilityActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/UpdateVisibilityActionTest.java
index 65df5995095..0393af7f7bc 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/UpdateVisibilityActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/project/ws/UpdateVisibilityActionTest.java
@@ -625,7 +625,7 @@ public class UpdateVisibilityActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
ComponentDto project = dbTester.components().insertMainBranch();
userSessionRule.logIn().addProjectPermission(UserRole.USER, project);
ComponentDto branch = dbTester.components().insertProjectBranch(project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectanalysis/ws/SearchActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectanalysis/ws/SearchActionTest.java
index 3d34e71d317..db51a0473ee 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectanalysis/ws/SearchActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectanalysis/ws/SearchActionTest.java
@@ -33,7 +33,6 @@ import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.server.ws.WebService.Param;
-import org.sonar.api.utils.System2;
import org.sonar.api.utils.log.LogAndArguments;
import org.sonar.api.utils.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
@@ -41,7 +40,6 @@ import org.sonar.api.web.UserRole;
import org.sonar.core.util.UuidFactoryFast;
import org.sonar.db.DbClient;
import org.sonar.db.DbTester;
-import org.sonar.db.component.BranchDao;
import org.sonar.db.component.BranchDto;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ComponentTesting;
@@ -108,8 +106,7 @@ public class SearchActionTest {
private DbClient dbClient = db.getDbClient();
- private WsActionTester ws = new WsActionTester(new SearchAction(dbClient, TestComponentFinder.from(db),
- userSession, new BranchDao(System2.INSTANCE)));
+ private WsActionTester ws = new WsActionTester(new SearchAction(dbClient, TestComponentFinder.from(db), userSession));
private UuidFactoryFast uuidFactoryFast = UuidFactoryFast.getInstance();
@DataProvider
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java
index 458f8ca0b14..d9170674af0 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java
@@ -220,7 +220,7 @@ public class CreateActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
userSession.logIn().addProjectPermission(UserRole.USER, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java
index 834ca4b39a7..3ef67c10a6e 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java
@@ -238,7 +238,7 @@ public class SearchActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
userSession.logIn().addProjectPermission(UserRole.USER, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projecttag/ws/SetActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projecttag/ws/SetActionTest.java
index c0b71a0d85e..874ec379163 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projecttag/ws/SetActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/projecttag/ws/SetActionTest.java
@@ -175,7 +175,7 @@ public class SetActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
userSession.logIn().addProjectPermission(UserRole.USER, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/DestroyActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/DestroyActionTest.java
index f72cfde4739..a862dd0734f 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/DestroyActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/DestroyActionTest.java
@@ -169,7 +169,7 @@ public class DestroyActionTest {
expectedException.expectMessage(format("The 'id' parameter cannot be parsed as a long value: %s", invalidId));
ws.newRequest()
- .setParam(PARAM_ID, valueOf(invalidId))
+ .setParam(PARAM_ID, invalidId)
.setParam(PARAM_ORGANIZATION, organization.getKey())
.execute();
}
@@ -182,7 +182,7 @@ public class DestroyActionTest {
expectedException.expect(IllegalArgumentException.class);
ws.newRequest()
- .setParam(PARAM_ID, valueOf(EMPTY))
+ .setParam(PARAM_ID, EMPTY)
.setParam(PARAM_ORGANIZATION, organization.getKey())
.execute();
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java
index 7aaaaf3d22f..a4e53e8064d 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java
@@ -243,7 +243,7 @@ public class GetByProjectActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java
index 4dfcc43009a..53e2fbeff9b 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java
@@ -411,7 +411,7 @@ public class ProjectStatusActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/SelectActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/SelectActionTest.java
index 18ac6127aa4..72ae8797e01 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/SelectActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualitygate/ws/SelectActionTest.java
@@ -304,7 +304,7 @@ public class SelectActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
QGateWithOrgDto qualityGate = db.qualityGates().insertQualityGate(organization);
ComponentDto project = db.components().insertMainBranch(organization);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileComparisonTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileComparisonTest.java
index 81ce2e33ef6..9f09440102c 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileComparisonTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/QProfileComparisonTest.java
@@ -58,7 +58,6 @@ public class QProfileComparisonTest {
@Rule
public EsTester es = EsTester.create();
- private DbClient db;
private DbSession dbSession;
private QProfileRules qProfileRules;
private QProfileComparison comparison;
@@ -70,7 +69,7 @@ public class QProfileComparisonTest {
@Before
public void before() {
- db = dbTester.getDbClient();
+ DbClient db = dbTester.getDbClient();
dbSession = db.openSession(false);
RuleIndex ruleIndex = new RuleIndex(es.client(), System2.INSTANCE);
ActiveRuleIndexer activeRuleIndexer = new ActiveRuleIndexer(db, es.client());
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/RegisterQualityProfilesNotificationTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/RegisterQualityProfilesNotificationTest.java
index d6a535e448f..5355dccf665 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/RegisterQualityProfilesNotificationTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/RegisterQualityProfilesNotificationTest.java
@@ -138,7 +138,7 @@ public class RegisterQualityProfilesNotificationTest {
ArgumentCaptor<Multimap> captor = ArgumentCaptor.forClass(Multimap.class);
verify(builtInQualityProfilesNotification).onChange(captor.capture(), anyLong(), anyLong());
- Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.<Multimap<QProfileName, ActiveRuleChange>>getValue();
+ Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.getValue();
assertThat(updatedProfiles.keySet())
.extracting(QProfileName::getName, QProfileName::getLanguage)
.containsExactlyInAnyOrder(tuple(dbProfile.getName(), dbProfile.getLanguage()));
@@ -160,7 +160,7 @@ public class RegisterQualityProfilesNotificationTest {
ArgumentCaptor<Multimap> captor = ArgumentCaptor.forClass(Multimap.class);
verify(builtInQualityProfilesNotification).onChange(captor.capture(), anyLong(), anyLong());
- Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.<Multimap<QProfileName, ActiveRuleChange>>getValue();
+ Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.getValue();
assertThat(updatedProfiles.keySet())
.extracting(QProfileName::getName, QProfileName::getLanguage)
.containsExactlyInAnyOrder(tuple(dbProfile.getName(), dbProfile.getLanguage()));
@@ -190,7 +190,7 @@ public class RegisterQualityProfilesNotificationTest {
ArgumentCaptor<Multimap> captor = ArgumentCaptor.forClass(Multimap.class);
verify(builtInQualityProfilesNotification).onChange(captor.capture(), anyLong(), anyLong());
- Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.<Multimap<QProfileName, ActiveRuleChange>>getValue();
+ Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.getValue();
assertThat(updatedProfiles.keySet())
.extracting(QProfileName::getName, QProfileName::getLanguage)
.containsExactlyInAnyOrder(
@@ -218,7 +218,7 @@ public class RegisterQualityProfilesNotificationTest {
ArgumentCaptor<Multimap> captor = ArgumentCaptor.forClass(Multimap.class);
verify(builtInQualityProfilesNotification).onChange(captor.capture(), anyLong(), anyLong());
- Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.<Multimap<QProfileName, ActiveRuleChange>>getValue();
+ Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.getValue();
assertThat(updatedProfiles.keySet())
.extracting(QProfileName::getName, QProfileName::getLanguage)
.containsExactlyInAnyOrder(tuple(builtInQProfileDto.getName(), builtInQProfileDto.getLanguage()));
@@ -245,7 +245,7 @@ public class RegisterQualityProfilesNotificationTest {
ArgumentCaptor<Multimap> captor = ArgumentCaptor.forClass(Multimap.class);
verify(builtInQualityProfilesNotification).onChange(captor.capture(), anyLong(), anyLong());
- Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.<Multimap<QProfileName, ActiveRuleChange>>getValue();
+ Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.getValue();
assertThat(updatedProfiles.keySet())
.extracting(QProfileName::getName, QProfileName::getLanguage)
.containsExactlyInAnyOrder(tuple(builtInProfile.getName(), builtInProfile.getLanguage()));
@@ -275,7 +275,7 @@ public class RegisterQualityProfilesNotificationTest {
ArgumentCaptor<Multimap> captor = ArgumentCaptor.forClass(Multimap.class);
verify(builtInQualityProfilesNotification).onChange(captor.capture(), anyLong(), anyLong());
- Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.<Multimap<QProfileName, ActiveRuleChange>>getValue();
+ Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.getValue();
assertThat(updatedProfiles.keySet())
.extracting(QProfileName::getName, QProfileName::getLanguage)
.containsExactlyInAnyOrder(tuple(builtInQProfileDto.getName(), builtInQProfileDto.getLanguage()));
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/BackupActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/BackupActionTest.java
index 66b83cf7e62..cf37df75faf 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/BackupActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/BackupActionTest.java
@@ -45,7 +45,6 @@ import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.organization.OrganizationDto.Subscription.FREE;
import static org.sonar.db.organization.OrganizationDto.Subscription.PAID;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
public class BackupActionTest {
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangeParentActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangeParentActionTest.java
index dd7ca435cb5..3dac943de56 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangeParentActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangeParentActionTest.java
@@ -69,7 +69,6 @@ import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_PROFILES;
import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_ORGANIZATION;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_QUALITY_PROFILE;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangelogActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangelogActionTest.java
index 074448c81f5..9cc130aa877 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangelogActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ChangelogActionTest.java
@@ -51,7 +51,6 @@ import static java.lang.String.valueOf;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.organization.OrganizationDto.Subscription.PAID;
import static org.sonar.test.JsonAssert.assertJson;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_ORGANIZATION;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ExportActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ExportActionTest.java
index 9beeeb2e4d3..57e712ac9ed 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ExportActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/ExportActionTest.java
@@ -37,7 +37,6 @@ import org.sonar.db.DbTester;
import org.sonar.db.organization.OrganizationDto;
import org.sonar.db.qualityprofile.QProfileDto;
import org.sonar.db.user.UserDto;
-import org.sonar.server.exceptions.BadRequestException;
import org.sonar.server.exceptions.ForbiddenException;
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.language.LanguageTesting;
@@ -51,7 +50,6 @@ import org.sonar.server.ws.WsActionTester;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.organization.OrganizationDto.Subscription.PAID;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_ORGANIZATION;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/InheritanceActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/InheritanceActionTest.java
index 3e054a4fe68..29e25f394d1 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/InheritanceActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/InheritanceActionTest.java
@@ -67,7 +67,6 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.organization.OrganizationDto.Subscription.PAID;
import static org.sonar.test.JsonAssert.assertJson;
import static org.sonarqube.ws.MediaTypes.PROTOBUF;
-import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_ORGANIZATION;
import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE;
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java
index 8f6663eeb13..01670cd58ec 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java
@@ -101,7 +101,7 @@ public class QProfilesWsMediumTest {
private WsActionTester wsActivateRules = new WsActionTester(new ActivateRulesAction(ruleQueryFactory, userSessionRule, qProfileRules, qProfileWsSupport, dbClient));
@Before
- public void setUp() throws Exception {
+ public void setUp() {
organization = dbTester.organizations().insert();
}
@@ -273,7 +273,7 @@ public class QProfilesWsMediumTest {
}
@Test
- public void bulk_activate_rule() throws Exception {
+ public void bulk_activate_rule() {
QProfileDto profile = createProfile("java");
createRule(profile.getLanguage(), "toto");
createRule(profile.getLanguage(), "tata");
@@ -297,7 +297,7 @@ public class QProfilesWsMediumTest {
}
@Test
- public void bulk_activate_rule_not_all() throws Exception {
+ public void bulk_activate_rule_not_all() {
QProfileDto java = createProfile("java");
QProfileDto php = createProfile("php");
createRule(java.getLanguage(), "toto");
@@ -386,7 +386,7 @@ public class QProfilesWsMediumTest {
}
@Test
- public void does_not_return_warnings_when_bulk_activate_on_profile_and_rules_exist_on_another_language_than_profile() throws Exception {
+ public void does_not_return_warnings_when_bulk_activate_on_profile_and_rules_exist_on_another_language_than_profile() {
QProfileDto javaProfile = createProfile("java");
createRule(javaProfile.getLanguage(), "toto");
createRule(javaProfile.getLanguage(), "tata");
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/RemoveProjectActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/RemoveProjectActionTest.java
index 002c724d68e..253084602b7 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/RemoveProjectActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/qualityprofile/ws/RemoveProjectActionTest.java
@@ -199,7 +199,7 @@ public class RemoveProjectActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/ListDefinitionsActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/ListDefinitionsActionTest.java
index 24567637699..0123ef11921 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/ListDefinitionsActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/ListDefinitionsActionTest.java
@@ -92,7 +92,7 @@ public class ListDefinitionsActionTest {
new ListDefinitionsAction(dbClient, TestComponentFinder.from(db), userSession, propertyDefinitions, support));
@Before
- public void setUp() throws Exception {
+ public void setUp() {
project = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()));
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/SetActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/SetActionTest.java
index 6043e4aa23e..8e084d7ae95 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/SetActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/SetActionTest.java
@@ -906,7 +906,7 @@ public class SetActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/SettingsUpdaterTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/SettingsUpdaterTest.java
index 43a2a6cbff0..e28d7254179 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/SettingsUpdaterTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/SettingsUpdaterTest.java
@@ -65,7 +65,7 @@ public class SettingsUpdaterTest {
SettingsUpdater underTest= new SettingsUpdater(dbClient, definitions);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
project = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()));
}
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/ValuesActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/ValuesActionTest.java
index 5c17ab03bd6..a1c92fe3976 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/ValuesActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/setting/ws/ValuesActionTest.java
@@ -95,7 +95,7 @@ public class ValuesActionTest {
private ComponentDto project;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
project = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(db.organizations().insert()));
}
@@ -747,7 +747,7 @@ public class ValuesActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
OrganizationDto organization = db.organizations().insert();
ComponentDto project = db.components().insertMainBranch(organization);
userSession.logIn().addProjectPermission(UserRole.USER, project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/source/ws/RawActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/source/ws/RawActionTest.java
index 60e9e3d6424..7508b35186b 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/source/ws/RawActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/source/ws/RawActionTest.java
@@ -122,7 +122,7 @@ public class RawActionTest {
}
@Test
- public void fail_when_using_branch_db_key() throws Exception {
+ public void fail_when_using_branch_db_key() {
ComponentDto project = db.components().insertMainBranch();
userSession.addProjectPermission(UserRole.CODEVIEWER, project);
ComponentDto branch = db.components().insertProjectBranch(project);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/UpdateLoginActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/UpdateLoginActionTest.java
index 301ee897045..a81ca68c1b1 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/UpdateLoginActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/UpdateLoginActionTest.java
@@ -25,15 +25,11 @@ import org.junit.rules.ExpectedException;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.server.ws.WebService.Param;
import org.sonar.api.utils.System2;
-import org.sonar.core.util.UuidFactoryFast;
import org.sonar.db.DbTester;
import org.sonar.db.user.UserDto;
import org.sonar.server.es.EsTester;
import org.sonar.server.exceptions.ForbiddenException;
import org.sonar.server.exceptions.NotFoundException;
-import org.sonar.server.organization.OrganizationUpdater;
-import org.sonar.server.organization.OrganizationUpdaterImpl;
-import org.sonar.server.organization.OrganizationValidationImpl;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.user.NewUserNotifier;
import org.sonar.server.user.UserUpdater;
@@ -59,13 +55,9 @@ public class UpdateLoginActionTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
- private OrganizationUpdater organizationUpdater = new OrganizationUpdaterImpl(db.getDbClient(), mock(System2.class), UuidFactoryFast.getInstance(),
- new OrganizationValidationImpl(), null, null, null, null);
-
private WsActionTester ws = new WsActionTester(new UpdateLoginAction(db.getDbClient(), userSession,
new UserUpdater(system2, mock(NewUserNotifier.class), db.getDbClient(), new UserIndexer(db.getDbClient(), es.client()),
- null, null, null, null, null),
- organizationUpdater));
+ null, null, null, null, null)));
@Test
public void update_login_from_sonarqube_account_when_user_is_local() {
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/usergroups/ws/AddUserActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/usergroups/ws/AddUserActionTest.java
index 5050def00f0..c0bcade3e9a 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/usergroups/ws/AddUserActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/usergroups/ws/AddUserActionTest.java
@@ -210,7 +210,7 @@ public class AddUserActionTest {
}
@Test
- public void fail_if_not_administrator() throws Exception {
+ public void fail_if_not_administrator() {
GroupDto group = db.users().insertGroup();
UserDto user = db.users().insertUser();
db.organizations().addMember(db.getDefaultOrganization(), user);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/usergroups/ws/DeleteActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/usergroups/ws/DeleteActionTest.java
index 7d96370e5cf..c5c4ad322e5 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/usergroups/ws/DeleteActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/usergroups/ws/DeleteActionTest.java
@@ -259,7 +259,7 @@ public class DeleteActionTest {
}
@Test
- public void delete_admin_group_fails_if_no_admin_users_left() throws Exception {
+ public void delete_admin_group_fails_if_no_admin_users_left() {
// admin users are part of the group to be deleted
OrganizationDto org = db.organizations().insert();
db.users().insertDefaultGroup(org);
@@ -276,7 +276,7 @@ public class DeleteActionTest {
}
@Test
- public void delete_admin_group_succeeds_if_other_groups_have_administrators() throws Exception {
+ public void delete_admin_group_succeeds_if_other_groups_have_administrators() {
OrganizationDto org = db.organizations().insert();
db.users().insertDefaultGroup(org);
GroupDto adminGroup1 = db.users().insertGroup(org, "admins");
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/DeleteActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/DeleteActionTest.java
index 7558aee5679..3fade9563f8 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/DeleteActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/DeleteActionTest.java
@@ -152,7 +152,7 @@ public class DeleteActionTest {
}
@Test
- public void fail_if_not_logged_in() throws Exception {
+ public void fail_if_not_logged_in() {
OrganizationDto organization = organizationDbTester.insert();
WebhookDto dto = webhookDbTester.insertWebhook(organization);
diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ws/ws/ResponseExampleActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ws/ws/ResponseExampleActionTest.java
index a5a389280f9..81a764991d3 100644
--- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ws/ws/ResponseExampleActionTest.java
+++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/ws/ws/ResponseExampleActionTest.java
@@ -31,7 +31,7 @@ public class ResponseExampleActionTest {
private WebService.Action action;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
WebService.NewController newController = context.createController("api/ws");
underTest.define(newController);
newController.done();
diff --git a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/DefaultLocalResponse.java b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/DefaultLocalResponse.java
index 07c11840a16..a55a8c2b1dc 100644
--- a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/DefaultLocalResponse.java
+++ b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/DefaultLocalResponse.java
@@ -20,7 +20,6 @@
package org.sonar.server.ws;
import com.google.common.base.Throwables;
-import com.google.common.collect.Maps;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -28,6 +27,7 @@ import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Map;
import javax.annotation.CheckForNull;
import org.apache.commons.io.IOUtils;
@@ -41,7 +41,7 @@ public class DefaultLocalResponse implements Response, LocalConnector.LocalRespo
private final InMemoryStream stream = new InMemoryStream();
private final ByteArrayOutputStream output = new ByteArrayOutputStream();
- private final Map<String, String> headers = Maps.newHashMap();
+ private final Map<String, String> headers = new HashMap<>();
@Override
public int getStatus() {
diff --git a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/RemovedWebServiceHandlerTest.java b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/RemovedWebServiceHandlerTest.java
index 262a8325845..e300f834aca 100644
--- a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/RemovedWebServiceHandlerTest.java
+++ b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/RemovedWebServiceHandlerTest.java
@@ -36,7 +36,7 @@ public class RemovedWebServiceHandlerTest {
public ExpectedException expectedException = ExpectedException.none();
@Test
- public void throw_server_exception() throws Exception {
+ public void throw_server_exception() {
Request request = mock(Request.class);
when(request.getPath()).thenReturn("/api/resources/index");
diff --git a/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/DumbResponse.java b/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/DumbResponse.java
index f7d2aeedd80..8ff41e5080a 100644
--- a/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/DumbResponse.java
+++ b/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/DumbResponse.java
@@ -20,7 +20,6 @@
package org.sonar.server.ws;
import com.google.common.base.Throwables;
-import com.google.common.collect.Maps;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -28,6 +27,7 @@ import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Map;
import javax.annotation.CheckForNull;
import org.apache.commons.io.IOUtils;
@@ -40,7 +40,7 @@ public class DumbResponse implements Response {
private final ByteArrayOutputStream output = new ByteArrayOutputStream();
- private Map<String, String> headers = Maps.newHashMap();
+ private Map<String, String> headers = new HashMap<>();
public class InMemoryStream implements Response.Stream {
private String mediaType;
@@ -118,7 +118,7 @@ public class DumbResponse implements Response {
}
@CheckForNull
- public String getHeader(String name){
+ public String getHeader(String name) {
return headers.get(name);
}
diff --git a/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/TestRequest.java b/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/TestRequest.java
index aea0e0d69bd..9992319c361 100644
--- a/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/TestRequest.java
+++ b/server/sonar-webserver-ws/src/testFixtures/java/org/sonar/server/ws/TestRequest.java
@@ -23,7 +23,6 @@ import com.google.common.base.Throwables;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ListMultimap;
-import com.google.common.collect.Maps;
import com.google.protobuf.GeneratedMessageV3;
import java.io.BufferedReader;
import java.io.InputStream;
@@ -47,7 +46,7 @@ public class TestRequest extends ValidatingRequest {
private final ListMultimap<String, String> multiParams = ArrayListMultimap.create();
private final Map<String, String> params = new HashMap<>();
private final Map<String, String> headers = new HashMap<>();
- private final Map<String, Part> parts = Maps.newHashMap();
+ private final Map<String, Part> parts = new HashMap<>();
private String payload = "";
private boolean payloadConsumed = false;
private String method = "GET";
diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/MasterServletFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/MasterServletFilter.java
index fc765edffee..973a5e0ad5c 100644
--- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/MasterServletFilter.java
+++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/MasterServletFilter.java
@@ -24,6 +24,7 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import java.io.IOException;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
@@ -122,7 +123,7 @@ public class MasterServletFilter implements Filter {
private static final class GodFilterChain implements FilterChain {
private FilterChain chain;
- private List<Filter> filters = Lists.newLinkedList();
+ private List<Filter> filters = new LinkedList<>();
private Iterator<Filter> iterator;
public GodFilterChain(FilterChain chain) {
diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/app/TomcatContextsTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/app/TomcatContextsTest.java
index b9a0c808d61..ab30626b1de 100644
--- a/server/sonar-webserver/src/test/java/org/sonar/server/app/TomcatContextsTest.java
+++ b/server/sonar-webserver/src/test/java/org/sonar/server/app/TomcatContextsTest.java
@@ -61,7 +61,7 @@ public class TomcatContextsTest {
}
@Test
- public void configure_root_webapp() throws Exception {
+ public void configure_root_webapp() {
props.setProperty("foo", "bar");
StandardContext context = mock(StandardContext.class);
when(tomcat.addWebapp(anyString(), anyString())).thenReturn(context);
diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/MasterServletFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/MasterServletFilterTest.java
index e1b83207b63..f4a4cbf6577 100644
--- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/MasterServletFilterTest.java
+++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/MasterServletFilterTest.java
@@ -129,7 +129,7 @@ public class MasterServletFilterTest {
}
@Test
- public void display_servlet_filter_patterns_in_INFO_log() throws Exception {
+ public void display_servlet_filter_patterns_in_INFO_log() {
ServletFilter filter = new PatternFilter(UrlPattern.builder().includes("/api/issues").excludes("/batch/projects").build());
FilterConfig config = mock(FilterConfig.class);
MasterServletFilter master = new MasterServletFilter();
diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RedirectFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RedirectFilterTest.java
index 255e97509cc..9d39cc6f885 100644
--- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RedirectFilterTest.java
+++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/RedirectFilterTest.java
@@ -44,7 +44,7 @@ public class RedirectFilterTest {
private RedirectFilter underTest = new RedirectFilter();
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(request.getContextPath()).thenReturn("/sonarqube");
}
diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/UserSessionFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/UserSessionFilterTest.java
index 9cb937e245b..c605671fbd5 100644
--- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/UserSessionFilterTest.java
+++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/UserSessionFilterTest.java
@@ -220,7 +220,7 @@ public class UserSessionFilterTest {
}
@Test
- public void just_for_fun_and_coverage() throws ServletException {
+ public void just_for_fun_and_coverage() {
UserSessionFilter filter = new UserSessionFilter();
filter.init(mock(FilterConfig.class));
filter.destroy();
diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesFilterTest.java
index d2949b6afc8..5b44991e0ce 100644
--- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesFilterTest.java
+++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebPagesFilterTest.java
@@ -53,7 +53,7 @@ public class WebPagesFilterTest {
private WebPagesFilter underTest = new WebPagesFilter(webPagesCache);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(servletContext.getContextPath()).thenReturn(TEST_CONTEXT);
}
@@ -85,7 +85,7 @@ public class WebPagesFilterTest {
verifyZeroInteractions(webPagesCache);
}
- class StringOutputStream extends ServletOutputStream {
+ static class StringOutputStream extends ServletOutputStream {
private final StringBuilder buf = new StringBuilder();
StringOutputStream() {
diff --git a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebServiceReroutingFilterTest.java b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebServiceReroutingFilterTest.java
index b10e67ea6fa..f85be9685a4 100644
--- a/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebServiceReroutingFilterTest.java
+++ b/server/sonar-webserver/src/test/java/org/sonar/server/platform/web/WebServiceReroutingFilterTest.java
@@ -19,9 +19,7 @@
*/
package org.sonar.server.platform.web;
-import java.io.IOException;
import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
@@ -53,7 +51,7 @@ public class WebServiceReroutingFilterTest {
private WebServiceReroutingFilter underTest = new WebServiceReroutingFilter(webServiceEngine);
@Before
- public void setUp() throws Exception {
+ public void setUp() {
when(request.getContextPath()).thenReturn("/sonarqube");
}
@@ -65,7 +63,7 @@ public class WebServiceReroutingFilterTest {
}
@Test
- public void redirect_components_update_key() throws Exception {
+ public void redirect_components_update_key() {
when(request.getServletPath()).thenReturn("/api/components/update_key");
when(request.getMethod()).thenReturn("POST");
@@ -75,7 +73,7 @@ public class WebServiceReroutingFilterTest {
}
@Test
- public void redirect_components_bulk_update_key() throws IOException, ServletException {
+ public void redirect_components_bulk_update_key() {
when(request.getServletPath()).thenReturn("/api/components/bulk_update_key");
when(request.getMethod()).thenReturn("POST");
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java
index 249b4506d66..5af521c3ffc 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java
@@ -24,12 +24,12 @@ import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
+import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -454,7 +454,7 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure.
public DefaultIssue setAttribute(String key, @Nullable String value) {
if (attributes == null) {
- attributes = Maps.newHashMap();
+ attributes = new HashMap<>();
}
if (value == null) {
attributes.remove(key);
@@ -472,7 +472,7 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure.
public DefaultIssue setAttributes(@Nullable Map<String, String> map) {
if (map != null) {
if (attributes == null) {
- attributes = Maps.newHashMap();
+ attributes = new HashMap<>();
}
attributes.putAll(map);
}
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/FieldDiffs.java b/sonar-core/src/main/java/org/sonar/core/issue/FieldDiffs.java
index 4d78283df33..ad0252b3634 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/FieldDiffs.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/FieldDiffs.java
@@ -19,12 +19,11 @@
*/
package org.sonar.core.issue;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Maps;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Date;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import javax.annotation.CheckForNull;
@@ -40,8 +39,6 @@ import static com.google.common.base.Strings.isNullOrEmpty;
* @since 3.6
*/
public class FieldDiffs implements Serializable {
-
- public static final Splitter FIELDS_SPLITTER = Splitter.on(',').omitEmptyStrings();
private static final String CHAR_TO_ESCAPE = "|,{}=:";
private String issueKey;
@@ -51,11 +48,11 @@ public class FieldDiffs implements Serializable {
public static final String ENCODING_PREFIX = "{base64:";
public static final String ENCODING_SUFFIX = "}";
- private final Map<String, Diff> diffs = Maps.newLinkedHashMap();
+ private final Map<String, Diff> diffs = new LinkedHashMap<>();
public Map<String, Diff> diffs() {
if (diffs.containsKey(ASSIGNEE)) {
- Map<String, Diff> result = Maps.newLinkedHashMap(diffs);
+ Map<String, Diff> result = new LinkedHashMap<>(diffs);
result.put(ASSIGNEE, decode(result.get(ASSIGNEE)));
return result;
}
@@ -147,8 +144,12 @@ public class FieldDiffs implements Serializable {
if (isNullOrEmpty(s)) {
return diffs;
}
- Iterable<String> fields = FIELDS_SPLITTER.split(s);
- for (String field : fields) {
+
+ for (String field : s.split(",")) {
+ if (field.isEmpty()) {
+ continue;
+ }
+
String[] keyValues = field.split("=", 2);
if (keyValues.length == 2) {
String values = keyValues[1];
@@ -168,8 +169,8 @@ public class FieldDiffs implements Serializable {
@SuppressWarnings("unchecked")
Diff decode(Diff encoded) {
return new Diff(
- decodeField(encoded.oldValue),
- decodeField(encoded.newValue)
+ decodeField(encoded.oldValue),
+ decodeField(encoded.newValue)
);
}
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/tracking/AbstractTracker.java b/sonar-core/src/main/java/org/sonar/core/issue/tracking/AbstractTracker.java
index 8e53bab6487..297ca12d95f 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/tracking/AbstractTracker.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/tracking/AbstractTracker.java
@@ -26,7 +26,6 @@ import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Nonnull;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.issue.Issue;
import org.sonar.api.rule.RuleKey;
import static java.util.Comparator.comparing;
diff --git a/sonar-core/src/main/java/org/sonar/core/util/DefaultHttpDownloader.java b/sonar-core/src/main/java/org/sonar/core/util/DefaultHttpDownloader.java
index 89fcb8c6eda..4de994ab31d 100644
--- a/sonar-core/src/main/java/org/sonar/core/util/DefaultHttpDownloader.java
+++ b/sonar-core/src/main/java/org/sonar/core/util/DefaultHttpDownloader.java
@@ -292,7 +292,7 @@ public class DefaultHttpDownloader extends HttpDownloader {
InputStream resultingInputStream;
// create the appropriate stream wrapper based on the encoding type
- if (encoding != null && "gzip".equalsIgnoreCase(encoding)) {
+ if ("gzip".equalsIgnoreCase(encoding)) {
resultingInputStream = new GZIPInputStream(connection.getInputStream());
} else {
resultingInputStream = connection.getInputStream();
diff --git a/sonar-core/src/main/java/org/sonar/core/util/HttpsTrust.java b/sonar-core/src/main/java/org/sonar/core/util/HttpsTrust.java
index 1c01662a117..e7dace7f4f8 100644
--- a/sonar-core/src/main/java/org/sonar/core/util/HttpsTrust.java
+++ b/sonar-core/src/main/java/org/sonar/core/util/HttpsTrust.java
@@ -27,7 +27,6 @@ import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
@@ -78,12 +77,7 @@ class HttpsTrust {
* Trust all hosts
*/
private static HostnameVerifier createHostnameVerifier() {
- return new HostnameVerifier() {
- @Override
- public boolean verify(String hostname, SSLSession session) {
- return true;
- }
- };
+ return (hostname, session) -> true;
}
static class AlwaysTrustManager implements X509TrustManager {
diff --git a/sonar-core/src/main/java/org/sonar/core/util/logs/DefaultProfiler.java b/sonar-core/src/main/java/org/sonar/core/util/logs/DefaultProfiler.java
index 41495170336..1ae54876789 100644
--- a/sonar-core/src/main/java/org/sonar/core/util/logs/DefaultProfiler.java
+++ b/sonar-core/src/main/java/org/sonar/core/util/logs/DefaultProfiler.java
@@ -21,7 +21,6 @@ package org.sonar.core.util.logs;
import java.util.LinkedHashMap;
import java.util.Map;
-import java.util.Objects;
import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.utils.System2;
@@ -213,7 +212,7 @@ class DefaultProfiler extends Profiler {
if (sb.length() > 0) {
sb.append(CONTEXT_SEPARATOR);
}
- sb.append(entry.getKey()).append("=").append(Objects.toString(entry.getValue()));
+ sb.append(entry.getKey()).append("=").append(entry.getValue());
}
}
diff --git a/sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java b/sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java
index 9ca8301ad29..0631c1a4b65 100644
--- a/sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/util/DefaultHttpDownloaderTest.java
@@ -268,7 +268,7 @@ public class DefaultHttpDownloaderTest {
@Test
public void shouldGetProxySynthesis() throws URISyntaxException {
ProxySelector proxySelector = mock(ProxySelector.class);
- when(proxySelector.select(any(URI.class))).thenReturn(Arrays.<Proxy>asList(new FakeProxy()));
+ when(proxySelector.select(any(URI.class))).thenReturn(Arrays.asList(new FakeProxy()));
assertThat(DefaultHttpDownloader.BaseHttpDownloader.getProxySynthesis(new URI("http://an_url"), proxySelector)).isEqualTo("HTTP proxy: /123.45.67.89:4040");
}
diff --git a/sonar-core/src/test/java/org/sonar/core/util/ProgressLoggerTest.java b/sonar-core/src/test/java/org/sonar/core/util/ProgressLoggerTest.java
index cd88fcd4cdf..965f11f2ead 100644
--- a/sonar-core/src/test/java/org/sonar/core/util/ProgressLoggerTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/util/ProgressLoggerTest.java
@@ -69,6 +69,6 @@ public class ProgressLoggerTest {
}
private boolean hasInfoLog(String expectedLog) {
- return logTester.logs(LoggerLevel.INFO).stream().filter(s -> s.startsWith(expectedLog)).findFirst().isPresent();
+ return logTester.logs(LoggerLevel.INFO).stream().anyMatch(s -> s.startsWith(expectedLog));
}
}
diff --git a/sonar-core/src/test/java/org/sonar/core/util/ProtobufJsonFormatTest.java b/sonar-core/src/test/java/org/sonar/core/util/ProtobufJsonFormatTest.java
index 954b2b3e395..3f0bf2a88bd 100644
--- a/sonar-core/src/test/java/org/sonar/core/util/ProtobufJsonFormatTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/util/ProtobufJsonFormatTest.java
@@ -184,7 +184,7 @@ public class ProtobufJsonFormatTest {
}
@Test
- public void write_map_of_arrays() throws Exception {
+ public void write_map_of_arrays() {
// this is a trick to have arrays in map values
TestMapOfArray.Builder msg = TestMapOfArray.newBuilder();
@@ -198,7 +198,7 @@ public class ProtobufJsonFormatTest {
}
@Test
- public void write_map_of_map() throws Exception {
+ public void write_map_of_map() {
// this is a trick to have maps in map values
TestMapOfMap.Builder msg = TestMapOfMap.newBuilder();
diff --git a/sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java b/sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java
index 713c33f217a..72068dfc2be 100644
--- a/sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/util/stream/MoreCollectorsTest.java
@@ -77,7 +77,7 @@ public class MoreCollectorsTest {
@Test
public void toList_builds_an_ImmutableList() {
- List<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toList());
+ List<Integer> res = Stream.of(1, 2, 3, 4, 5).collect(toList());
assertThat(res).isInstanceOf(ImmutableList.class)
.containsExactly(1, 2, 3, 4, 5);
}
@@ -89,7 +89,7 @@ public class MoreCollectorsTest {
@Test
public void toList_with_size_builds_an_ImmutableList() {
- List<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toList(30));
+ List<Integer> res = Stream.of(1, 2, 3, 4, 5).collect(toList(30));
assertThat(res).isInstanceOf(ImmutableList.class)
.containsExactly(1, 2, 3, 4, 5);
}
@@ -101,7 +101,7 @@ public class MoreCollectorsTest {
@Test
public void toSet_builds_an_ImmutableSet() {
- Set<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toSet());
+ Set<Integer> res = Stream.of(1, 2, 3, 4, 5).collect(toSet());
assertThat(res).isInstanceOf(ImmutableSet.class)
.containsExactly(1, 2, 3, 4, 5);
}
@@ -139,7 +139,7 @@ public class MoreCollectorsTest {
@Test
public void toArrayList_builds_an_ArrayList() {
- List<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toArrayList());
+ List<Integer> res = Stream.of(1, 2, 3, 4, 5).collect(toArrayList());
assertThat(res).isInstanceOf(ArrayList.class)
.containsExactly(1, 2, 3, 4, 5);
}
@@ -151,7 +151,7 @@ public class MoreCollectorsTest {
@Test
public void toArrayList_with_size_builds_an_ArrayList() {
- List<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toArrayList(30));
+ List<Integer> res = Stream.of(1, 2, 3, 4, 5).collect(toArrayList(30));
assertThat(res).isInstanceOf(ArrayList.class)
.containsExactly(1, 2, 3, 4, 5);
}
@@ -163,7 +163,7 @@ public class MoreCollectorsTest {
@Test
public void toHashSet_builds_an_HashSet() {
- Set<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toHashSet());
+ Set<Integer> res = Stream.of(1, 2, 3, 4, 5).collect(toHashSet());
assertThat(res).isInstanceOf(HashSet.class)
.containsExactly(1, 2, 3, 4, 5);
}
@@ -175,7 +175,7 @@ public class MoreCollectorsTest {
@Test
public void toHashSet_with_size_builds_an_ArrayList() {
- Set<Integer> res = Arrays.asList(1, 2, 3, 4, 5).stream().collect(toHashSet(30));
+ Set<Integer> res = Stream.of(1, 2, 3, 4, 5).collect(toHashSet(30));
assertThat(res).isInstanceOf(HashSet.class)
.containsExactly(1, 2, 3, 4, 5);
}
@@ -568,11 +568,6 @@ public class MoreCollectorsTest {
assertThat(multimap.keySet()).isEqualTo(HUGE_SET);
}
-
-
-
-
-
@Test
public void unorderedFlattenIndex_empty_stream_returns_empty_map() {
assertThat(Collections.<MyObj2>emptyList().stream()
@@ -639,29 +634,6 @@ public class MoreCollectorsTest {
assertThat(multimap.keySet()).isEqualTo(HUGE_SET);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@Test
public void join_on_empty_stream_returns_empty_string() {
assertThat(Collections.emptyList().stream().collect(join(Joiner.on(",")))).isEmpty();
@@ -677,7 +649,7 @@ public class MoreCollectorsTest {
@Test
public void join_applies_joiner_to_stream() {
- assertThat(Arrays.asList("1", "2", "3", "4").stream().collect(join(Joiner.on(","))))
+ assertThat(Stream.of("1", "2", "3", "4").collect(join(Joiner.on(","))))
.isEqualTo("1,2,3,4");
}
@@ -693,7 +665,7 @@ public class MoreCollectorsTest {
@Test
public void join_supports_null_if_joiner_does() {
- Stream<String> stream = Arrays.asList("1", null).stream();
+ Stream<String> stream = Stream.of("1", null);
expectedException.expect(NullPointerException.class);
diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java
index bc7a20bdd16..e2adf71f69e 100644
--- a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java
+++ b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java
@@ -67,7 +67,7 @@ public class TokenEntry implements Comparable<TokenEntry> {
i = TOKENS.size() + 1;
TOKENS.put(image, i);
}
- this.identifier = i.intValue();
+ this.identifier = i;
this.tokenSrcID = tokenSrcID;
this.beginLine = beginLine;
this.index = tokenCount++;
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/ContainsInComparator.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/ContainsInComparator.java
index efea70410c8..31b1481270c 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/ContainsInComparator.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/ContainsInComparator.java
@@ -34,25 +34,17 @@ public final class ContainsInComparator implements Comparator<ClonePart> {
/**
* Defines order by resourceId.
*/
- public static final Comparator<ClonePart> RESOURCE_ID_COMPARATOR = new Comparator<ClonePart>() {
- @Override
- public int compare(ClonePart o1, ClonePart o2) {
- return FastStringComparator.INSTANCE.compare(o1.getResourceId(), o2.getResourceId());
- }
- };
+ public static final Comparator<ClonePart> RESOURCE_ID_COMPARATOR = (o1, o2) -> FastStringComparator.INSTANCE.compare(o1.getResourceId(), o2.getResourceId());
/**
* Defines order by resourceId and by unitStart.
*/
- public static final Comparator<ClonePart> CLONEPART_COMPARATOR = new Comparator<ClonePart>() {
- @Override
- public int compare(ClonePart o1, ClonePart o2) {
- int c = RESOURCE_ID_COMPARATOR.compare(o1, o2);
- if (c == 0) {
- return o1.getUnitStart() - o2.getUnitStart();
- }
- return c;
+ public static final Comparator<ClonePart> CLONEPART_COMPARATOR = (o1, o2) -> {
+ int c = RESOURCE_ID_COMPARATOR.compare(o1, o2);
+ if (c == 0) {
+ return o1.getUnitStart() - o2.getUnitStart();
}
+ return c;
};
private final int l1;
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/statement/matcher/UptoTokenMatcher.java b/sonar-duplications/src/main/java/org/sonar/duplications/statement/matcher/UptoTokenMatcher.java
index e8ccfb4018e..52d0fe18cd9 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/statement/matcher/UptoTokenMatcher.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/statement/matcher/UptoTokenMatcher.java
@@ -19,6 +19,7 @@
*/
package org.sonar.duplications.statement.matcher;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -41,9 +42,7 @@ public class UptoTokenMatcher extends TokenMatcher {
// otherwise we will always try to consume everything, but will never succeed
throw new IllegalArgumentException();
}
- for (String uptoMatchToken : uptoMatchTokens) {
- this.uptoMatchTokens.add(uptoMatchToken);
- }
+ this.uptoMatchTokens.addAll(Arrays.asList(uptoMatchTokens));
}
@Override
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/detector/original/BlocksGroupTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/detector/original/BlocksGroupTest.java
index e21de0e8756..f44d6c4b70c 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/detector/original/BlocksGroupTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/detector/original/BlocksGroupTest.java
@@ -19,6 +19,7 @@
*/
package org.sonar.duplications.detector.original;
+import java.util.Arrays;
import org.junit.Test;
import org.sonar.duplications.block.Block;
@@ -40,9 +41,7 @@ public class BlocksGroupTest {
public static BlocksGroup newBlocksGroup(Block... blocks) {
BlocksGroup result = BlocksGroup.empty();
- for (Block block : blocks) {
- result.blocks.add(block);
- }
+ result.blocks.addAll(Arrays.asList(blocks));
return result;
}
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/index/DataUtilsTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/index/DataUtilsTest.java
index 4825849122f..058161a8ee7 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/index/DataUtilsTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/index/DataUtilsTest.java
@@ -63,7 +63,7 @@ public class DataUtilsTest {
assertThat(DataUtils.binarySearch(sortable), is(2));
}
- class SimpleSortable implements DataUtils.Sortable {
+ static class SimpleSortable implements DataUtils.Sortable {
private final int[] a;
private final int size;
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/TokenizerBridgeTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/TokenizerBridgeTest.java
index 43636a71f66..23e6c0e4603 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/TokenizerBridgeTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/internal/pmd/TokenizerBridgeTest.java
@@ -20,7 +20,6 @@
package org.sonar.duplications.internal.pmd;
import java.io.ByteArrayInputStream;
-import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.List;
@@ -42,7 +41,7 @@ public class TokenizerBridgeTest {
@Before
public void setUp() {
Tokenizer tokenizer = new Tokenizer() {
- public void tokenize(SourceCode tokens, Tokens tokenEntries) throws IOException {
+ public void tokenize(SourceCode tokens, Tokens tokenEntries) {
tokenEntries.add(new TokenEntry("t1", "src", 1));
tokenEntries.add(new TokenEntry("t2", "src", 1));
tokenEntries.add(new TokenEntry("t3", "src", 2));
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/java/JavaDuplicationsFunctionalTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/java/JavaDuplicationsFunctionalTest.java
index 75966a19091..8d8f8ab2010 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/java/JavaDuplicationsFunctionalTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/java/JavaDuplicationsFunctionalTest.java
@@ -19,6 +19,7 @@
*/
package org.sonar.duplications.java;
+import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.junit.Test;
@@ -33,7 +34,6 @@ import org.sonar.duplications.statement.Statement;
import org.sonar.duplications.statement.StatementChunker;
import org.sonar.duplications.token.TokenChunker;
-import static java.util.Arrays.asList;
import static java.util.stream.Collectors.joining;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@@ -149,7 +149,7 @@ public class JavaDuplicationsFunctionalTest {
}
private String source(String... lines) {
- return asList(lines).stream().collect(joining("\n"));
+ return Arrays.stream(lines).collect(joining("\n"));
}
private static List<CloneGroup> detect2(String... fragments) {
@@ -180,7 +180,7 @@ public class JavaDuplicationsFunctionalTest {
private static BlockChunker BLOCK_CHUNKER = new BlockChunker(BLOCK_SIZE);
private List<CloneGroup> detect(String... lines) {
- String sourceCode = asList(lines).stream().collect(joining("\n"));
+ String sourceCode = Arrays.stream(lines).collect(joining("\n"));
MemoryCloneIndex index = new MemoryCloneIndex();
List<Statement> statements = STATEMENT_CHUNKER.chunk(TOKEN_CHUNKER.chunk(sourceCode));
List<Block> blocks = BLOCK_CHUNKER.chunk("resourceId", statements);
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementTest.java
index 9762da77fba..f11a6f90fff 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/statement/StatementTest.java
@@ -37,7 +37,7 @@ public class StatementTest {
@Test(expected = IllegalArgumentException.class)
public void shouldNotAcceptEmpty() {
- new Statement(new ArrayList<Token>());
+ new Statement(new ArrayList<>());
}
@Test
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/predicates/AbsolutePathPredicate.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/predicates/AbsolutePathPredicate.java
index 56414c5c951..acb17f03062 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/predicates/AbsolutePathPredicate.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/predicates/AbsolutePathPredicate.java
@@ -53,7 +53,7 @@ class AbsolutePathPredicate extends AbstractFilePredicate {
return Collections.emptyList();
}
InputFile f = index.inputFile(relative);
- return f != null ? Arrays.asList(f) : Collections.<InputFile>emptyList();
+ return f != null ? Arrays.asList(f) : Collections.emptyList();
}
@Override
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/predicates/URIPredicate.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/predicates/URIPredicate.java
index 8dd2a301563..25552add6e4 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/predicates/URIPredicate.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/predicates/URIPredicate.java
@@ -55,7 +55,7 @@ class URIPredicate extends AbstractFilePredicate {
return Collections.emptyList();
}
InputFile f = index.inputFile(relative.get());
- return f != null ? Arrays.asList(f) : Collections.<InputFile>emptyList();
+ return f != null ? Arrays.asList(f) : Collections.emptyList();
}
@Override
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/DefaultSensorDescriptor.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/DefaultSensorDescriptor.java
index ef29870e1c5..bfddd446f11 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/DefaultSensorDescriptor.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/sensor/internal/DefaultSensorDescriptor.java
@@ -27,8 +27,6 @@ import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.sensor.SensorDescriptor;
import org.sonar.api.config.Configuration;
-import static java.util.Arrays.asList;
-
public class DefaultSensorDescriptor implements SensorDescriptor {
private String name;
@@ -104,7 +102,7 @@ public class DefaultSensorDescriptor implements SensorDescriptor {
@Override
public DefaultSensorDescriptor requireProperties(String... propertyKeys) {
- this.configurationPredicate = config -> asList(propertyKeys).stream().allMatch(config::hasKey);
+ this.configurationPredicate = config -> Arrays.stream(propertyKeys).allMatch(config::hasKey);
return this;
}
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java
index ab25411b6b2..b7d3aee4830 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java
@@ -66,6 +66,6 @@ public class AlwaysIncreasingSystem2 extends System2 {
}
private static long randomInitialValue() {
- return (long) Math.abs(new Random().nextInt(2_000_000));
+ return Math.abs(new Random().nextInt(2_000_000));
}
}
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/WorkDuration.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/WorkDuration.java
index 20349ba155c..a57c1ba5d11 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/WorkDuration.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/WorkDuration.java
@@ -78,31 +78,31 @@ public class WorkDuration implements Serializable {
int minutes = 0;
long time = duration;
- Long currentTime = time / WorkDuration.DAY_POSITION_IN_LONG;
+ long currentTime = time / WorkDuration.DAY_POSITION_IN_LONG;
if (currentTime > 0) {
- days = currentTime.intValue();
+ days = (int) currentTime;
time = time - (currentTime * WorkDuration.DAY_POSITION_IN_LONG);
}
currentTime = time / WorkDuration.HOUR_POSITION_IN_LONG;
if (currentTime > 0) {
- hours = currentTime.intValue();
+ hours = (int) currentTime;
time = time - (currentTime * WorkDuration.HOUR_POSITION_IN_LONG);
}
currentTime = time / WorkDuration.MINUTE_POSITION_IN_LONG;
if (currentTime > 0) {
- minutes = currentTime.intValue();
+ minutes = (int) currentTime;
}
return WorkDuration.create(days, hours, minutes, hoursInDay);
}
static WorkDuration createFromMinutes(long duration, int hoursInDay) {
int days = (int)(duration / (double)hoursInDay / 60.0);
- Long currentDurationInMinutes = duration - (60L * days * hoursInDay);
+ long currentDurationInMinutes = duration - (60L * days * hoursInDay);
int hours = (int)(currentDurationInMinutes / 60.0);
currentDurationInMinutes = currentDurationInMinutes - (60L * hours);
- return new WorkDuration(duration, days, hours, currentDurationInMinutes.intValue(), hoursInDay);
+ return new WorkDuration(duration, days, hours, (int) currentDurationInMinutes, hoursInDay);
}
/**
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultFileSystemTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultFileSystemTest.java
index 8038cbad3ba..37eaef51f90 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultFileSystemTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultFileSystemTest.java
@@ -20,7 +20,7 @@
package org.sonar.api.batch.fs.internal.fs;
import java.io.File;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -62,8 +62,8 @@ public class DefaultFileSystemTest {
@Test
public void test_encoding() throws Exception {
- fs.setEncoding(Charset.forName("ISO-8859-1"));
- assertThat(fs.encoding()).isEqualTo(Charset.forName("ISO-8859-1"));
+ fs.setEncoding(StandardCharsets.ISO_8859_1);
+ assertThat(fs.encoding()).isEqualTo(StandardCharsets.ISO_8859_1);
}
@Test
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultInputDirTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultInputDirTest.java
index 531f611bf0e..a17826aaf4a 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultInputDirTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultInputDirTest.java
@@ -47,7 +47,7 @@ public class DefaultInputDirTest {
}
@Test
- public void testEqualsAndHashCode() throws Exception {
+ public void testEqualsAndHashCode() {
DefaultInputDir inputDir1 = new DefaultInputDir("ABCDE", "src");
DefaultInputDir inputDir2 = new DefaultInputDir("ABCDE", "src");
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultInputFileTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultInputFileTest.java
index 06e341a40b0..605e736f723 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultInputFileTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/DefaultInputFileTest.java
@@ -33,7 +33,6 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
-import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.junit.Before;
import org.junit.Rule;
@@ -50,7 +49,6 @@ import org.sonar.api.batch.fs.internal.SensorStrategy;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
public class DefaultInputFileTest {
@@ -74,7 +72,7 @@ public class DefaultInputFileTest {
}
@Test
- public void test() throws Exception {
+ public void test() {
Metadata metadata = new Metadata(42, 42, "", new int[0], new int[0], 10);
DefaultInputFile inputFile = new DefaultInputFile(indexedFile, (f) -> f.setMetadata(metadata))
@@ -152,7 +150,7 @@ public class DefaultInputFileTest {
}
@Test
- public void test_equals_and_hashcode() throws Exception {
+ public void test_equals_and_hashcode() {
DefaultInputFile f1 = new DefaultInputFile(new DefaultIndexedFile("ABCDE", Paths.get("module"), MODULE_RELATIVE_PATH, null), (f) -> mock(Metadata.class));
DefaultInputFile f1a = new DefaultInputFile(new DefaultIndexedFile("ABCDE", Paths.get("module"), MODULE_RELATIVE_PATH, null), (f) -> mock(Metadata.class));
DefaultInputFile f2 = new DefaultInputFile(new DefaultIndexedFile("ABCDE", Paths.get("module"), "src/Bar.php", null), (f) -> mock(Metadata.class));
@@ -168,7 +166,7 @@ public class DefaultInputFileTest {
}
@Test
- public void test_toString() throws Exception {
+ public void test_toString() {
DefaultInputFile file = new DefaultInputFile(new DefaultIndexedFile("ABCDE", Paths.get("module"), MODULE_RELATIVE_PATH, null), (f) -> mock(Metadata.class));
assertThat(file.toString()).isEqualTo(MODULE_RELATIVE_PATH);
}
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/PathPatternTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/PathPatternTest.java
index 312e908a700..c20082c1049 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/PathPatternTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/fs/PathPatternTest.java
@@ -59,7 +59,7 @@ public class PathPatternTest {
}
@Test
- public void match_relative_path_and_insensitive_file_extension() throws Exception {
+ public void match_relative_path_and_insensitive_file_extension() {
PathPattern pattern = PathPattern.create("**/*Foo.java");
IndexedFile indexedFile = new DefaultIndexedFile("ABCDE", baseDir, "src/main/java/org/MyFoo.JAVA", null);
@@ -70,7 +70,7 @@ public class PathPatternTest {
}
@Test
- public void match_absolute_path() throws Exception {
+ public void match_absolute_path() {
PathPattern pattern = PathPattern.create("file:**/src/main/**Foo.java");
assertThat(pattern.toString()).isEqualTo("file:**/src/main/**Foo.java");
@@ -86,7 +86,7 @@ public class PathPatternTest {
}
@Test
- public void match_absolute_path_and_insensitive_file_extension() throws Exception {
+ public void match_absolute_path_and_insensitive_file_extension() {
PathPattern pattern = PathPattern.create("file:**/src/main/**Foo.java");
assertThat(pattern.toString()).isEqualTo("file:**/src/main/**Foo.java");
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/predicates/DefaultFilePredicatesTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/predicates/DefaultFilePredicatesTest.java
index e47bd8abf1f..d55320b73f4 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/predicates/DefaultFilePredicatesTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/predicates/DefaultFilePredicatesTest.java
@@ -166,7 +166,7 @@ public class DefaultFilePredicatesTest {
public void has_languages() {
assertThat(predicates.hasLanguages(Arrays.asList("java", "php")).apply(javaFile)).isTrue();
assertThat(predicates.hasLanguages(Arrays.asList("cobol", "php")).apply(javaFile)).isFalse();
- assertThat(predicates.hasLanguages(Collections.<String>emptyList()).apply(javaFile)).isTrue();
+ assertThat(predicates.hasLanguages(Collections.emptyList()).apply(javaFile)).isTrue();
}
@Test
@@ -193,7 +193,7 @@ public class DefaultFilePredicatesTest {
// empty
assertThat(predicates.and().apply(javaFile)).isTrue();
assertThat(predicates.and(new FilePredicate[0]).apply(javaFile)).isTrue();
- assertThat(predicates.and(Collections.<FilePredicate>emptyList()).apply(javaFile)).isTrue();
+ assertThat(predicates.and(Collections.emptyList()).apply(javaFile)).isTrue();
// two arguments
assertThat(predicates.and(predicates.all(), predicates.all()).apply(javaFile)).isTrue();
@@ -214,7 +214,7 @@ public class DefaultFilePredicatesTest {
// empty
assertThat(predicates.or().apply(javaFile)).isTrue();
assertThat(predicates.or(new FilePredicate[0]).apply(javaFile)).isTrue();
- assertThat(predicates.or(Collections.<FilePredicate>emptyList()).apply(javaFile)).isTrue();
+ assertThat(predicates.or(Collections.emptyList()).apply(javaFile)).isTrue();
// two arguments
assertThat(predicates.or(predicates.all(), predicates.all()).apply(javaFile)).isTrue();
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/predicates/FilenamePredicateTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/predicates/FilenamePredicateTest.java
index 2ec9b1b44b6..1cddd2302f2 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/predicates/FilenamePredicateTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/batch/fs/internal/predicates/FilenamePredicateTest.java
@@ -19,7 +19,6 @@
*/
package org.sonar.api.batch.fs.internal.predicates;
-import java.io.IOException;
import java.util.Collections;
import org.junit.Test;
import org.sonar.api.batch.fs.FileSystem;
@@ -31,7 +30,7 @@ import static org.mockito.Mockito.when;
public class FilenamePredicateTest {
@Test
- public void should_match_file_by_filename() throws IOException {
+ public void should_match_file_by_filename() {
String filename = "some name";
InputFile inputFile = mock(InputFile.class);
when(inputFile.filename()).thenReturn(filename);
@@ -40,7 +39,7 @@ public class FilenamePredicateTest {
}
@Test
- public void should_not_match_file_by_different_filename() throws IOException {
+ public void should_not_match_file_by_different_filename() {
String filename = "some name";
InputFile inputFile = mock(InputFile.class);
when(inputFile.filename()).thenReturn(filename + "x");
@@ -49,7 +48,7 @@ public class FilenamePredicateTest {
}
@Test
- public void should_find_matching_file_in_index() throws IOException {
+ public void should_find_matching_file_in_index() {
String filename = "some name";
InputFile inputFile = mock(InputFile.class);
when(inputFile.filename()).thenReturn(filename);
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/impl/utils/ScannerUtilsTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/impl/utils/ScannerUtilsTest.java
index 0390d1faf90..13edac978e0 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/impl/utils/ScannerUtilsTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/impl/utils/ScannerUtilsTest.java
@@ -43,7 +43,7 @@ public class ScannerUtilsTest {
assertThat(ScannerUtils.describe(new TestClass())).isEqualTo("overridden");
}
- class TestClass {
+ static class TestClass {
@Override
public String toString() {
return "overridden";
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/impl/utils/WorkDurationTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/impl/utils/WorkDurationTest.java
index 3c1e2f971ff..710e3c84bbb 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/impl/utils/WorkDurationTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/impl/utils/WorkDurationTest.java
@@ -178,7 +178,7 @@ public class WorkDurationTest {
}
@Test
- public void test_equals_and_hashcode() throws Exception {
+ public void test_equals_and_hashcode() {
WorkDuration duration = WorkDuration.createFromLong(28800, HOURS_IN_DAY);
WorkDuration durationWithSameValue = WorkDuration.createFromLong(28800, HOURS_IN_DAY);
WorkDuration durationWithDifferentValue = WorkDuration.createFromLong(14400, HOURS_IN_DAY);
@@ -194,7 +194,7 @@ public class WorkDurationTest {
}
@Test
- public void test_toString() throws Exception {
+ public void test_toString() {
assertThat(WorkDuration.createFromLong(28800, HOURS_IN_DAY).toString()).isNotNull();
}
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java
index c63f94ce6eb..982bdd51026 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java
@@ -30,6 +30,6 @@ public enum CoverageType {
UNIT,
IT,
- OVERALL;
+ OVERALL
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasure.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasure.java
index 5454dce79e4..16dd1c5e0d7 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasure.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/test/TestMeasure.java
@@ -60,7 +60,7 @@ public class TestMeasure implements Measure {
public static TestMeasure createMeasure(boolean booleanValue) {
TestMeasure measure = new TestMeasure();
- measure.booleanValue = requireNonNull(booleanValue, "Value cannot be null");
+ measure.booleanValue = booleanValue;
return measure;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
index ce894f30de9..eddd2c1bc7f 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
@@ -344,7 +344,7 @@ public final class PropertyDefinition {
public static final class Result {
private static final Result SUCCESS = new Result(null);
- private String errorKey = null;
+ private String errorKey;
@Nullable
private Result(@Nullable String errorKey) {
@@ -532,7 +532,7 @@ public final class PropertyDefinition {
public Builder options(String first, String... rest) {
this.options.add(first);
- stream(rest).forEach(o -> options.add(o));
+ options.addAll(asList(rest));
return this;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleParamType.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleParamType.java
index dc03c136617..b90ac71b386 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleParamType.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RuleParamType.java
@@ -64,7 +64,7 @@ public final class RuleParamType {
if (multiple) {
sb.append(OPTION_SEPARATOR);
sb.append(MULTIPLE_PARAM + PARAMETER_SEPARATOR);
- sb.append(Boolean.toString(multiple));
+ sb.append(multiple);
}
if (values.length > 0) {
sb.append(OPTION_SEPARATOR);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
index 2fdd1ba58b8..24f629447b6 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
@@ -499,7 +499,7 @@ public interface RulesDefinition {
}
enum OwaspTop10 {
- A1, A2, A3, A4, A5, A6, A7, A8, A9, A10;
+ A1, A2, A3, A4, A5, A6, A7, A8, A9, A10
}
interface ExtendedRepository {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java
index b15337a4a44..3c47010e53a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Duration.java
@@ -104,10 +104,10 @@ public class Duration implements Serializable {
*/
public String encode(int hoursInDay) {
int days = ((Double) ((double) durationInMinutes / hoursInDay / MINUTES_IN_ONE_HOUR)).intValue();
- Long remainingDuration = durationInMinutes - (days * hoursInDay * MINUTES_IN_ONE_HOUR);
- int hours = ((Double) (remainingDuration.doubleValue() / MINUTES_IN_ONE_HOUR)).intValue();
+ long remainingDuration = durationInMinutes - (days * hoursInDay * MINUTES_IN_ONE_HOUR);
+ int hours = ((Double) ((double) remainingDuration / MINUTES_IN_ONE_HOUR)).intValue();
remainingDuration = remainingDuration - (hours * MINUTES_IN_ONE_HOUR);
- int minutes = remainingDuration.intValue();
+ int minutes = (int) remainingDuration;
StringBuilder stringBuilder = new StringBuilder();
if (days > 0) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java
index 88c057937a4..3b4618fdabe 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java
@@ -104,18 +104,18 @@ public class Durations {
*
*/
public String format(Duration duration) {
- Long durationInMinutes = duration.toMinutes();
+ long durationInMinutes = duration.toMinutes();
if (durationInMinutes == 0) {
return "0";
}
boolean isNegative = durationInMinutes < 0;
- Long absDuration = Math.abs(durationInMinutes);
+ long absDuration = Math.abs(durationInMinutes);
int days = ((Double) ((double) absDuration / HOURS_IN_DAY / 60)).intValue();
- Long remainingDuration = absDuration - (days * HOURS_IN_DAY * 60);
- int hours = ((Double) (remainingDuration.doubleValue() / 60)).intValue();
+ long remainingDuration = absDuration - (days * HOURS_IN_DAY * 60);
+ int hours = ((Double) ((double) remainingDuration / 60)).intValue();
remainingDuration = remainingDuration - (hours * 60);
- int minutes = remainingDuration.intValue();
+ int minutes = (int) remainingDuration;
return format(days, hours, minutes, isNegative);
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/DefaultProfiler.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/DefaultProfiler.java
index 6b62138ed6b..67884ff598e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/DefaultProfiler.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/log/DefaultProfiler.java
@@ -25,7 +25,6 @@ import org.sonar.api.utils.System2;
import javax.annotation.Nullable;
import java.util.LinkedHashMap;
import java.util.Map;
-import java.util.Objects;
class DefaultProfiler extends Profiler {
@@ -165,7 +164,7 @@ class DefaultProfiler extends Profiler {
if (sb.length() > 0) {
sb.append(CONTEXT_SEPARATOR);
}
- sb.append(entry.getKey()).append("=").append(Objects.toString(entry.getValue()));
+ sb.append(entry.getKey()).append("=").append(entry.getValue());
}
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestComponentTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestComponentTest.java
index 2b7cf2f123a..8a63e99b5ca 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestComponentTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestComponentTest.java
@@ -32,7 +32,7 @@ public class TestComponentTest {
public ExpectedException thrown = ExpectedException.none();
@Test
- public void create_project() throws Exception {
+ public void create_project() {
TestComponent component = new TestComponent("Project", Component.Type.PROJECT, null);
assertThat(component.getKey()).isEqualTo("Project");
@@ -40,7 +40,7 @@ public class TestComponentTest {
}
@Test
- public void create_source_file() throws Exception {
+ public void create_source_file() {
TestComponent component = new TestComponent("File", Component.Type.FILE, new TestComponent.FileAttributesImpl("xoo", false));
assertThat(component.getType()).isEqualTo(Component.Type.FILE);
@@ -49,7 +49,7 @@ public class TestComponentTest {
}
@Test
- public void create_test_file() throws Exception {
+ public void create_test_file() {
TestComponent component = new TestComponent("File", Component.Type.FILE, new TestComponent.FileAttributesImpl(null, true));
assertThat(component.getType()).isEqualTo(Component.Type.FILE);
@@ -58,7 +58,7 @@ public class TestComponentTest {
}
@Test
- public void fail_with_ISE_when_calling_get_file_attributes_on_not_file() throws Exception {
+ public void fail_with_ISE_when_calling_get_file_attributes_on_not_file() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Only component of type FILE have a FileAttributes object");
@@ -67,7 +67,7 @@ public class TestComponentTest {
}
@Test
- public void fail_with_IAE_when_trying_to_create_a_file_without_file_attributes() throws Exception {
+ public void fail_with_IAE_when_trying_to_create_a_file_without_file_attributes() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("omponent of type FILE must have a FileAttributes object");
@@ -75,7 +75,7 @@ public class TestComponentTest {
}
@Test
- public void fail_with_IAE_when_trying_to_create_not_a_file_with_file_attributes() throws Exception {
+ public void fail_with_IAE_when_trying_to_create_not_a_file_with_file_attributes() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Only component of type FILE have a FileAttributes object");
@@ -83,7 +83,7 @@ public class TestComponentTest {
}
@Test
- public void fail_with_NPE_when_creating_component_without_key() throws Exception {
+ public void fail_with_NPE_when_creating_component_without_key() {
thrown.expect(NullPointerException.class);
thrown.expectMessage("Key cannot be null");
@@ -91,7 +91,7 @@ public class TestComponentTest {
}
@Test
- public void fail_with_NPE_when_creating_component_without_type() throws Exception {
+ public void fail_with_NPE_when_creating_component_without_type() {
thrown.expect(NullPointerException.class);
thrown.expectMessage("Type cannot be null");
@@ -99,7 +99,7 @@ public class TestComponentTest {
}
@Test
- public void test_equals_and_hashcode() throws Exception {
+ public void test_equals_and_hashcode() {
TestComponent component = new TestComponent("Project1", Component.Type.PROJECT, null);
TestComponent sameComponent = new TestComponent("Project1", Component.Type.PROJECT, null);
TestComponent anotherComponent = new TestComponent("Project2", Component.Type.PROJECT, null);
@@ -115,7 +115,7 @@ public class TestComponentTest {
}
@Test
- public void test_to_string() throws Exception {
+ public void test_to_string() {
assertThat(new TestComponent("File", Component.Type.FILE, new TestComponent.FileAttributesImpl("xoo", true)).toString())
.isEqualTo("ComponentImpl{key=File, type='FILE', fileAttributes=FileAttributesImpl{languageKey='xoo', unitTest=true}}");
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestIssueTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestIssueTest.java
index c81d395990c..aeb7ce0a88e 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestIssueTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestIssueTest.java
@@ -36,7 +36,7 @@ public class TestIssueTest {
public ExpectedException thrown = ExpectedException.none();
@Test
- public void create_issue() throws Exception {
+ public void create_issue() {
Issue issue = new TestIssue.Builder()
.setKey("ABCD")
.setRuleKey(RuleKey.of("xoo", "S01"))
@@ -56,7 +56,7 @@ public class TestIssueTest {
}
@Test
- public void create_issue_with_minimal_fields() throws Exception {
+ public void create_issue_with_minimal_fields() {
Issue issue = new TestIssue.Builder()
.setKey("ABCD")
.setRuleKey(RuleKey.of("xoo", "S01"))
@@ -70,7 +70,7 @@ public class TestIssueTest {
}
@Test
- public void fail_with_NPE_when_building_issue_without_key() throws Exception {
+ public void fail_with_NPE_when_building_issue_without_key() {
thrown.expect(NullPointerException.class);
thrown.expectMessage("key cannot be null");
@@ -84,7 +84,7 @@ public class TestIssueTest {
}
@Test
- public void fail_with_NPE_when_creating_issue_with_null_key() throws Exception {
+ public void fail_with_NPE_when_creating_issue_with_null_key() {
thrown.expect(NullPointerException.class);
thrown.expectMessage("key cannot be null");
@@ -92,7 +92,7 @@ public class TestIssueTest {
}
@Test
- public void fail_with_NPE_when_building_issue_without_rule_key() throws Exception {
+ public void fail_with_NPE_when_building_issue_without_rule_key() {
thrown.expect(NullPointerException.class);
thrown.expectMessage("ruleKey cannot be null");
@@ -106,7 +106,7 @@ public class TestIssueTest {
}
@Test
- public void fail_with_NPE_when_creating_issue_with_null_rule_key() throws Exception {
+ public void fail_with_NPE_when_creating_issue_with_null_rule_key() {
thrown.expect(NullPointerException.class);
thrown.expectMessage("ruleKey cannot be null");
@@ -114,7 +114,7 @@ public class TestIssueTest {
}
@Test
- public void fail_with_IAE_when_building_issue_with_invalid_resolution() throws Exception {
+ public void fail_with_IAE_when_building_issue_with_invalid_resolution() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("resolution 'unknown' is invalid");
@@ -129,7 +129,7 @@ public class TestIssueTest {
}
@Test
- public void fail_with_NPE_when_building_issue_without_severity() throws Exception {
+ public void fail_with_NPE_when_building_issue_without_severity() {
thrown.expect(NullPointerException.class);
thrown.expectMessage("severity cannot be null");
@@ -143,7 +143,7 @@ public class TestIssueTest {
}
@Test
- public void fail_with_NPE_when_creating_issue_with_null_severity() throws Exception {
+ public void fail_with_NPE_when_creating_issue_with_null_severity() {
thrown.expect(NullPointerException.class);
thrown.expectMessage("severity cannot be null");
@@ -151,7 +151,7 @@ public class TestIssueTest {
}
@Test
- public void fail_with_IAE_when_building_issue_with_invalid_severity() throws Exception {
+ public void fail_with_IAE_when_building_issue_with_invalid_severity() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("severity 'unknown' is invalid");
@@ -166,7 +166,7 @@ public class TestIssueTest {
}
@Test
- public void fail_with_NPE_when_building_issue_without_status() throws Exception {
+ public void fail_with_NPE_when_building_issue_without_status() {
thrown.expect(NullPointerException.class);
thrown.expectMessage("status cannot be null");
@@ -180,7 +180,7 @@ public class TestIssueTest {
}
@Test
- public void fail_with_NPE_when_creating_issue_with_null_status() throws Exception {
+ public void fail_with_NPE_when_creating_issue_with_null_status() {
thrown.expect(NullPointerException.class);
thrown.expectMessage("status cannot be null");
@@ -188,7 +188,7 @@ public class TestIssueTest {
}
@Test
- public void fail_with_IAE_when_building_issue_with_invalid_status() throws Exception {
+ public void fail_with_IAE_when_building_issue_with_invalid_status() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("status 'unknown' is invalid");
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureComputerContextTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureComputerContextTest.java
index a79f1820d4e..fa0658905e3 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureComputerContextTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureComputerContextTest.java
@@ -54,52 +54,52 @@ public class TestMeasureComputerContextTest {
TestMeasureComputerContext underTest = new TestMeasureComputerContext(PROJECT, settings, DEFINITION);
@Test
- public void get_component() throws Exception {
+ public void get_component() {
assertThat(underTest.getComponent()).isEqualTo(PROJECT);
}
@Test
- public void get_settings() throws Exception {
+ public void get_settings() {
assertThat(underTest.getSettings()).isEqualTo(settings);
}
@Test
- public void get_int_measure() throws Exception {
+ public void get_int_measure() {
underTest.addInputMeasure(INPUT_METRIC, 10);
assertThat(underTest.getMeasure(INPUT_METRIC).getIntValue()).isEqualTo(10);
}
@Test
- public void get_double_measure() throws Exception {
+ public void get_double_measure() {
underTest.addInputMeasure(INPUT_METRIC, 10d);
assertThat(underTest.getMeasure(INPUT_METRIC).getDoubleValue()).isEqualTo(10d);
}
@Test
- public void get_long_measure() throws Exception {
+ public void get_long_measure() {
underTest.addInputMeasure(INPUT_METRIC, 10L);
assertThat(underTest.getMeasure(INPUT_METRIC).getLongValue()).isEqualTo(10L);
}
@Test
- public void get_string_measure() throws Exception {
+ public void get_string_measure() {
underTest.addInputMeasure(INPUT_METRIC, "text");
assertThat(underTest.getMeasure(INPUT_METRIC).getStringValue()).isEqualTo("text");
}
@Test
- public void get_boolean_measure() throws Exception {
+ public void get_boolean_measure() {
underTest.addInputMeasure(INPUT_METRIC, true);
assertThat(underTest.getMeasure(INPUT_METRIC).getBooleanValue()).isTrue();
}
@Test
- public void fail_with_IAE_when_trying_to_get_measure_on_unknown_metric() throws Exception {
+ public void fail_with_IAE_when_trying_to_get_measure_on_unknown_metric() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Only metrics in [INPUT_METRIC] can be used to load measures");
@@ -107,35 +107,35 @@ public class TestMeasureComputerContextTest {
}
@Test
- public void get_int_children_measures() throws Exception {
+ public void get_int_children_measures() {
underTest.addChildrenMeasures(INPUT_METRIC, 10, 20);
assertThat(underTest.getChildrenMeasures(INPUT_METRIC)).hasSize(2);
}
@Test
- public void get_doublet_children_measures() throws Exception {
+ public void get_doublet_children_measures() {
underTest.addChildrenMeasures(INPUT_METRIC, 10d, 20d);
assertThat(underTest.getChildrenMeasures(INPUT_METRIC)).hasSize(2);
}
@Test
- public void get_long_children_measures() throws Exception {
+ public void get_long_children_measures() {
underTest.addChildrenMeasures(INPUT_METRIC, 10L, 20L);
assertThat(underTest.getChildrenMeasures(INPUT_METRIC)).hasSize(2);
}
@Test
- public void get_string_children_measures() throws Exception {
+ public void get_string_children_measures() {
underTest.addChildrenMeasures(INPUT_METRIC, "value1", "value2");
assertThat(underTest.getChildrenMeasures(INPUT_METRIC)).hasSize(2);
}
@Test
- public void fail_with_IAE_when_trying_to_get_children_measures_on_unknown_metric() throws Exception {
+ public void fail_with_IAE_when_trying_to_get_children_measures_on_unknown_metric() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Only metrics in [INPUT_METRIC] can be used to load measures");
@@ -143,35 +143,35 @@ public class TestMeasureComputerContextTest {
}
@Test
- public void add_int_measure() throws Exception {
+ public void add_int_measure() {
underTest.addMeasure(OUTPUT_METRIC, 10);
assertThat(underTest.getMeasure(OUTPUT_METRIC).getIntValue()).isEqualTo(10);
}
@Test
- public void add_double_measure() throws Exception {
+ public void add_double_measure() {
underTest.addMeasure(OUTPUT_METRIC, 10d);
assertThat(underTest.getMeasure(OUTPUT_METRIC).getDoubleValue()).isEqualTo(10d);
}
@Test
- public void add_long_measure() throws Exception {
+ public void add_long_measure() {
underTest.addMeasure(OUTPUT_METRIC, 10L);
assertThat(underTest.getMeasure(OUTPUT_METRIC).getLongValue()).isEqualTo(10L);
}
@Test
- public void add_string_measure() throws Exception {
+ public void add_string_measure() {
underTest.addMeasure(OUTPUT_METRIC, "text");
assertThat(underTest.getMeasure(OUTPUT_METRIC).getStringValue()).isEqualTo("text");
}
@Test
- public void fail_with_IAE_when_trying_to_add_measure_on_unknown_metric() throws Exception {
+ public void fail_with_IAE_when_trying_to_add_measure_on_unknown_metric() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Only metrics in [OUTPUT_METRIC] can be used to add measures. Metric 'unknown' is not allowed");
@@ -179,7 +179,7 @@ public class TestMeasureComputerContextTest {
}
@Test
- public void fail_with_IAE_when_trying_to_add_measure_on_input_metric() throws Exception {
+ public void fail_with_IAE_when_trying_to_add_measure_on_input_metric() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Only metrics in [OUTPUT_METRIC] can be used to add measures. Metric 'INPUT_METRIC' is not allowed");
@@ -187,7 +187,7 @@ public class TestMeasureComputerContextTest {
}
@Test
- public void fail_with_UOE_when_trying_to_add_same_measures_twice() throws Exception {
+ public void fail_with_UOE_when_trying_to_add_same_measures_twice() {
thrown.expect(UnsupportedOperationException.class);
thrown.expectMessage("A measure on metric 'OUTPUT_METRIC' already exists");
@@ -196,7 +196,7 @@ public class TestMeasureComputerContextTest {
}
@Test
- public void get_issues() throws Exception {
+ public void get_issues() {
Issue issue = new TestIssue.Builder()
.setKey("ABCD")
.setRuleKey(RuleKey.of("xoo", "S01"))
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureTest.java
index dfc85e07014..664ade7c22d 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestMeasureTest.java
@@ -31,32 +31,32 @@ public class TestMeasureTest {
public ExpectedException thrown = ExpectedException.none();
@Test
- public void create_double_measure() throws Exception {
+ public void create_double_measure() {
assertThat(TestMeasure.createMeasure(10d).getDoubleValue()).isEqualTo(10d);
}
@Test
- public void create_int_measure() throws Exception {
+ public void create_int_measure() {
assertThat(TestMeasure.createMeasure(10).getIntValue()).isEqualTo(10);
}
@Test
- public void create_long_measure() throws Exception {
+ public void create_long_measure() {
assertThat(TestMeasure.createMeasure(10L).getLongValue()).isEqualTo(10L);
}
@Test
- public void create_string_measure() throws Exception {
+ public void create_string_measure() {
assertThat(TestMeasure.createMeasure("value").getStringValue()).isEqualTo("value");
}
@Test
- public void create_boolean_measure() throws Exception {
+ public void create_boolean_measure() {
assertThat(TestMeasure.createMeasure(true).getBooleanValue()).isTrue();
}
@Test
- public void getDoubleValue_fails_with_ISE_when_not_a_double() throws Exception {
+ public void getDoubleValue_fails_with_ISE_when_not_a_double() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Not a double measure");
@@ -64,7 +64,7 @@ public class TestMeasureTest {
}
@Test
- public void getIntValue_fails_with_ISE_when_not_an_int() throws Exception {
+ public void getIntValue_fails_with_ISE_when_not_an_int() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Not an integer measure");
@@ -72,7 +72,7 @@ public class TestMeasureTest {
}
@Test
- public void getLongValue_fails_with_ISE_when_not_a_long() throws Exception {
+ public void getLongValue_fails_with_ISE_when_not_a_long() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Not a long measure");
@@ -80,7 +80,7 @@ public class TestMeasureTest {
}
@Test
- public void getStringValue_fails_with_ISE_when_not_a_string() throws Exception {
+ public void getStringValue_fails_with_ISE_when_not_a_string() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Not a string measure");
@@ -88,7 +88,7 @@ public class TestMeasureTest {
}
@Test
- public void getBooleanValue_fails_with_ISE_when_not_a_boolean() throws Exception {
+ public void getBooleanValue_fails_with_ISE_when_not_a_boolean() {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Not a boolean measure");
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestSettingsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestSettingsTest.java
index c58a7e0287f..250960d8759 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestSettingsTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/ce/measure/test/TestSettingsTest.java
@@ -28,7 +28,7 @@ public class TestSettingsTest {
TestSettings underTest = new TestSettings();
@Test
- public void get_string_value() throws Exception {
+ public void get_string_value() {
underTest.setValue("key", "value");
assertThat(underTest.getString("key")).isEqualTo("value");
@@ -36,7 +36,7 @@ public class TestSettingsTest {
}
@Test
- public void get_string_array_value() throws Exception {
+ public void get_string_array_value() {
underTest.setValue("key", "value1,value2");
assertThat(underTest.getStringArray("key")).containsOnly("value1", "value2");
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTest.java
index 0a0573fa145..d3e0be87ae2 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/ce/posttask/PostProjectAnalysisTaskTest.java
@@ -36,11 +36,8 @@ public class PostProjectAnalysisTaskTest {
@Test
public void default_implementation_of_finished_ProjectAnalysis_throws_ISE() {
- PostProjectAnalysisTask underTest = new PostProjectAnalysisTask() {
- @Override
- public String getDescription() {
- throw new UnsupportedOperationException("getDescription not implemented");
- }
+ PostProjectAnalysisTask underTest = () -> {
+ throw new UnsupportedOperationException("getDescription not implemented");
};
try {
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/ConfigurationTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/ConfigurationTest.java
index d351bdcf9ad..fc01bf2d43f 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/config/ConfigurationTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/ConfigurationTest.java
@@ -104,9 +104,9 @@ public class ConfigurationTest {
String randomKey = RandomStringUtils.randomAlphabetic(3);
String randomNumberOfWhitespaces = StringUtils.repeat(" ", 1 + new Random().nextInt(10));
- assertThat(t.apply(underTest.put(randomKey, randomNumberOfWhitespaces + String.valueOf(value)), randomKey)).isEqualTo(Optional.of(value));
- assertThat(t.apply(underTest.put(randomKey, String.valueOf(value) + randomNumberOfWhitespaces), randomKey)).isEqualTo(Optional.of(value));
- assertThat(t.apply(underTest.put(randomKey, randomNumberOfWhitespaces + String.valueOf(value) + randomNumberOfWhitespaces), randomKey)).isEqualTo(Optional.of(value));
+ assertThat(t.apply(underTest.put(randomKey, randomNumberOfWhitespaces + value), randomKey)).isEqualTo(Optional.of(value));
+ assertThat(t.apply(underTest.put(randomKey, value + randomNumberOfWhitespaces), randomKey)).isEqualTo(Optional.of(value));
+ assertThat(t.apply(underTest.put(randomKey, randomNumberOfWhitespaces + value + randomNumberOfWhitespaces), randomKey)).isEqualTo(Optional.of(value));
}
private static class DumpMapConfiguration implements Configuration {
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/AnnotationProfileParserTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/AnnotationProfileParserTest.java
index 0822ab1fa6d..9b6e7a4e913 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/AnnotationProfileParserTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/AnnotationProfileParserTest.java
@@ -21,7 +21,6 @@ package org.sonar.api.profiles;
import com.google.common.collect.Lists;
import org.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.sonar.api.rules.Rule;
import org.sonar.api.rules.RuleFinder;
@@ -40,14 +39,11 @@ public class AnnotationProfileParserTest {
@Test
public void shouldParseAnnotatedClasses() {
RuleFinder ruleFinder = mock(RuleFinder.class);
- when(ruleFinder.findByKey(anyString(), anyString())).thenAnswer(new Answer<Rule>() {
- public Rule answer(InvocationOnMock iom) throws Throwable {
- return Rule.create((String) iom.getArguments()[0], (String) iom.getArguments()[1], (String) iom.getArguments()[1]);
- }
- });
+ when(ruleFinder.findByKey(anyString(), anyString())).thenAnswer(
+ (Answer) iom -> Rule.create((String) iom.getArguments()[0], (String) iom.getArguments()[1], (String) iom.getArguments()[1]));
ValidationMessages messages = ValidationMessages.create();
- RulesProfile profile = new AnnotationProfileParser(ruleFinder).parse("squid", "Foo way", "java", Lists.<Class>newArrayList(FakeRule.class), messages);
+ RulesProfile profile = new AnnotationProfileParser(ruleFinder).parse("squid", "Foo way", "java", Lists.newArrayList(FakeRule.class), messages);
assertThat(profile.getName()).isEqualTo("Foo way");
assertThat(profile.getLanguage()).isEqualTo("java");
@@ -58,14 +54,11 @@ public class AnnotationProfileParserTest {
@Test
public void shouldParseOnlyWantedProfile() {
RuleFinder ruleFinder = mock(RuleFinder.class);
- when(ruleFinder.findByKey(anyString(), anyString())).thenAnswer(new Answer<Rule>() {
- public Rule answer(InvocationOnMock iom) throws Throwable {
- return Rule.create((String) iom.getArguments()[0], (String) iom.getArguments()[1], (String) iom.getArguments()[1]);
- }
- });
+ when(ruleFinder.findByKey(anyString(), anyString())).thenAnswer(
+ (Answer<Rule>) iom -> Rule.create((String) iom.getArguments()[0], (String) iom.getArguments()[1], (String) iom.getArguments()[1]));
ValidationMessages messages = ValidationMessages.create();
- RulesProfile profile = new AnnotationProfileParser(ruleFinder).parse("squid", "Foo way", "java", Lists.<Class>newArrayList(FakeRule.class, RuleOnOtherProfile.class), messages);
+ RulesProfile profile = new AnnotationProfileParser(ruleFinder).parse("squid", "Foo way", "java", Lists.newArrayList(FakeRule.class, RuleOnOtherProfile.class), messages);
assertThat(profile.getActiveRule("squid", "fake")).isNotNull();
assertThat(profile.getActiveRule("squid", "other")).isNull();
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java
index ad0da0d7af0..b8716632ad1 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileParserTest.java
@@ -92,7 +92,7 @@ public class XMLProfileParserTest {
private RuleFinder newRuleFinder() {
RuleFinder ruleFinder = mock(RuleFinder.class);
when(ruleFinder.findByKey(anyString(), anyString())).thenAnswer(new Answer<Rule>() {
- public Rule answer(InvocationOnMock iom) throws Throwable {
+ public Rule answer(InvocationOnMock iom) {
Rule rule = Rule.create((String) iom.getArguments()[0], (String) iom.getArguments()[1], (String) iom.getArguments()[1]);
rule.createParameter("format");
rule.createParameter("message");
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java
index 10628f7d167..4945fe5159a 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java
@@ -70,7 +70,7 @@ public class XMLProfileSerializerTest {
assertSimilarXml("exportRuleParameters.xml", writer.toString());
}
- private void assertSimilarXml(String fileWithExpectedXml, String xml) throws IOException, SAXException {
+ private void assertSimilarXml(String fileWithExpectedXml, String xml) throws IOException {
String pathToExpectedXml = "XMLProfileSerializerTest/" + fileWithExpectedXml;
assertThat(xml).isXmlEqualTo(IOUtils.toString(getClass().getResource(pathToExpectedXml)));
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/AbstractLanguageTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/AbstractLanguageTest.java
index 60ae4bf9de9..cd10a007b68 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/AbstractLanguageTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/AbstractLanguageTest.java
@@ -69,7 +69,7 @@ public class AbstractLanguageTest {
new TooLongKeyLanguage();
}
- class TooLongKeyLanguage extends AbstractLanguage {
+ static class TooLongKeyLanguage extends AbstractLanguage {
public TooLongKeyLanguage() {
super("aKeyWhichIsVeryVeryVeryVeryVeryLong");
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/profile/BuiltInQualityProfilesDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/profile/BuiltInQualityProfilesDefinitionTest.java
index 8a39a8eb93f..d0f9e059611 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/server/profile/BuiltInQualityProfilesDefinitionTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/profile/BuiltInQualityProfilesDefinitionTest.java
@@ -158,7 +158,7 @@ public class BuiltInQualityProfilesDefinitionTest {
return context.profilesByLanguageAndName();
}
- private class FakeProfile implements BuiltInQualityProfilesDefinition {
+ private static class FakeProfile implements BuiltInQualityProfilesDefinition {
private Consumer<Context> consumer;
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleParamTypeTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleParamTypeTest.java
index 22563a49e4d..284c24ed79c 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleParamTypeTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleParamTypeTest.java
@@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class RuleParamTypeTest {
@Test
- public void testEquals() throws Exception {
+ public void testEquals() {
RuleParamType noOptions = RuleParamType.INTEGER;
RuleParamType withOptions1 = RuleParamType.singleListOfValues("one", "two");
RuleParamType withOptions2 = RuleParamType.singleListOfValues("three", "four");
@@ -47,12 +47,12 @@ public class RuleParamTypeTest {
}
@Test
- public void testHashCode() throws Exception {
+ public void testHashCode() {
assertThat(RuleParamType.INTEGER.hashCode()).isEqualTo(RuleParamType.INTEGER.hashCode());
}
@Test
- public void testInteger() throws Exception {
+ public void testInteger() {
RuleParamType type = RuleParamType.INTEGER;
assertThat(type.toString()).isEqualTo("INTEGER");
assertThat(RuleParamType.parse(type.toString()).type()).isEqualTo("INTEGER");
@@ -61,7 +61,7 @@ public class RuleParamTypeTest {
}
@Test
- public void testListOfValues() throws Exception {
+ public void testListOfValues() {
RuleParamType selectList = RuleParamType.parse("SINGLE_SELECT_LIST,values=\"foo,bar\",");
assertThat(selectList.type()).isEqualTo("SINGLE_SELECT_LIST");
assertThat(selectList.values()).containsOnly("foo", "bar");
@@ -89,7 +89,7 @@ public class RuleParamTypeTest {
}
@Test
- public void testMultipleListOfValues() throws Exception {
+ public void testMultipleListOfValues() {
RuleParamType selectList = RuleParamType.parse("SINGLE_SELECT_LIST,values=\"foo,bar\",multiple=true");
assertThat(selectList.type()).isEqualTo("SINGLE_SELECT_LIST");
assertThat(selectList.values()).containsOnly("foo", "bar");
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleTagsToTypeConverterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleTagsToTypeConverterTest.java
index ac20d1742d6..224147a7e54 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleTagsToTypeConverterTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RuleTagsToTypeConverterTest.java
@@ -45,7 +45,7 @@ public class RuleTagsToTypeConverterTest {
@Test
public void default_is_code_smell() {
assertThat(convert(asList("clumsy", "spring"))).isEqualTo(RuleType.CODE_SMELL);
- assertThat(convert(Collections.<String>emptyList())).isEqualTo(RuleType.CODE_SMELL);
+ assertThat(convert(Collections.emptyList())).isEqualTo(RuleType.CODE_SMELL);
}
@Test
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest.java
index 37a06e8f645..23870ccdf3e 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest.java
@@ -21,7 +21,6 @@ package org.sonar.api.server.rule;
import java.io.InputStream;
import java.io.StringReader;
-import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
@@ -103,7 +102,7 @@ public class RulesDefinitionXmlLoaderTest {
}
@Test
- public void test_utf8_encoding() throws UnsupportedEncodingException {
+ public void test_utf8_encoding() {
InputStream input = getClass().getResourceAsStream("RulesDefinitionXmlLoaderTest/utf8.xml");
RulesDefinition.Repository repository = load(input, StandardCharsets.UTF_8.name());
@@ -132,7 +131,7 @@ public class RulesDefinitionXmlLoaderTest {
}
@Test
- public void test_linear_remediation_function() throws Exception {
+ public void test_linear_remediation_function() {
String xml = "" +
"<rules>" +
" <rule>" +
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultRepositoryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultRepositoryTest.java
index c6f443ceb55..e3be29a4e3c 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultRepositoryTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/internal/DefaultRepositoryTest.java
@@ -21,6 +21,7 @@ package org.sonar.api.server.rule.internal;
import org.junit.Test;
import org.sonar.api.impl.server.RulesDefinitionContext;
+import org.sonar.api.server.rule.RulesDefinition;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@@ -41,7 +42,7 @@ public class DefaultRepositoryTest {
assertThat(repo.language()).isEqualTo("lang");
assertThat(repo.isExternal()).isFalse();
assertThat(repo.name()).isEqualTo("name");
- assertThat(repo.rules()).extracting(r -> r.key()).containsOnly("rule1");
+ assertThat(repo.rules()).extracting(RulesDefinition.Rule::key).containsOnly("rule1");
}
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/user/UserGroupValidationTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/user/UserGroupValidationTest.java
index 027e7cf820b..5cf2eaeec14 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/user/UserGroupValidationTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/user/UserGroupValidationTest.java
@@ -30,7 +30,7 @@ public class UserGroupValidationTest {
public ExpectedException thrown = ExpectedException.none();
@Test
- public void fail_when_group_name_is_Anyone() throws Exception {
+ public void fail_when_group_name_is_Anyone() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Anyone group cannot be used");
@@ -38,7 +38,7 @@ public class UserGroupValidationTest {
}
@Test
- public void fail_when_group_name_is_empty() throws Exception {
+ public void fail_when_group_name_is_empty() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Group name cannot be empty");
@@ -46,7 +46,7 @@ public class UserGroupValidationTest {
}
@Test
- public void fail_when_group_name_contains_only_blank() throws Exception {
+ public void fail_when_group_name_contains_only_blank() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Group name cannot be empty");
@@ -54,7 +54,7 @@ public class UserGroupValidationTest {
}
@Test
- public void fail_when_group_name_is_too_big() throws Exception {
+ public void fail_when_group_name_is_too_big() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Group name cannot be longer than 255 characters");
@@ -62,7 +62,7 @@ public class UserGroupValidationTest {
}
@Test
- public void fail_when_group_name_is_null() throws Exception {
+ public void fail_when_group_name_is_null() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Group name cannot be empty");
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java
index e97edbc5e77..eb57720a9dd 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/user/UserQueryTest.java
@@ -30,7 +30,7 @@ import static org.junit.Assert.fail;
public class UserQueryTest {
@Test
- public void test_all_actives() throws Exception {
+ public void test_all_actives() {
assertThat(UserQuery.ALL_ACTIVES.includeDeactivated()).isFalse();
assertThat(UserQuery.ALL_ACTIVES.logins()).isNull();
assertThat(UserQuery.ALL_ACTIVES.searchText()).isNull();
@@ -38,14 +38,14 @@ public class UserQueryTest {
}
@Test
- public void test_all() throws Exception {
+ public void test_all() {
UserQuery all = UserQuery.builder().includeDeactivated().build();
assertThat(all.includeDeactivated()).isTrue();
assertThat(all.logins()).isNull();
}
@Test
- public void test_logins() throws Exception {
+ public void test_logins() {
UserQuery query = UserQuery.builder().logins("simon", "loic").build();
assertThat(query.includeDeactivated()).isFalse();
assertThat(query.logins()).containsOnly("simon", "loic");
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/FieldUtils2Test.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/FieldUtils2Test.java
index a8bb1f612cc..944fd8e1aac 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/FieldUtils2Test.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/FieldUtils2Test.java
@@ -19,16 +19,11 @@
*/
package org.sonar.api.utils;
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-import org.junit.Test;
-
-import javax.annotation.Nullable;
-
import java.lang.reflect.Field;
import java.util.List;
+import java.util.stream.Collectors;
+import org.junit.Test;
-import static com.google.common.collect.Lists.newArrayList;
import static org.assertj.core.api.Assertions.assertThat;
public class FieldUtils2Test {
@@ -82,16 +77,11 @@ public class FieldUtils2Test {
assertThat(fields).contains("INTERFACE_FIELD");
}
- private static List<String> fieldsName(List<Field> fields){
- return newArrayList(Iterables.transform(fields, new Function<Field, String>() {
- @Override
- public String apply(@Nullable Field input) {
- return input != null ? input.getName() : null;
- }
- }));
+ private static List<String> fieldsName(List<Field> fields) {
+ return fields.stream().map(f -> f != null ? f.getName() : null).collect(Collectors.toList());
}
- static interface InterfaceWithFields {
+ interface InterfaceWithFields {
String INTERFACE_FIELD = "foo";
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/System2Test.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/System2Test.java
index ec4d0aac177..9210b27b40f 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/System2Test.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/System2Test.java
@@ -111,7 +111,7 @@ public class System2Test {
boolean isClosed = false;
@Override
- public void close() throws IOException {
+ public void close() {
isClosed = true;
}
}
@@ -123,11 +123,8 @@ public class System2Test {
@Test
public void close_throws_exception_on_error() {
- Closeable closeable = new Closeable() {
- @Override
- public void close() throws IOException {
- throw new IOException("expected");
- }
+ Closeable closeable = () -> {
+ throw new IOException("expected");
};
try {
System2.INSTANCE.close(closeable);
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/ZipUtilsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/ZipUtilsTest.java
index b3c24c13c01..0e7add40c45 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/ZipUtilsTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/ZipUtilsTest.java
@@ -19,7 +19,6 @@
*/
package org.sonar.api.utils;
-import com.google.common.collect.Iterators;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -27,7 +26,6 @@ import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.apache.commons.io.FileUtils;
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java
index 38843fdf122..f5ae62ee079 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/DefaultProfilerTest.java
@@ -33,7 +33,7 @@ public class DefaultProfilerTest {
Profiler underTest = Profiler.create(Loggers.get("DefaultProfilerTest"));
@Test
- public void test_levels() throws Exception {
+ public void test_levels() {
// info by default
assertThat(underTest.isDebugEnabled()).isFalse();
assertThat(underTest.isTraceEnabled()).isFalse();
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogbackLoggerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogbackLoggerTest.java
index 99f8e7edd59..3257055e2b7 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogbackLoggerTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/utils/log/LogbackLoggerTest.java
@@ -25,7 +25,6 @@ import org.junit.Test;
import org.slf4j.LoggerFactory;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.fail;
public class LogbackLoggerTest {
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/LogOutput.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/LogOutput.java
index 6bc0aa9607f..f121c58f62f 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/LogOutput.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/LogOutput.java
@@ -29,6 +29,6 @@ public interface LogOutput {
void log(String formattedMessage, Level level);
enum Level {
- ERROR, WARN, INFO, DEBUG, TRACE;
+ ERROR, WARN, INFO, DEBUG, TRACE
}
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploder.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploder.java
index 5baf3fe4766..2ccbacb35bb 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploder.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploder.java
@@ -53,8 +53,7 @@ public class ScannerPluginJarExploder extends PluginJarExploder {
File destDir = new File(cachedFile.getParentFile(), filename + "_unzip");
File lockFile = new File(cachedFile.getParentFile(), filename + "_unzip.lock");
if (!destDir.exists()) {
- FileOutputStream out = new FileOutputStream(lockFile);
- try {
+ try (FileOutputStream out = new FileOutputStream(lockFile)) {
java.nio.channels.FileLock lock = out.getChannel().lock();
try {
// Recheck in case of concurrent processes
@@ -67,7 +66,6 @@ public class ScannerPluginJarExploder extends PluginJarExploder {
lock.release();
}
} finally {
- out.close();
deleteQuietly(lockFile);
}
}
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializer.java
index 2d98081334b..7851457ce2d 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializer.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/ignore/pattern/IssueExclusionPatternInitializer.java
@@ -49,7 +49,7 @@ public class IssueExclusionPatternInitializer extends AbstractPatternInitializer
return hasFileContentPattern() || hasMulticriteriaPatterns();
}
- private final void loadFileContentPatterns() {
+ private void loadFileContentPatterns() {
// Patterns Block
blockPatterns = new ArrayList<>();
for (String id : getSettings().getStringArray(IssueExclusionProperties.PATTERNS_BLOCK_KEY)) {
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/MetricsRepository.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/MetricsRepository.java
index bee3e234c34..792b3e1071c 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/MetricsRepository.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/MetricsRepository.java
@@ -19,14 +19,13 @@
*/
package org.sonar.scanner.repository;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.sonar.api.measures.Metric;
public class MetricsRepository {
- private Collection<Metric> metrics = new ArrayList<>();
+ private Collection<Metric> metrics;
public MetricsRepository(List<Metric> metrics) {
this.metrics = metrics;
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java
index ae44ad23660..3218a520fc6 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorBuilder.java
@@ -185,7 +185,7 @@ public class ProjectReactorBuilder {
}
private void checkUnsupportedIssueExclusions(Map<String, String> moduleProperties, Map<String, String> parentProps) {
- UNSUPPORTED_PROPS_FOR_MODULES.stream().forEach(p -> {
+ UNSUPPORTED_PROPS_FOR_MODULES.forEach(p -> {
if (moduleProperties.containsKey(p) && !Objects.equals(moduleProperties.get(p), parentProps.get(p))) {
warnOnceUnsupportedIssueExclusions(
"Specifying issue exclusions at module level is not supported anymore. Configure the property '" + p + "' and any other issue exclusions at project level.");
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java
index 7843536d19b..c93e5685d4f 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java
@@ -20,7 +20,6 @@
package org.sonar.scanner.scan.branch;
import java.util.List;
-import javax.annotation.Nullable;
import org.sonar.api.scanner.ScannerSide;
@ScannerSide
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java
index 27fa806da8b..8b0ba3c1430 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.batch.bootstrapper;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
@@ -42,7 +42,7 @@ public class LoggingConfigurationTest {
@Test
public void testSetVerboseAnalysis() {
- Map<String, String> props = Maps.newHashMap();
+ Map<String, String> props = new HashMap<>();
LoggingConfiguration conf = new LoggingConfiguration(null).setProperties(props);
assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_ROOT_DEFAULT);
@@ -65,7 +65,7 @@ public class LoggingConfigurationTest {
@Test
public void test_deprecated_log_properties() {
- Map<String, String> properties = Maps.newHashMap();
+ Map<String, String> properties = new HashMap<>();
assertThat(new LoggingConfiguration(null).setProperties(properties)
.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_ROOT_DEFAULT);
@@ -90,7 +90,7 @@ public class LoggingConfigurationTest {
@Test
public void test_log_level_property() {
- Map<String, String> properties = Maps.newHashMap();
+ Map<String, String> properties = new HashMap<>();
LoggingConfiguration conf = new LoggingConfiguration(null).setProperties(properties);
assertThat(conf.getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL)).isEqualTo("INFO");
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfiguratorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfiguratorTest.java
index e054fc2d2c8..79c3aaea2d7 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfiguratorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrapper/LoggingConfiguratorTest.java
@@ -21,7 +21,6 @@ package org.sonar.batch.bootstrapper;
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -55,7 +54,7 @@ public class LoggingConfiguratorTest {
listener = new SimpleLogListener();
}
- private class SimpleLogListener implements LogOutput {
+ private static class SimpleLogListener implements LogOutput {
String msg;
LogOutput.Level level;
@@ -67,7 +66,7 @@ public class LoggingConfiguratorTest {
}
@Test
- public void testWithFile() throws FileNotFoundException, IOException {
+ public void testWithFile() throws IOException {
InputStream is = this.getClass().getResourceAsStream(DEFAULT_CLASSPATH_CONF);
File tmpFolder = folder.getRoot();
File testFile = new File(tmpFolder, "test");
@@ -86,7 +85,7 @@ public class LoggingConfiguratorTest {
}
@Test
- public void testCustomAppender() throws UnsupportedEncodingException {
+ public void testCustomAppender() {
conf.setLogOutput(listener);
LoggingConfigurator.apply(conf);
@@ -129,7 +128,7 @@ public class LoggingConfiguratorTest {
}
@Test
- public void testFormatNoEffect() throws UnsupportedEncodingException {
+ public void testFormatNoEffect() {
conf.setLogOutput(listener);
conf.setFormat("%t");
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalTempFolderProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalTempFolderProviderTest.java
index 5de2170fd3c..8508a85f764 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalTempFolderProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalTempFolderProviderTest.java
@@ -103,7 +103,7 @@ public class GlobalTempFolderProviderTest {
File userHome = temp.newFolder();
when(system.envVariable("SONAR_USER_HOME")).thenReturn(null);
- when(system.property("user.home")).thenReturn(userHome.getAbsolutePath().toString());
+ when(system.property("user.home")).thenReturn(userHome.getAbsolutePath());
// if nothing is defined, it will be in {user.home}/.sonar/.sonartmp
File defaultSonarHome = new File(userHome.getAbsolutePath(), ".sonar");
@@ -121,7 +121,7 @@ public class GlobalTempFolderProviderTest {
}
@Test
- public void dotWorkingDir() throws IOException {
+ public void dotWorkingDir() {
File sonarHome = temp.getRoot();
String globalWorkDir = ".";
RawScannerProperties globalProperties = new RawScannerProperties(
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/MetricProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/MetricProviderTest.java
index 3524d568b75..fa6e2925457 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/MetricProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/MetricProviderTest.java
@@ -40,11 +40,7 @@ public class MetricProviderTest {
@Test
public void should_provide_plugin_metrics() {
- Metrics factory = new Metrics() {
- public List<Metric> getMetrics() {
- return Arrays.<Metric>asList(new Metric.Builder("custom", "Custom", Metric.ValueType.FLOAT).create());
- }
- };
+ Metrics factory = () -> Arrays.asList(new Metric.Builder("custom", "Custom", Metric.ValueType.FLOAT).create());
MetricProvider provider = new MetricProvider(new Metrics[] {factory});
List<Metric> metrics = provider.provide();
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ModuleSensorExtensionDictionnaryTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ModuleSensorExtensionDictionnaryTest.java
index 4d63704cae0..afe748ae0e1 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ModuleSensorExtensionDictionnaryTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ModuleSensorExtensionDictionnaryTest.java
@@ -301,7 +301,7 @@ public class ModuleSensorExtensionDictionnaryTest {
}
- class FakeSensor implements Sensor {
+ static class FakeSensor implements Sensor {
@Override
public void describe(SensorDescriptor descriptor) {
@@ -314,7 +314,7 @@ public class ModuleSensorExtensionDictionnaryTest {
}
}
- class FakeGlobalSensor implements Sensor {
+ static class FakeGlobalSensor implements Sensor {
@Override
public void describe(SensorDescriptor descriptor) {
@@ -327,7 +327,7 @@ public class ModuleSensorExtensionDictionnaryTest {
}
- @ScannerSide
+ @ScannerSide static
class MethodDependentOf implements Marker {
private Object dep;
@@ -342,12 +342,12 @@ public class ModuleSensorExtensionDictionnaryTest {
}
@ScannerSide
- @DependsUpon("flag")
+ @DependsUpon("flag") static
class ClassDependsUpon implements Marker {
}
@ScannerSide
- @DependedUpon("flag")
+ @DependedUpon("flag") static
class ClassDependedUpon implements Marker {
}
@@ -361,7 +361,7 @@ public class ModuleSensorExtensionDictionnaryTest {
interface InterfaceDependedUpon extends Marker {
}
- @ScannerSide
+ @ScannerSide static
class GeneratesSomething implements Marker {
private Object gen;
@@ -381,7 +381,7 @@ public class ModuleSensorExtensionDictionnaryTest {
}
}
- class NormalSensor implements Sensor {
+ static class NormalSensor implements Sensor {
@Override
public void describe(SensorDescriptor descriptor) {
@@ -393,7 +393,7 @@ public class ModuleSensorExtensionDictionnaryTest {
}
- @Phase(name = Phase.Name.PRE)
+ @Phase(name = Phase.Name.PRE) static
class PreSensor implements Sensor {
@Override
@@ -410,7 +410,7 @@ public class ModuleSensorExtensionDictionnaryTest {
}
- @Phase(name = Phase.Name.POST)
+ @Phase(name = Phase.Name.POST) static
class PostSensor implements Sensor {
@Override
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/PostJobExtensionDictionnaryTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/PostJobExtensionDictionnaryTest.java
index 15cf84a2a18..7ed231a7d52 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/PostJobExtensionDictionnaryTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/PostJobExtensionDictionnaryTest.java
@@ -66,7 +66,7 @@ public class PostJobExtensionDictionnaryTest {
}
- @Phase(name = Phase.Name.POST)
+ @Phase(name = Phase.Name.POST) static
class PostSensor implements Sensor {
@Override
@@ -83,7 +83,7 @@ public class PostJobExtensionDictionnaryTest {
}
- class NormalPostJob implements PostJob {
+ static class NormalPostJob implements PostJob {
@Override
public void describe(PostJobDescriptor descriptor) {
@@ -95,7 +95,7 @@ public class PostJobExtensionDictionnaryTest {
}
- @Phase(name = Phase.Name.PRE)
+ @Phase(name = Phase.Name.PRE) static
class PrePostJob implements PostJob {
@Override
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ProcessedScannerPropertiesTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ProcessedScannerPropertiesTest.java
index 95f3e022fd4..41befac6a7c 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ProcessedScannerPropertiesTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ProcessedScannerPropertiesTest.java
@@ -19,7 +19,7 @@
*/
package org.sonar.scanner.bootstrap;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import org.sonar.scanner.scan.EmptyExternalProjectKeyAndOrganization;
@@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.entry;
public class ProcessedScannerPropertiesTest {
@Test
public void test_copy_of_properties() {
- Map<String, String> map = Maps.newHashMap();
+ Map<String, String> map = new HashMap<>();
map.put("foo", "bar");
ProcessedScannerProperties underTest = new ProcessedScannerProperties(
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java
index 1597f30759d..eb9fe580818 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java
@@ -101,7 +101,7 @@ public class CpdExecutorTest {
@Test
public void dont_fail_if_nothing_to_save() {
- executor.saveDuplications(batchComponent1, Collections.<CloneGroup>emptyList());
+ executor.saveDuplications(batchComponent1, Collections.emptyList());
assertThat(reader.readComponentDuplications(batchComponent1.scannerId())).isExhausted();
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdSettingsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdSettingsTest.java
index 057a5bed362..6e97fe24755 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdSettingsTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdSettingsTest.java
@@ -23,7 +23,6 @@ import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.config.Configuration;
-import org.sonar.api.batch.fs.internal.DefaultInputProject;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/deprecated/perspectives/PerspectiveBuilderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/deprecated/perspectives/PerspectiveBuilderTest.java
index 3e52ed66422..c899abeab8a 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/deprecated/perspectives/PerspectiveBuilderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/deprecated/perspectives/PerspectiveBuilderTest.java
@@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class PerspectiveBuilderTest {
@Test
- public void testGetPerspectiveClass() throws Exception {
+ public void testGetPerspectiveClass() {
PerspectiveBuilder<FakePerspective> builder = new PerspectiveBuilder<FakePerspective>(FakePerspective.class) {
@Override
public FakePerspective loadPerspective(Class<FakePerspective> perspectiveClass, InputComponent component) {
@@ -39,7 +39,7 @@ public class PerspectiveBuilderTest {
assertThat(builder.getPerspectiveClass()).isEqualTo(FakePerspective.class);
}
- static interface FakePerspective extends Perspective {
+ interface FakePerspective extends Perspective {
}
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageReportParserTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageReportParserTest.java
index 50fd91deb04..44eedbed5bb 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageReportParserTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/genericcoverage/GenericCoverageReportParserTest.java
@@ -222,7 +222,7 @@ public class GenericCoverageReportParserTest {
new GenericCoverageReportParser().parse(report, context);
}
- private void parseCoverageReportFile(String reportLocation) throws Exception {
+ private void parseCoverageReportFile(String reportLocation) {
new GenericCoverageReportParser().parse(new File(reportLocation), context);
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueFilterChainTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueFilterChainTest.java
index e88ee7c367f..728a902243b 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueFilterChainTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/DefaultIssueFilterChainTest.java
@@ -36,28 +36,28 @@ public class DefaultIssueFilterChainTest {
assertThat(new DefaultIssueFilterChain().accept(issue)).isTrue();
}
- class PassingFilter implements IssueFilter {
+ static class PassingFilter implements IssueFilter {
@Override
public boolean accept(FilterableIssue issue, IssueFilterChain chain) {
return chain.accept(issue);
}
}
- class AcceptingFilter implements IssueFilter {
+ static class AcceptingFilter implements IssueFilter {
@Override
public boolean accept(FilterableIssue issue, IssueFilterChain chain) {
return true;
}
}
- class RefusingFilter implements IssueFilter {
+ static class RefusingFilter implements IssueFilter {
@Override
public boolean accept(FilterableIssue issue, IssueFilterChain chain) {
return false;
}
}
- class FailingFilter implements IssueFilter {
+ static class FailingFilter implements IssueFilter {
@Override
public boolean accept(FilterableIssue issue, IssueFilterChain chain) {
fail();
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/LineRangeTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/LineRangeTest.java
index f5f31ad525d..c03afb8f967 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/LineRangeTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/pattern/LineRangeTest.java
@@ -50,12 +50,12 @@ public class LineRangeTest {
}
@Test
- public void testToString() throws Exception {
+ public void testToString() {
assertThat(new LineRange(12, 15).toString()).isEqualTo("[12-15]");
}
@Test
- public void testEquals() throws Exception {
+ public void testEquals() {
LineRange range = new LineRange(12, 15);
assertThat(range).isEqualTo(range);
assertThat(range).isEqualTo(new LineRange(12, 15));
@@ -66,7 +66,7 @@ public class LineRangeTest {
}
@Test
- public void testHashCode() throws Exception {
+ public void testHashCode() {
assertThat(new LineRange(12, 15).hashCode()).isEqualTo(new LineRange(12, 15).hashCode());
}
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoaderTest.java
index c12698aec16..823234043d8 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoaderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsLoaderTest.java
@@ -53,14 +53,14 @@ public class IssueExclusionsLoaderTest {
private IssueExclusionsLoader scanner;
@Before
- public void before() throws Exception {
+ public void before() {
ignoreIssuesFilter = mock(IgnoreIssuesFilter.class);
MockitoAnnotations.initMocks(this);
scanner = new IssueExclusionsLoader(exclusionPatternInitializer, ignoreIssuesFilter, mock(AnalysisWarnings.class));
}
@Test
- public void testToString() throws Exception {
+ public void testToString() {
assertThat(scanner.toString()).isEqualTo("Issues Exclusions - Source Scanner");
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java
index cede238b578..02ba5eff02b 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java
@@ -19,7 +19,6 @@
*/
package org.sonar.scanner.mediumtest;
-import com.google.common.collect.Maps;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -364,7 +363,7 @@ public class ScannerMediumTester extends ExternalResource {
}
private static class FakeProjectRepositoriesLoader implements ProjectRepositoriesLoader {
- private Map<String, FileData> fileDataMap = Maps.newHashMap();
+ private Map<String, FileData> fileDataMap = new HashMap<>();
@Override
public ProjectRepositories load(String projectKey, @Nullable String branchBase) {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/DeprecatedBranchMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/DeprecatedBranchMediumTest.java
index 362f36419bc..9a47504750f 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/DeprecatedBranchMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/DeprecatedBranchMediumTest.java
@@ -29,11 +29,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
-import org.sonar.api.SonarEdition;
-import org.sonar.api.batch.fs.internal.DefaultInputFile;
-import org.sonar.api.utils.MessageException;
-import org.sonar.scanner.mediumtest.AnalysisResult;
-import org.sonar.scanner.mediumtest.ScannerMediumTester;
import org.sonar.api.utils.MessageException;
import org.sonar.scanner.mediumtest.ScannerMediumTester;
import org.sonar.xoo.XooPlugin;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java
index 0a79212537d..5f4319f9471 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java
@@ -20,7 +20,6 @@
package org.sonar.scanner.mediumtest.coverage;
import java.io.File;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.junit.Rule;
@@ -41,7 +40,7 @@ public class GenericCoverageMediumTest {
.addDefaultQProfile("xoo", "Sonar Way");
@Test
- public void singleReport() throws IOException {
+ public void singleReport() {
File projectDir = new File("test-resources/mediumtest/xoo/sample-generic-coverage");
@@ -68,7 +67,7 @@ public class GenericCoverageMediumTest {
}
@Test
- public void twoReports() throws IOException {
+ public void twoReports() {
File projectDir = new File("test-resources/mediumtest/xoo/sample-generic-coverage");
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java
index a7f00975a7e..fb1f58b2927 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java
@@ -63,7 +63,7 @@ public class ProjectBuilderMediumTest {
.addDefaultQProfile("xoo", "Sonar Way")
.addActiveRule("xoo", "OneIssuePerLine", null, "One issue per line", "MAJOR", "OneIssuePerLine.internal", "xoo");
- private class XooPluginWithBuilder extends XooPlugin {
+ private static class XooPluginWithBuilder extends XooPlugin {
private ProjectBuilder builder;
XooPluginWithBuilder(ProjectBuilder builder) {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumTest.java
index 2430a41e128..02e716bacc7 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumTest.java
@@ -62,7 +62,7 @@ public class MultilineIssuesMediumTest {
}
@Test
- public void testIssueRange() throws Exception {
+ public void testIssueRange() {
List<Issue> issues = result.issuesFor(result.inputFile("xources/hello/Single.xoo"));
assertThat(issues).hasSize(1);
Issue issue = issues.get(0);
@@ -74,7 +74,7 @@ public class MultilineIssuesMediumTest {
}
@Test
- public void testMultilineIssueRange() throws Exception {
+ public void testMultilineIssueRange() {
List<Issue> issues = result.issuesFor(result.inputFile("xources/hello/Multiline.xoo"));
assertThat(issues).hasSize(1);
Issue issue = issues.get(0);
@@ -86,7 +86,7 @@ public class MultilineIssuesMediumTest {
}
@Test
- public void testFlowWithSingleLocation() throws Exception {
+ public void testFlowWithSingleLocation() {
List<Issue> issues = result.issuesFor(result.inputFile("xources/hello/Multiple.xoo"));
assertThat(issues).hasSize(1);
Issue issue = issues.get(0);
@@ -108,7 +108,7 @@ public class MultilineIssuesMediumTest {
}
@Test
- public void testFlowsWithMultipleElements() throws Exception {
+ public void testFlowsWithMultipleElements() {
List<Issue> issues = result.issuesFor(result.inputFile("xources/hello/WithFlow.xoo"));
assertThat(issues).hasSize(1);
Issue issue = issues.get(0);
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/PreviewMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/PreviewMediumTest.java
index 3427e32fc0f..f89b425dc09 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/PreviewMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/PreviewMediumTest.java
@@ -42,7 +42,7 @@ public class PreviewMediumTest {
public ScannerMediumTester tester = new ScannerMediumTester();
@Test
- public void failWhenUsingPreviewMode() throws Exception {
+ public void failWhenUsingPreviewMode() {
try {
tester.newAnalysis()
.properties(ImmutableMap.<String, String>builder()
@@ -55,7 +55,7 @@ public class PreviewMediumTest {
}
@Test
- public void failWhenUsingIssuesMode() throws Exception {
+ public void failWhenUsingIssuesMode() {
try {
tester.newAnalysis()
.properties(ImmutableMap.<String, String>builder()
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java
index b4e768e3477..89bfc52825e 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java
@@ -317,7 +317,7 @@ public class ScmMediumTest {
}
- private File prepareProject() throws IOException, URISyntaxException {
+ private File prepareProject() throws IOException {
File baseDir = temp.getRoot();
File srcDir = new File(baseDir, "src");
srcDir.mkdir();
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tasks/TasksMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tasks/TasksMediumTest.java
index 9d3d84124b2..98528834820 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tasks/TasksMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tasks/TasksMediumTest.java
@@ -46,7 +46,7 @@ public class TasksMediumTest {
.registerPlugin("faketask", new FakeTaskPlugin());
@Test
- public void failWhenCallingTask() throws Exception {
+ public void failWhenCallingTask() {
try {
tester.newAnalysis()
.properties(ImmutableMap.<String, String>builder()
@@ -59,7 +59,7 @@ public class TasksMediumTest {
}
@Test
- public void failWhenCallingViews() throws Exception {
+ public void failWhenCallingViews() {
try {
tester.newAnalysis()
.properties(ImmutableMap.<String, String>builder()
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java
index 6399495c410..2e50f1c0f33 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java
@@ -19,7 +19,6 @@
*/
package org.sonar.scanner.postjob;
-import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.batch.AnalysisMode;
@@ -32,12 +31,11 @@ public class DefaultPostJobContextTest {
private DefaultPostJobContext context;
private MapSettings settings;
- private AnalysisMode analysisMode;
@Before
- public void setUp() throws IOException {
+ public void setUp() {
settings = new MapSettings();
- analysisMode = mock(AnalysisMode.class);
+ AnalysisMode analysisMode = mock(AnalysisMode.class);
context = new DefaultPostJobContext(settings.asConfig(), settings, analysisMode);
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java
index f879c237303..5c7e1c5b878 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java
@@ -101,7 +101,7 @@ public class DefaultProjectRepositoriesLoaderTest {
}
@Test
- public void deserializeResponse() throws IOException {
+ public void deserializeResponse() {
loader.load(PROJECT_KEY, null);
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java
index f5d3661dff9..58001d2081a 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java
@@ -106,7 +106,7 @@ public class DefaultQualityProfileLoaderTest {
}
@Test
- public void load_throws_MessageException_if_organization_is_not_found_after_trying_default() throws IOException {
+ public void load_throws_MessageException_if_organization_is_not_found_after_trying_default() {
HttpException e = new HttpException("", 404, "{\"errors\":[{\"msg\":\"No organization with key 'myorg'\"}]}");
WsTestUtil.mockException(wsClient, e);
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/ProjectRepositoriesSupplierTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/ProjectRepositoriesSupplierTest.java
index 19729bf32d3..45c4783f705 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/ProjectRepositoriesSupplierTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/ProjectRepositoriesSupplierTest.java
@@ -19,13 +19,13 @@
*/
package org.sonar.scanner.repository;
-import com.google.common.collect.Maps;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.sonar.scanner.bootstrap.ProcessedScannerProperties;
import org.sonar.scanner.scan.branch.BranchConfiguration;
+import static java.util.Collections.emptyMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -45,7 +45,7 @@ public class ProjectRepositoriesSupplierTest {
@Before
public void setUp() {
underTest = new ProjectRepositoriesSupplier(loader, props, branchConfiguration);
- Map<String, FileData> fileMap = Maps.newHashMap();
+ Map<String, FileData> fileMap = emptyMap();
project = new SingleProjectRepository(fileMap);
when(props.getProjectKey()).thenReturn("key");
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/SingleProjectRepositoryTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/SingleProjectRepositoryTest.java
index 747e292c044..46b959ea5ce 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/SingleProjectRepositoryTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/SingleProjectRepositoryTest.java
@@ -20,10 +20,10 @@
package org.sonar.scanner.repository;
import java.util.Date;
-import org.assertj.core.util.Maps;
import org.junit.Before;
import org.junit.Test;
+import static java.util.Collections.singletonMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertNotNull;
@@ -34,7 +34,7 @@ public class SingleProjectRepositoryTest {
@Before
public void setUp() {
Date lastAnalysisDate = new Date();
- repository = new SingleProjectRepository(Maps.newHashMap("/Abc.java", new FileData("123", "456")));
+ repository = new SingleProjectRepository(singletonMap("/Abc.java", new FileData("123", "456")));
}
@Test
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java
index b614d456fbe..88892755b40 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java
@@ -50,7 +50,7 @@ public class DefaultRulesLoaderTest {
@Test
public void testError() throws IOException {
DefaultScannerWsClient wsClient = mock(DefaultScannerWsClient.class);
- InputStream is = ByteSource.wrap(new String("trash").getBytes()).openBufferedStream();
+ InputStream is = ByteSource.wrap("trash".getBytes()).openBufferedStream();
WsTestUtil.mockStream(wsClient, is);
DefaultRulesLoader loader = new DefaultRulesLoader(wsClient);
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileVerifierTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileVerifierTest.java
index b811f5e1008..bac6ab4287c 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileVerifierTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/QProfileVerifierTest.java
@@ -41,7 +41,7 @@ public class QProfileVerifierTest {
private QualityProfiles profiles;
@Before
- public void before() throws Exception {
+ public void before() {
store = new InputComponentStore(mock(BranchConfiguration.class));
profiles = mock(QualityProfiles.class);
QProfile javaProfile = new QProfile("p1", "My Java profile", "java", null);
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectBuildersExecutorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectBuildersExecutorTest.java
index 043e2ee0453..5fc12a5edc8 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectBuildersExecutorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectBuildersExecutorTest.java
@@ -64,7 +64,7 @@ public class ProjectBuildersExecutorTest {
new ProjectBuildersExecutor(projectBuilders).execute(reactor);
}
- class MyProjectBuilder extends ProjectBuilder {
+ static class MyProjectBuilder extends ProjectBuilder {
@Override
public void build(Context context) {
throw new IllegalStateException();
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java
index cece58e15aa..32125c9eff2 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java
@@ -19,7 +19,6 @@
*/
package org.sonar.scanner.scan;
-import com.google.common.collect.Maps;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -38,9 +37,11 @@ import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.api.notifications.AnalysisWarnings;
import org.sonar.api.utils.MessageException;
import org.sonar.api.utils.log.LogTester;
-import org.sonar.scanner.bootstrap.RawScannerProperties;
import org.sonar.scanner.bootstrap.ProcessedScannerProperties;
+import org.sonar.scanner.bootstrap.RawScannerProperties;
+import static java.util.Collections.emptyMap;
+import static java.util.Collections.singletonMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@@ -391,19 +392,18 @@ public class ProjectReactorBuilderTest {
@Test
public void shouldInitRootWorkDir() {
ProjectReactorBuilder builder = new ProjectReactorBuilder(new ProcessedScannerProperties(
- new RawScannerProperties(Maps.newHashMap()), new EmptyExternalProjectKeyAndOrganization()),
+ new RawScannerProperties(emptyMap()), new EmptyExternalProjectKeyAndOrganization()),
mock(AnalysisWarnings.class));
File baseDir = new File("target/tmp/baseDir");
- File workDir = builder.initRootProjectWorkDir(baseDir, Maps.newHashMap());
+ File workDir = builder.initRootProjectWorkDir(baseDir, emptyMap());
assertThat(workDir).isEqualTo(new File(baseDir, ".sonar"));
}
@Test
public void shouldInitWorkDirWithCustomRelativeFolder() {
- Map<String, String> props = Maps.newHashMap();
- props.put("sonar.working.directory", ".foo");
+ Map<String, String> props = singletonMap("sonar.working.directory", ".foo");
ProjectReactorBuilder builder = new ProjectReactorBuilder(new ProcessedScannerProperties(
new RawScannerProperties(props),
new EmptyExternalProjectKeyAndOrganization()),
@@ -417,8 +417,7 @@ public class ProjectReactorBuilderTest {
@Test
public void shouldInitRootWorkDirWithCustomAbsoluteFolder() {
- Map<String, String> props = Maps.newHashMap();
- props.put("sonar.working.directory", new File("src").getAbsolutePath());
+ Map<String, String> props = singletonMap("sonar.working.directory", new File("src").getAbsolutePath());
ProjectReactorBuilder builder = new ProjectReactorBuilder(new ProcessedScannerProperties(
new RawScannerProperties(props), new EmptyExternalProjectKeyAndOrganization()),
mock(AnalysisWarnings.class));
@@ -431,17 +430,14 @@ public class ProjectReactorBuilderTest {
@Test
public void shouldFailIf2ModulesWithSameKey() {
- Map<String, String> props = new HashMap<>();
- props.put("sonar.projectKey", "root");
+ Map<String, String> props = singletonMap("sonar.projectKey", "root");
ProjectDefinition root = ProjectDefinition.create().setProperties(props);
- Map<String, String> props1 = new HashMap<>();
- props1.put("sonar.projectKey", "mod1");
+ Map<String, String> props1 = singletonMap("sonar.projectKey", "mod1");
root.addSubProject(ProjectDefinition.create().setProperties(props1));
// Check uniqueness of a new module: OK
- Map<String, String> props2 = new HashMap<>();
- props2.put("sonar.projectKey", "mod2");
+ Map<String, String> props2 = singletonMap("sonar.projectKey", "mod2");
ProjectDefinition mod2 = ProjectDefinition.create().setProperties(props2);
ProjectReactorBuilder.checkUniquenessOfChildKey(mod2, root);
@@ -501,7 +497,7 @@ public class ProjectReactorBuilderTest {
}
private Map<String, String> loadProps(String projectFolder) {
- Map<String, String> props = Maps.newHashMap();
+ Map<String, String> props = new HashMap<>();
Properties runnerProps = toProperties(getResource(this.getClass(), projectFolder + "/sonar-project.properties"));
for (final String name : runnerProps.stringPropertyNames()) {
props.put(name, runnerProps.getProperty(name));
@@ -510,14 +506,6 @@ public class ProjectReactorBuilderTest {
return props;
}
- public Map<String, String> toMap(Properties props) {
- Map<String, String> result = new HashMap<>();
- for (Map.Entry<Object, Object> entry : props.entrySet()) {
- result.put(entry.getKey().toString(), entry.getValue().toString());
- }
- return result;
- }
-
@Test
public void shouldGetList() {
Map<String, String> props = new HashMap<>();
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java
index 9fb7cdd8d77..76ca4938776 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/BranchConfigurationProviderTest.java
@@ -44,9 +44,7 @@ public class BranchConfigurationProviderTest {
private ProjectBranches branches = mock(ProjectBranches.class);
private ProjectPullRequests pullRequests = mock(ProjectPullRequests.class);
private ProjectReactor reactor = mock(ProjectReactor.class);
- ;
private Map<String, String> projectSettings = new HashMap<>();
- ;
private ProjectDefinition root = mock(ProjectDefinition.class);
@Captor
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/ProjectPullRequestsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/ProjectPullRequestsTest.java
index eb41def48c8..4a57fd6860c 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/ProjectPullRequestsTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/branch/ProjectPullRequestsTest.java
@@ -20,8 +20,6 @@
package org.sonar.scanner.scan.branch;
import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.*;
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputComponentStoreTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputComponentStoreTest.java
index 98785e06e62..40cb71c6d3e 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputComponentStoreTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputComponentStoreTest.java
@@ -95,7 +95,7 @@ public class InputComponentStoreTest {
}
static class InputComponentStoreTester extends InputComponentStore {
- InputComponentStoreTester() throws IOException {
+ InputComponentStoreTester() {
super(mock(BranchConfiguration.class));
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java
index 7b8cd0c259d..d38769d30f5 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java
@@ -20,7 +20,6 @@
package org.sonar.scanner.scan.filesystem;
import java.io.File;
-import java.io.IOException;
import java.nio.file.Paths;
import org.junit.Before;
import org.junit.Rule;
@@ -49,12 +48,12 @@ public class LanguageDetectionTest {
private MapSettings settings;
@Before
- public void setUp() throws IOException {
+ public void setUp() {
settings = new MapSettings();
}
@Test
- public void test_sanitizeExtension() throws Exception {
+ public void test_sanitizeExtension() {
assertThat(LanguageDetection.sanitizeExtension(".cbl")).isEqualTo("cbl");
assertThat(LanguageDetection.sanitizeExtension(".CBL")).isEqualTo("cbl");
assertThat(LanguageDetection.sanitizeExtension("CBL")).isEqualTo("cbl");
@@ -62,7 +61,7 @@ public class LanguageDetectionTest {
}
@Test
- public void search_by_file_extension() throws Exception {
+ public void search_by_file_extension() {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("java", "java", "jav"), new MockLanguage("cobol", "cbl", "cob")));
LanguageDetection detection = new LanguageDetection(settings.asConfig(), languages);
@@ -80,13 +79,13 @@ public class LanguageDetectionTest {
}
@Test
- public void should_not_fail_if_no_language() throws Exception {
+ public void should_not_fail_if_no_language() {
LanguageDetection detection = spy(new LanguageDetection(settings.asConfig(), new DefaultLanguagesRepository(new Languages())));
assertThat(detectLanguage(detection, "Foo.java")).isNull();
}
@Test
- public void plugin_can_declare_a_file_extension_twice_for_case_sensitivity() throws Exception {
+ public void plugin_can_declare_a_file_extension_twice_for_case_sensitivity() {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("abap", "abap", "ABAP")));
LanguageDetection detection = new LanguageDetection(settings.asConfig(), languages);
@@ -94,7 +93,7 @@ public class LanguageDetectionTest {
}
@Test
- public void fail_if_conflicting_language_suffix() throws Exception {
+ public void fail_if_conflicting_language_suffix() {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("xml", "xhtml"), new MockLanguage("web", "xhtml")));
LanguageDetection detection = new LanguageDetection(settings.asConfig(), languages);
try {
@@ -109,7 +108,7 @@ public class LanguageDetectionTest {
}
@Test
- public void solve_conflict_using_filepattern() throws Exception {
+ public void solve_conflict_using_filepattern() {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("xml", "xhtml"), new MockLanguage("web", "xhtml")));
settings.setProperty("sonar.lang.patterns.xml", "xml/**");
@@ -120,7 +119,7 @@ public class LanguageDetectionTest {
}
@Test
- public void fail_if_conflicting_filepattern() throws Exception {
+ public void fail_if_conflicting_filepattern() {
LanguagesRepository languages = new DefaultLanguagesRepository(new Languages(new MockLanguage("abap", "abap"), new MockLanguage("cobol", "cobol")));
settings.setProperty("sonar.lang.patterns.abap", "*.abap,*.txt");
settings.setProperty("sonar.lang.patterns.cobol", "*.cobol,*.txt");
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java
index b3a2a09fe29..1ec2b126738 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java
@@ -29,14 +29,12 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.notifications.AnalysisWarnings;
-import org.sonar.api.utils.PathUtils;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.fs.internal.FileMetadata;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
+import org.sonar.api.notifications.AnalysisWarnings;
+import org.sonar.api.utils.PathUtils;
import org.sonar.scanner.issue.ignore.IgnoreIssuesFilter;
import org.sonar.scanner.issue.ignore.pattern.IssueExclusionPatternInitializer;
import org.sonar.scanner.issue.ignore.scanner.IssueExclusionsLoader;
@@ -50,18 +48,13 @@ public class MetadataGeneratorTest {
@Rule
public TemporaryFolder temp = new TemporaryFolder();
- @Mock
- private StatusDetection statusDetection;
- @Mock
- private DefaultModuleFileSystem fs;
+ private StatusDetection statusDetection = mock(StatusDetection.class);
- private FileMetadata metadata;
private MetadataGenerator generator;
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
- metadata = new FileMetadata();
+ FileMetadata metadata = new FileMetadata();
IssueExclusionsLoader issueExclusionsLoader = new IssueExclusionsLoader(mock(IssueExclusionPatternInitializer.class), mock(IgnoreIssuesFilter.class),
mock(AnalysisWarnings.class));
generator = new MetadataGenerator(statusDetection, metadata, issueExclusionsLoader);
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleInputComponentStoreTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleInputComponentStoreTest.java
index 44f5793df8f..c73385d457d 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleInputComponentStoreTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleInputComponentStoreTest.java
@@ -53,7 +53,7 @@ public class ModuleInputComponentStoreTest {
}
@Test
- public void should_cache_files_by_filename() throws IOException {
+ public void should_cache_files_by_filename() {
ModuleInputComponentStore store = newModuleInputComponentStore();
String filename = "some name";
@@ -70,7 +70,7 @@ public class ModuleInputComponentStoreTest {
}
@Test
- public void should_cache_files_by_extension() throws IOException {
+ public void should_cache_files_by_extension() {
ModuleInputComponentStore store = newModuleInputComponentStore();
InputFile inputFile1 = new TestInputFileBuilder(projectKey, "some/path/Program.java").build();
@@ -86,7 +86,7 @@ public class ModuleInputComponentStoreTest {
}
@Test
- public void should_not_cache_duplicates() throws IOException {
+ public void should_not_cache_duplicates() {
ModuleInputComponentStore store = newModuleInputComponentStore();
String ext = "java";
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ProjectExclusionFiltersTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ProjectExclusionFiltersTest.java
index 7e6540f69f1..ab8aa3c6e41 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ProjectExclusionFiltersTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ProjectExclusionFiltersTest.java
@@ -49,7 +49,7 @@ public class ProjectExclusionFiltersTest {
}
@Test
- public void no_inclusions_nor_exclusions() throws IOException {
+ public void no_inclusions_nor_exclusions() {
ProjectExclusionFilters filter = new ProjectExclusionFilters(settings.asConfig());
IndexedFile indexedFile = new DefaultIndexedFile("foo", moduleBaseDir, "src/main/java/com/mycompany/FooDao.java", null);
@@ -60,7 +60,7 @@ public class ProjectExclusionFiltersTest {
}
@Test
- public void match_inclusion() throws IOException {
+ public void match_inclusion() {
settings.setProperty(CoreProperties.PROJECT_INCLUSIONS_PROPERTY, "**/*Dao.java");
ProjectExclusionFilters filter = new ProjectExclusionFilters(settings.asConfig());
@@ -72,7 +72,7 @@ public class ProjectExclusionFiltersTest {
}
@Test
- public void match_at_least_one_inclusion() throws IOException {
+ public void match_at_least_one_inclusion() {
settings.setProperty(CoreProperties.PROJECT_INCLUSIONS_PROPERTY, "**/*Dao.java,**/*Dto.java");
ProjectExclusionFilters filter = new ProjectExclusionFilters(settings.asConfig());
@@ -84,7 +84,7 @@ public class ProjectExclusionFiltersTest {
}
@Test
- public void match_exclusions() throws IOException {
+ public void match_exclusions() {
settings.setProperty(CoreProperties.PROJECT_INCLUSIONS_PROPERTY, "src/main/java/**/*");
settings.setProperty(CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY, "src/test/java/**/*");
settings.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, "**/*Dao.java");
@@ -102,7 +102,7 @@ public class ProjectExclusionFiltersTest {
}
@Test
- public void match_exclusion_by_absolute_path() throws IOException {
+ public void match_exclusion_by_absolute_path() {
File excludedFile = new File(moduleBaseDir.toString(), "src/main/java/org/bar/Bar.java");
settings.setProperty(CoreProperties.PROJECT_INCLUSIONS_PROPERTY, "src/main/java/**/*");
@@ -118,9 +118,7 @@ public class ProjectExclusionFiltersTest {
@Test
public void trim_pattern() {
- ProjectExclusionFilters filter = new ProjectExclusionFilters(settings.asConfig());
-
- assertThat(filter.prepareMainExclusions(new String[] {" **/*Dao.java "}, new String[0])[0].toString()).isEqualTo("**/*Dao.java");
+ assertThat(ProjectExclusionFilters.prepareMainExclusions(new String[] {" **/*Dao.java "}, new String[0])[0].toString()).isEqualTo("**/*Dao.java");
}
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/DefaultBlameOutputTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/DefaultBlameOutputTest.java
index 4677916f3e0..bce13dbbe2b 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/DefaultBlameOutputTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scm/DefaultBlameOutputTest.java
@@ -19,8 +19,6 @@
*/
package org.sonar.scanner.scm;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.Date;
import org.junit.Rule;
import org.junit.Test;
@@ -31,11 +29,9 @@ import org.sonar.api.batch.scm.BlameLine;
import org.sonar.api.utils.System2;
import org.sonar.scanner.notifications.DefaultAnalysisWarnings;
-import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
public class DefaultBlameOutputTest {
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/util/ScannerUtilsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/util/ScannerUtilsTest.java
index 1a1ccf2843c..b227f12b598 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/util/ScannerUtilsTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/util/ScannerUtilsTest.java
@@ -27,14 +27,14 @@ import static org.assertj.core.api.Assertions.assertThat;
public class ScannerUtilsTest {
@Test
- public void encodeForUrl() throws Exception {
+ public void encodeForUrl() {
assertThat(ScannerUtils.encodeForUrl(null)).isEqualTo("");
assertThat(ScannerUtils.encodeForUrl("")).isEqualTo("");
assertThat(ScannerUtils.encodeForUrl("foo")).isEqualTo("foo");
assertThat(ScannerUtils.encodeForUrl("foo&bar")).isEqualTo("foo%26bar");
}
- private class MyClass {
+ private static class MyClass {
@Override
public String toString() {
return null;
diff --git a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
index 0260f1fcb2e..0b7b55534b7 100644
--- a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
+++ b/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/ScannerReportViewerApp.java
@@ -19,10 +19,7 @@
*/
package org.sonar.scanner.protocol.viewer;
-import java.awt.BorderLayout;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.EventQueue;
+import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
@@ -34,22 +31,10 @@ import java.util.List;
import java.util.Map;
import java.util.Scanner;
import javax.annotation.CheckForNull;
-import javax.swing.JEditorPane;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JSplitPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JTree;
-import javax.swing.UIManager;
-import javax.swing.UIManager.LookAndFeelInfo;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeSelectionModel;
+import javax.swing.*;
+import javax.swing.UIManager.*;
+import javax.swing.event.*;
+import javax.swing.tree.*;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.sonar.core.util.CloseableIterator;
@@ -443,7 +428,7 @@ public class ScannerReportViewerApp {
try {
int index = 0;
for (Changeset changeset : changesets.getChangesetList()) {
- scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), Integer.toString(index) + "\n", null);
+ scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), index + "\n", null);
scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), changeset + "\n", null);
index++;
}
@@ -451,7 +436,7 @@ public class ScannerReportViewerApp {
scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), "\n", null);
int line = 1;
for (Integer idx : changesetIndexByLine) {
- scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), Integer.toString(line) + ": " + idx + "\n", null);
+ scmEditor.getDocument().insertString(scmEditor.getDocument().getEndPosition().getOffset(), line + ": " + idx + "\n", null);
line++;
}
@@ -598,7 +583,7 @@ public class ScannerReportViewerApp {
significantCodeTab = new JScrollPane();
tabbedPane.addTab("Significant Code Ranges", null, significantCodeTab, null);
-
+
significantCodeEditor = new JEditorPane();
significantCodeTab.setViewportView(significantCodeEditor);
diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/JsonComparison.java b/sonar-testing-harness/src/main/java/org/sonar/test/JsonComparison.java
index ac797e2c067..995753269df 100644
--- a/sonar-testing-harness/src/main/java/org/sonar/test/JsonComparison.java
+++ b/sonar-testing-harness/src/main/java/org/sonar/test/JsonComparison.java
@@ -42,7 +42,7 @@ class JsonComparison {
private boolean strictTimezone = false;
private boolean strictArrayOrder = false;
- private Set<String> ignoredFields = synchronizedSet(new HashSet<String>());
+ private Set<String> ignoredFields = synchronizedSet(new HashSet<>());
boolean isStrictTimezone() {
return strictTimezone;
@@ -196,7 +196,7 @@ class JsonComparison {
}
private boolean shouldIgnoreField(Object key) {
- return key instanceof String && ignoredFields.contains((String) key);
+ return key instanceof String && ignoredFields.contains(key);
}
@CheckForNull
diff --git a/sonar-testing-harness/src/test/java/org/sonar/test/i18n/BundleSynchronizedMatcherTest.java b/sonar-testing-harness/src/test/java/org/sonar/test/i18n/BundleSynchronizedMatcherTest.java
index ca1ee476dc2..a460b2e7bb4 100644
--- a/sonar-testing-harness/src/test/java/org/sonar/test/i18n/BundleSynchronizedMatcherTest.java
+++ b/sonar-testing-harness/src/test/java/org/sonar/test/i18n/BundleSynchronizedMatcherTest.java
@@ -104,7 +104,7 @@ public class BundleSynchronizedMatcherTest {
}
@Test
- public void testExtractDefaultBundleName() throws Exception {
+ public void testExtractDefaultBundleName() {
// OK
assertThat(BundleSynchronizedMatcher.extractDefaultBundleName("myPlugin_fr.properties"), is("myPlugin.properties"));
assertThat(BundleSynchronizedMatcher.extractDefaultBundleName("myPlugin_fr_QB.properties"), is("myPlugin.properties"));
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/analysisreports/AnalysisReportsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/analysisreports/AnalysisReportsService.java
index fed5c2e58c5..b5ccca61c36 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/analysisreports/AnalysisReportsService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/analysisreports/AnalysisReportsService.java
@@ -19,12 +19,10 @@
*/
package org.sonarqube.ws.client.analysisreports;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/AuthenticationService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/AuthenticationService.java
index 92f274ca222..e95a94e4171 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/AuthenticationService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/AuthenticationService.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.authentication;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/LoginRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/LoginRequest.java
index 999779a12d0..34f1444d5cb 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/LoginRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/authentication/LoginRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.authentication;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/BatchService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/BatchService.java
index 035c305d497..7d4347b7cbc 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/BatchService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/BatchService.java
@@ -19,12 +19,10 @@
*/
package org.sonarqube.ws.client.batch;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
import org.sonarqube.ws.Batch.WsProjectResponse;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/FileRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/FileRequest.java
index 3945349750a..7d890e1942b 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/FileRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/FileRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.batch;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/IssuesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/IssuesRequest.java
index 96e340d4ca5..ae650e1687e 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/IssuesRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/IssuesRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.batch;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/ProjectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/ProjectRequest.java
index 1e62e68a0ab..fff716fa912 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/ProjectRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/batch/ProjectRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.batch;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusRequest.java
index 6c1c8096f0d..4a0ea765e14 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityStatusRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.ce;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CancelRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CancelRequest.java
index 8e47841fdd5..a367368c032 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CancelRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CancelRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.ce;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ComponentRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ComponentRequest.java
index 6082a7f2b10..992f8db2a78 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ComponentRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ComponentRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.ce;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/SubmitRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/SubmitRequest.java
index 6987833977e..84665b6c00e 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/SubmitRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/SubmitRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.ce;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/AppRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/AppRequest.java
index 153dd956600..2dd21a75b94 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/AppRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/AppRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.components;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ComponentsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ComponentsService.java
index 5952cc02ba2..fc619fcf12f 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ComponentsService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ComponentsService.java
@@ -24,7 +24,6 @@ import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
import org.sonarqube.ws.Components.SearchWsResponse;
import org.sonarqube.ws.Components.SearchProjectsWsResponse;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ShowRequest.java
index 5289595ac05..f0cb61f878c 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ShowRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/components/ShowRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.components;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/CreateRequest.java
index db112064999..c6454d14945 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/CreateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/CreateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.custommeasures;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/DeleteRequest.java
index c6f6e2639f9..482665cddb0 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/DeleteRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/DeleteRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.custommeasures;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/MetricsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/MetricsRequest.java
index c14137f38f3..de34834a1b2 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/MetricsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/MetricsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.custommeasures;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/UpdateRequest.java
index ff53ca95bed..a343e48b805 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/UpdateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/custommeasures/UpdateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.custommeasures;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/DuplicationsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/DuplicationsService.java
index 7cd3d10f209..bcf1681568f 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/DuplicationsService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/DuplicationsService.java
@@ -19,12 +19,9 @@
*/
package org.sonarqube.ws.client.duplications;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
-import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
import org.sonarqube.ws.Duplications.ShowResponse;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/ShowRequest.java
index ccdd320dd2f..246ca828efd 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/ShowRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/duplications/ShowRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.duplications;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/EmailsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/EmailsService.java
index e6fec6b5d8d..313f1daaa08 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/EmailsService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/EmailsService.java
@@ -19,11 +19,9 @@
*/
package org.sonarqube.ws.client.emails;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
-import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/SendRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/SendRequest.java
index df7d99fe793..37003cd07a1 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/SendRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/emails/SendRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.emails;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/AddRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/AddRequest.java
index 0a77c4e110b..272ee747899 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/AddRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/AddRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.favorites;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/FavoritesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/FavoritesService.java
index e793f9a1c0a..8f2025fc6cd 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/FavoritesService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/FavoritesService.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.favorites;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/RemoveRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/RemoveRequest.java
index cc1897fd6c6..a9c8f23dc65 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/RemoveRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/RemoveRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.favorites;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/SearchRequest.java
index b8d7376217f..95aa629e8bc 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/SearchRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorites/SearchRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.favorites;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AddCommentRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AddCommentRequest.java
index a4e7e5d3a6b..a46efa1a32f 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AddCommentRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AddCommentRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.issues;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/IndexRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/IndexRequest.java
index 1e7235d099f..25eab37c6b7 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/IndexRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/IndexRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.l10n;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/L10nService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/L10nService.java
index db19bf4f35f..3a0eef834c4 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/L10nService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/l10n/L10nService.java
@@ -19,12 +19,10 @@
*/
package org.sonarqube.ws.client.l10n;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/LanguagesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/LanguagesService.java
index 99137dcf714..8e2bbf20241 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/LanguagesService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/LanguagesService.java
@@ -19,12 +19,10 @@
*/
package org.sonarqube.ws.client.languages;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/ListRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/ListRequest.java
index c0b29352ce9..b49a372e2a7 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/ListRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/languages/ListRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.languages;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/MeasuresService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/MeasuresService.java
index e3d9b4d1422..7550a0bb664 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/MeasuresService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measures/MeasuresService.java
@@ -21,10 +21,8 @@ package org.sonarqube.ws.client.measures;
import java.util.stream.Collectors;
import javax.annotation.Generated;
-import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
import org.sonarqube.ws.Measures.ComponentWsResponse;
import org.sonarqube.ws.Measures.ComponentTreeWsResponse;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/CreateRequest.java
index 3c52876ab21..8a2014d7a07 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/CreateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/CreateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.metrics;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/UpdateRequest.java
index e42a796db05..c5e361ab0c4 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/UpdateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/metrics/UpdateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.metrics;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/NavigationService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/NavigationService.java
index bc9d3e9b78f..23f6cfd3d16 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/NavigationService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/NavigationService.java
@@ -19,12 +19,10 @@
*/
package org.sonarqube.ws.client.navigation;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/OrganizationRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/OrganizationRequest.java
index ef46e0561e3..fb7218b8c51 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/OrganizationRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/navigation/OrganizationRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.navigation;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/AddRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/AddRequest.java
index d6e698b4298..2230851487f 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/AddRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/AddRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.notifications;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/ListRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/ListRequest.java
index 9fa839b0b95..63a5936e4b2 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/ListRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/ListRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.notifications;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/NotificationsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/NotificationsService.java
index 5824069d8ae..f83a4c977ca 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/NotificationsService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/NotificationsService.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.notifications;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/RemoveRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/RemoveRequest.java
index 3003b1733c5..04d9236375a 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/RemoveRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/notifications/RemoveRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.notifications;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java
index 824b8bcc5f4..67242f2f956 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/AddMemberRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.organizations;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java
index 6c7c44d5a6f..65fc5849341 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/CreateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.organizations;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java
index e8da9fed243..b9763e5ba28 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/DeleteRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.organizations;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java
index 60ed77b2b28..93e1a9a3d7a 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/RemoveMemberRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.organizations;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/SearchMembersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/SearchMembersRequest.java
index 1a1b8580e34..8b893e015ff 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/SearchMembersRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/SearchMembersRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.organizations;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java
index 84290bde38d..4b1dfcd8024 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/organizations/UpdateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.organizations;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupRequest.java
index 701a384d652..065b3d83950 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupToTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupToTemplateRequest.java
index 30376c33dda..e04397892d9 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupToTemplateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddGroupToTemplateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddProjectCreatorToTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddProjectCreatorToTemplateRequest.java
index c2d4f908530..db941cd8bc6 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddProjectCreatorToTemplateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddProjectCreatorToTemplateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserRequest.java
index e38aadbcbad..51c89df952d 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserToTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserToTemplateRequest.java
index 5a0f5c3ddc5..ff9ea7b6b84 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserToTemplateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/AddUserToTemplateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/ApplyTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/ApplyTemplateRequest.java
index 9d00953bec0..5872c727265 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/ApplyTemplateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/ApplyTemplateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/CreateTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/CreateTemplateRequest.java
index 21a402c1dd0..08de07c4e42 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/CreateTemplateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/CreateTemplateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/DeleteTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/DeleteTemplateRequest.java
index 520064e1e4b..b20aeb9580e 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/DeleteTemplateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/DeleteTemplateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/GroupsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/GroupsRequest.java
index b6b36aa03fb..f97cdab4e17 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/GroupsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/GroupsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupFromTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupFromTemplateRequest.java
index 162778b3c53..65ab9991630 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupFromTemplateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupFromTemplateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupRequest.java
index 031e9689620..1fbe680c490 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveGroupRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveProjectCreatorFromTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveProjectCreatorFromTemplateRequest.java
index 56b6bec9046..ee94f4f7e22 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveProjectCreatorFromTemplateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveProjectCreatorFromTemplateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserFromTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserFromTemplateRequest.java
index b30b49df27d..abe3e7e1285 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserFromTemplateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserFromTemplateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserRequest.java
index d6cab6ad754..c324e9bca86 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/RemoveUserRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchGlobalPermissionsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchGlobalPermissionsRequest.java
index 7c18ff86cb5..f3e79c06a74 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchGlobalPermissionsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchGlobalPermissionsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchProjectPermissionsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchProjectPermissionsRequest.java
index 0d5d2a8e26f..0809b3f27c7 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchProjectPermissionsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchProjectPermissionsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchTemplatesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchTemplatesRequest.java
index 6e38a1f919a..95b3eabef27 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchTemplatesRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SearchTemplatesRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SetDefaultTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SetDefaultTemplateRequest.java
index 0a0ca54ec73..4587a4f206b 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SetDefaultTemplateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/SetDefaultTemplateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateGroupsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateGroupsRequest.java
index abd32ca58f4..21330e8639f 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateGroupsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateGroupsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateUsersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateUsersRequest.java
index 4635bf79516..f14eed1351b 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateUsersRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/TemplateUsersRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UpdateTemplateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UpdateTemplateRequest.java
index 28454e23ca3..1545218dbb0 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UpdateTemplateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UpdateTemplateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UsersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UsersRequest.java
index 2aa08ff362f..a5ae540f678 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UsersRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permissions/UsersRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.permissions;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/DownloadRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/DownloadRequest.java
index 72d31d22864..7f68dd01646 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/DownloadRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/DownloadRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.plugins;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/InstallRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/InstallRequest.java
index 2a6d963f675..d7d5b546aa4 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/InstallRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/InstallRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.plugins;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UninstallRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UninstallRequest.java
index d5f4bd90663..f5a527e8893 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UninstallRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UninstallRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.plugins;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UpdateRequest.java
index ebd7e8c5910..e3d7a56e3de 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UpdateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/UpdateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.plugins;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/CreateEventRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/CreateEventRequest.java
index 6608c0c69d2..fa670eeb4f9 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/CreateEventRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/CreateEventRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectanalyses;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteEventRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteEventRequest.java
index 109b89e5533..56f16782272 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteEventRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteEventRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectanalyses;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteRequest.java
index 4a797adb368..31e75c787b9 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/DeleteRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectanalyses;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SearchRequest.java
index b2d5cade346..f4b44168ab9 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SearchRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SearchRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectanalyses;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SetBaselineRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SetBaselineRequest.java
index 455a8916442..3b6d5de3f03 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SetBaselineRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SetBaselineRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectanalyses;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UnsetBaselineRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UnsetBaselineRequest.java
index aa2be412534..49a3bb037f1 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UnsetBaselineRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UnsetBaselineRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectanalyses;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UpdateEventRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UpdateEventRequest.java
index 99eb8e1cdef..78b69ab4966 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UpdateEventRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UpdateEventRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectanalyses;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/DeleteRequest.java
index 7ced11eaaff..651262da5d8 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/DeleteRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/DeleteRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectbranches;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ListRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ListRequest.java
index ffa64b1007c..85ff2f9a63e 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ListRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ListRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectbranches;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/RenameRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/RenameRequest.java
index 11f66102cbb..91c51bea9f6 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/RenameRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/RenameRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectbranches;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/CreateRequest.java
index 497aeadf96f..56d7d3b5bd3 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/CreateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/CreateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectlinks;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteRequest.java
index ae395caa0e9..98fc6d66e88 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectlinks;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java
index 0ab7a367dcd..0c98b0500d9 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectlinks;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/SearchRequest.java
index 971a70b569a..782360a17ea 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/SearchRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/SearchRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectlinks;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/DeleteRequest.java
index e829711a682..ad9998c5818 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/DeleteRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/DeleteRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectpullrequests;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/ListRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/ListRequest.java
index f88dd9c8b91..b686de59146 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/ListRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/ListRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectpullrequests;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/ProjectPullRequestsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/ProjectPullRequestsService.java
index 95cbc445dfb..996b03e8d0f 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/ProjectPullRequestsService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectpullrequests/ProjectPullRequestsService.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projectpullrequests;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/CreateRequest.java
index ebf16c78713..f2291bd47d1 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/CreateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/CreateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projects;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/DeleteRequest.java
index a9363dd9260..84c75092f8d 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/DeleteRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/DeleteRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projects;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/SearchMyProjectsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/SearchMyProjectsRequest.java
index 8f3a35bce1f..156c54966e9 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/SearchMyProjectsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/SearchMyProjectsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projects;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateKeyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateKeyRequest.java
index b898a36dca8..5e075d36900 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateKeyRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateKeyRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projects;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateVisibilityRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateVisibilityRequest.java
index cd5759c483f..0f34d5d5fa4 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateVisibilityRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/UpdateVisibilityRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projects;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/SearchRequest.java
index 29bc5c0e267..37dc96d1592 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/SearchRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projecttags/SearchRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.projecttags;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/IndexRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/IndexRequest.java
index 61bb0a36f6a..f013ddf27ca 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/IndexRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/IndexRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.properties;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/PropertiesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/PropertiesService.java
index 8bc93b9b24e..ae72a3917c6 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/PropertiesService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/properties/PropertiesService.java
@@ -19,12 +19,10 @@
*/
package org.sonarqube.ws.client.properties;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java
index 7b809301888..174bcac7f02 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java
index 0c6ad785921..f3667e029d8 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java
index 0c620ca2aa5..27228223494 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java
index 4798e7d29af..a3a0215f0aa 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java
index 6b706cd32b2..38f8d1d6957 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java
index 04e618cbbd9..67d1c2c2136 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ListRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ListRequest.java
index 62c057347d7..9656788f0f8 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ListRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ListRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java
index 08598155b2f..4c6fe94e5df 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java
index c72bb9ea76c..8da532ae66f 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java
index 92ec388bb8e..ef130f56d1e 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java
index dfb54315ece..38ff4ca3ec2 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java
index 9957c677af2..127369fc646 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java
index 66a9c18a5a9..b2682ec0017 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UnsetDefaultRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UnsetDefaultRequest.java
index 0f66fb894f7..1289c7d890c 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UnsetDefaultRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UnsetDefaultRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java
index 49573819540..48a637fbd9c 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddGroupRequest.java
index f00eb7fbf75..4c72d27d26f 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddGroupRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddGroupRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddProjectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddProjectRequest.java
index c252c56d330..0240fb95d2d 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddProjectRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddProjectRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddUserRequest.java
index c37698cc75f..26ebc84073d 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddUserRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/AddUserRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/BackupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/BackupRequest.java
index 14ca89ce822..839d1e1fdc7 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/BackupRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/BackupRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangeParentRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangeParentRequest.java
index 304e009389b..46a0fdad48b 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangeParentRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangeParentRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangelogRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangelogRequest.java
index 52ef9db4be2..a8a701999a8 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangelogRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ChangelogRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CompareRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CompareRequest.java
index ceb0cd0eb87..7264cfa7ee4 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CompareRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CompareRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CopyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CopyRequest.java
index b249bfe93d1..cbea778f5c0 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CopyRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CopyRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CreateRequest.java
index 9fd451dda42..4c2a0bf46c2 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CreateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/CreateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java
index 3c565f07160..2d379a30713 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeactivateRuleRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeleteRequest.java
index 02d369c3482..c41edf82ef3 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeleteRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/DeleteRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ExportRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ExportRequest.java
index 1e43092a2a3..32320bbe246 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ExportRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ExportRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/InheritanceRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/InheritanceRequest.java
index 993c9c024ae..dfd905ad08b 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/InheritanceRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/InheritanceRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ProjectsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ProjectsRequest.java
index d2c76c5c327..f8de041d995 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ProjectsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ProjectsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveGroupRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveGroupRequest.java
index d9eeb0d2d3b..ffcf48b9d55 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveGroupRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveGroupRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveProjectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveProjectRequest.java
index 13f3c8ed2f8..389369607dc 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveProjectRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveProjectRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveUserRequest.java
index 7de2179ac66..fb5a42af701 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveUserRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RemoveUserRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RenameRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RenameRequest.java
index 9b1fe18859a..50772d9b0bf 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RenameRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RenameRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RestoreRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RestoreRequest.java
index 5dbafdc48f8..fef62d08587 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RestoreRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/RestoreRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchGroupsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchGroupsRequest.java
index bed76656a4d..b9d71140ed9 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchGroupsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchGroupsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchRequest.java
index b735ffeaa58..d5162bc4573 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchUsersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchUsersRequest.java
index e8aee94ee94..46ebb4aef6c 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchUsersRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SearchUsersRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SetDefaultRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SetDefaultRequest.java
index c7749cf0323..b3601d3ace8 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SetDefaultRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/SetDefaultRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ShowRequest.java
index ea212258c3f..8a6fb6610dc 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ShowRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofiles/ShowRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.qualityprofiles;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/RootsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/RootsService.java
index e77b9d25f04..a24842fc8ed 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/RootsService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/RootsService.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.roots;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/SetRootRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/SetRootRequest.java
index 9e924185fc5..0ecab1ba092 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/SetRootRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/SetRootRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.roots;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/UnsetRootRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/UnsetRootRequest.java
index 53d859181fc..f01342edb4d 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/UnsetRootRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/roots/UnsetRootRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.roots;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/AppRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/AppRequest.java
index fd4ccc5cef1..c35bc0a90f8 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/AppRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/AppRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.rules;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java
index 236f3829a8b..a8ad8a75bc1 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/DeleteRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.rules;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java
index 9ca4eaebba3..6794ae84b91 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RepositoriesRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.rules;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/ShowRequest.java
index 6a1810c8f78..f923e0272f1 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/ShowRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/ShowRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.rules;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/TagsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/TagsRequest.java
index 3ee32e22a88..d7d5c886aad 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/TagsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/TagsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.rules;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/ShowRequest.java
index 0c8bc46f39d..d67fe6e4ea8 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/ShowRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/ShowRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.securityreports;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/server/ServerService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/server/ServerService.java
index 46123a5ec10..abb50880a41 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/server/ServerService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/server/ServerService.java
@@ -19,12 +19,10 @@
*/
package org.sonarqube.ws.client.server;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java
index 752854d7088..bbfa5b96929 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/EncryptRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.settings;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java
index 2a7636f3390..8aebf3334cc 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/ListDefinitionsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.settings;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/HashRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/HashRequest.java
index 1ba0adc7eb2..387b723a62a 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/HashRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/HashRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.sources;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IndexRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IndexRequest.java
index d570b3e22d9..fcc82104431 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IndexRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IndexRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.sources;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IssueSnippetsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IssueSnippetsRequest.java
index c7761b5d42b..a128524bc44 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IssueSnippetsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IssueSnippetsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.sources;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/LinesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/LinesRequest.java
index 05c2c3f2447..594a57380c8 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/LinesRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/LinesRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.sources;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/RawRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/RawRequest.java
index 315905567ff..c691aebd9bf 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/RawRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/RawRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.sources;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ScmRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ScmRequest.java
index 165228c4a5c..0f5588c317f 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ScmRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ScmRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.sources;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ShowRequest.java
index 04fb3c384ad..2d13dee0fe5 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ShowRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/ShowRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.sources;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/SourcesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/SourcesService.java
index 41363d1c635..628d293451c 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/SourcesService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/SourcesService.java
@@ -19,12 +19,10 @@
*/
package org.sonarqube.ws.client.sources;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/ChangeLogLevelRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/ChangeLogLevelRequest.java
index c20e6838a82..aaf5554c4dc 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/ChangeLogLevelRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/ChangeLogLevelRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.system;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/LogsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/LogsRequest.java
index 158df65df17..67cb9359763 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/LogsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/LogsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.system;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java
index 5933264a781..aa935cff673 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemService.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.system;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/timemachine/TimemachineService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/timemachine/TimemachineService.java
index a94882358d7..8181611a58e 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/timemachine/TimemachineService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/timemachine/TimemachineService.java
@@ -19,12 +19,10 @@
*/
package org.sonarqube.ws.client.timemachine;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/InstalledPluginsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/InstalledPluginsRequest.java
index cff5d4ff6bf..66b542de7b5 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/InstalledPluginsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/InstalledPluginsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.updatecenter;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UpdatecenterService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UpdatecenterService.java
index 6239156d1e2..2f71971daa9 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UpdatecenterService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UpdatecenterService.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.updatecenter;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UploadRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UploadRequest.java
index e8d76816096..3799eceb60e 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UploadRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/updatecenter/UploadRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.updatecenter;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/AddUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/AddUserRequest.java
index f38eb722eab..27f3e6ec953 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/AddUserRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/AddUserRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.usergroups;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/CreateRequest.java
index a04e23fa138..e407e740db6 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/CreateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/CreateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.usergroups;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/DeleteRequest.java
index 91e594a6cc1..a05f2b5cea2 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/DeleteRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/DeleteRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.usergroups;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/RemoveUserRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/RemoveUserRequest.java
index 6825aa7b8b5..04c660d5a6e 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/RemoveUserRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/RemoveUserRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.usergroups;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UpdateRequest.java
index e6dd7ef997e..34c569abe70 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UpdateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UpdateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.usergroups;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UsersRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UsersRequest.java
index 8039dc870ae..e2672edea5e 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UsersRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usergroups/UsersRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.usergroups;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/userproperties/UserPropertiesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/userproperties/UserPropertiesService.java
index ff78214912e..e9637e7fce0 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/userproperties/UserPropertiesService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/userproperties/UserPropertiesService.java
@@ -19,12 +19,10 @@
*/
package org.sonarqube.ws.client.userproperties;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java
index 6f604a475f2..cbb7a316b69 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.users;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java
index ecbd14c6c97..05e4ba1689f 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.users;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java
index dfdcfda5bdd..67ae80cbb35 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.users;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/SetHomepageRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/SetHomepageRequest.java
index 752fd0df54f..9e58a8bea31 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/SetHomepageRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/SetHomepageRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.users;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java
index 988bf306ef6..8f0d64ead7b 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.users;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/GenerateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/GenerateRequest.java
index 2e6732015be..f19c10d50ff 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/GenerateRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/GenerateRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.usertokens;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/RevokeRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/RevokeRequest.java
index bbf1892067a..8274104fa02 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/RevokeRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/RevokeRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.usertokens;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/SearchRequest.java
index fdf85f7d824..7bd4645e653 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/SearchRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/SearchRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.usertokens;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/UserTokensService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/UserTokensService.java
index cde8394a3a9..dbc2b101250 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/UserTokensService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertokens/UserTokensService.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.usertokens;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeleteRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeleteRequest.java
index cc6556db3af..082787e4992 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeleteRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeleteRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.webhooks;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeliveryRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeliveryRequest.java
index 5e3bca704e3..a641c8067e8 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeliveryRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/DeliveryRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.webhooks;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/ListRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/ListRequest.java
index ae2e02e8ce8..c8c444e9d8e 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/ListRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhooks/ListRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.webhooks;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ListRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ListRequest.java
index 6515b197200..b4b314f21c8 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ListRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ListRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.webservices;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ResponseExampleRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ResponseExampleRequest.java
index e5b08221780..f6c0bb7886c 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ResponseExampleRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/ResponseExampleRequest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client.webservices;
-import java.util.List;
import javax.annotation.Generated;
/**
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/WebservicesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/WebservicesService.java
index 9f60a802e82..fd2893d1860 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/WebservicesService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/webservices/WebservicesService.java
@@ -19,12 +19,10 @@
*/
package org.sonarqube.ws.client.webservices;
-import java.util.stream.Collectors;
import javax.annotation.Generated;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
/**
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/BaseServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/BaseServiceTest.java
index aca3ff9742a..b1c18e51e79 100644
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/BaseServiceTest.java
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/BaseServiceTest.java
@@ -19,7 +19,6 @@
*/
package org.sonarqube.ws.client;
-import java.io.IOException;
import org.junit.Test;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.Testing;
@@ -34,10 +33,10 @@ public class BaseServiceTest {
WsConnector wsConnector = mock(WsConnector.class);
@Test
- public void test_call() throws Exception {
+ public void test_call() {
new BaseService(wsConnector, "api/issues") {
- public void test() throws IOException {
+ public void test() {
GetRequest get = new GetRequest(path("issue")).setMediaType(MediaTypes.JSON);
when(wsConnector.call(get)).thenReturn(new MockWsResponse().setContent("ok"));
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java
index 189cd24d62d..6b3a95cfaed 100644
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java
@@ -384,7 +384,7 @@ public class HttpConnectorTest {
}
@Test
- public void http_error() throws Exception {
+ public void http_error() {
server.enqueue(new MockResponse().setResponseCode(404));
PostRequest request = new PostRequest("api/issues/search");
underTest = HttpConnector.newBuilder().url(serverUrl).build();
@@ -394,7 +394,7 @@ public class HttpConnectorTest {
}
@Test
- public void support_base_url_ending_with_slash() throws Exception {
+ public void support_base_url_ending_with_slash() {
assertThat(serverUrl).endsWith("/");
underTest = HttpConnector.newBuilder().url(StringUtils.removeEnd(serverUrl, "/")).build();
GetRequest request = new GetRequest("api/issues/search");
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpExceptionTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpExceptionTest.java
index 9989ded8671..d83a5129574 100644
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpExceptionTest.java
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpExceptionTest.java
@@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class HttpExceptionTest {
@Test
- public void test_exception() throws Exception {
+ public void test_exception() {
HttpException exception = new HttpException("http://localhost:9000/api/search", 500, "error");
assertThat(exception.code()).isEqualTo(500);
assertThat(exception.url()).isEqualTo("http://localhost:9000/api/search");