Skip to content

Commit 51b7dda

Browse files
committed
Collections.unmodifiableList
1 parent 6a332ce commit 51b7dda

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

sonar-c-plugin/src/main/java/org/sonar/plugins/c/CPlugin.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public final class CPlugin implements Plugin {
9393

9494
private static List<PropertyDefinition> generalProperties() {
9595
String subcateg = "(1) General";
96-
return new ArrayList<>(Arrays.asList(
96+
return Collections.unmodifiableList(Arrays.asList(
9797
PropertyDefinition.builder(SOURCE_FILE_SUFFIXES_KEY).multiValues(true)
9898
.defaultValue(CLanguage.DEFAULT_SOURCE_SUFFIXES)
9999
.name("Source files suffixes")
@@ -189,7 +189,7 @@ private static List<PropertyDefinition> generalProperties() {
189189

190190
private static List<PropertyDefinition> codeAnalysisProperties() {
191191
String subcateg = "(2) Code analysis";
192-
return new ArrayList<>(Arrays.asList(PropertyDefinition.builder(LANG_PROP_PREFIX
192+
return Collections.unmodifiableList(Arrays.asList(PropertyDefinition.builder(LANG_PROP_PREFIX
193193
+ CxxCppCheckSensor.REPORT_PATH_KEY)
194194
.name("Cppcheck report(s)")
195195
.description("Path to a <a href='http://cppcheck.sourceforge.net/'>Cppcheck</a> analysis XML report, "
@@ -354,7 +354,7 @@ private static List<PropertyDefinition> codeAnalysisProperties() {
354354

355355
private static List<PropertyDefinition> compilerWarningsProperties() {
356356
String subcateg = "(4) Compiler warnings";
357-
return new ArrayList<>(Arrays.asList(
357+
return Collections.unmodifiableList(Arrays.asList(
358358
PropertyDefinition.builder(LANG_PROP_PREFIX + CxxCompilerVcSensor.REPORT_PATH_KEY)
359359
.name("VC Compiler Report(s)")
360360
.description("Path to compilers output (i.e. file(s) containg compiler warnings), relative to projects root."
@@ -430,7 +430,7 @@ private static List<PropertyDefinition> compilerWarningsProperties() {
430430

431431
private static List<PropertyDefinition> testingAndCoverageProperties() {
432432
String subcateg = "(3) Testing & Coverage";
433-
return new ArrayList<>(Arrays.asList(
433+
return Collections.unmodifiableList(Arrays.asList(
434434
PropertyDefinition.builder(LANG_PROP_PREFIX + CxxCoverageSensor.REPORT_PATH_KEY)
435435
.name("Unit test coverage report(s)")
436436
.description("Path to a report containing unit test coverage data, relative to projects root."
@@ -465,7 +465,7 @@ private static List<PropertyDefinition> testingAndCoverageProperties() {
465465

466466
private static List<PropertyDefinition> duplicationsProperties() {
467467
String subcateg = "(5) Duplications";
468-
return new ArrayList<>(Arrays.asList(
468+
return Collections.unmodifiableList(Arrays.asList(
469469
PropertyDefinition.builder(CPlugin.CPD_IGNORE_LITERALS_KEY)
470470
.defaultValue(Boolean.FALSE.toString())
471471
.name("Ignores literal value differences when evaluating a duplicate block")

sonar-cxx-plugin/src/main/java/org/sonar/plugins/cxx/CxxPlugin.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public final class CxxPlugin implements Plugin {
9696

9797
private static List<PropertyDefinition> generalProperties() {
9898
String subcateg = "(1) General";
99-
return new ArrayList<>(Arrays.asList(
99+
return Collections.unmodifiableList(Arrays.asList(
100100
PropertyDefinition.builder(SOURCE_FILE_SUFFIXES_KEY)
101101
.multiValues(true)
102102
.defaultValue(CppLanguage.DEFAULT_SOURCE_SUFFIXES)
@@ -197,7 +197,7 @@ private static List<PropertyDefinition> generalProperties() {
197197

198198
private static List<PropertyDefinition> codeAnalysisProperties() {
199199
String subcateg = "(2) Code analysis";
200-
return new ArrayList<>(Arrays.asList(PropertyDefinition.builder(LANG_PROP_PREFIX
200+
return Collections.unmodifiableList(Arrays.asList(PropertyDefinition.builder(LANG_PROP_PREFIX
201201
+ CxxCppCheckSensor.REPORT_PATH_KEY)
202202
.name("Cppcheck report(s)")
203203
.description("Path to a <a href='http://cppcheck.sourceforge.net/'>Cppcheck</a> analysis XML report, relative to"
@@ -378,7 +378,7 @@ private static List<PropertyDefinition> codeAnalysisProperties() {
378378

379379
private static List<PropertyDefinition> compilerWarningsProperties() {
380380
String subcateg = "(4) Compiler warnings";
381-
return new ArrayList<>(Arrays.asList(
381+
return Collections.unmodifiableList(Arrays.asList(
382382
PropertyDefinition.builder(LANG_PROP_PREFIX + CxxCompilerVcSensor.REPORT_PATH_KEY)
383383
.name("VC Compiler Report(s)")
384384
.description("Path to compilers output (i.e. file(s) containg compiler warnings), relative to projects root."
@@ -454,7 +454,7 @@ private static List<PropertyDefinition> compilerWarningsProperties() {
454454

455455
private static List<PropertyDefinition> testingAndCoverageProperties() {
456456
String subcateg = "(3) Testing & Coverage";
457-
return new ArrayList<>(Arrays.asList(
457+
return Collections.unmodifiableList(Arrays.asList(
458458
PropertyDefinition.builder(LANG_PROP_PREFIX + CxxCoverageSensor.REPORT_PATH_KEY)
459459
.name("Unit test coverage report(s)")
460460
.description("List of paths to reports containing unit test coverage data, relative to projects root."
@@ -517,7 +517,7 @@ private static List<PropertyDefinition> testingAndCoverageProperties() {
517517

518518
private static List<PropertyDefinition> duplicationsProperties() {
519519
String subcateg = "(5) Duplications";
520-
return new ArrayList<>(Arrays.asList(
520+
return Collections.unmodifiableList(Arrays.asList(
521521
PropertyDefinition.builder(CxxPlugin.CPD_IGNORE_LITERALS_KEY)
522522
.defaultValue(Boolean.FALSE.toString())
523523
.name("Ignores literal value differences when evaluating a duplicate block")

0 commit comments

Comments
 (0)