5353
5454import javax .annotation .CheckForNull ;
5555import java .util .Arrays ;
56+ import java .util .Collections ;
5657import java .util .EnumMap ;
5758import java .util .HashMap ;
5859import java .util .List ;
@@ -248,7 +249,7 @@ private static Map<DiagnosticSeverity, String> createOldDiagnosticSeverityMap()
248249 map .put (DiagnosticSeverity .CRITICAL , org .sonar .api .rule .Severity .CRITICAL );
249250 map .put (DiagnosticSeverity .BLOCKER , org .sonar .api .rule .Severity .BLOCKER );
250251
251- return map ;
252+ return Collections . unmodifiableMap ( map ) ;
252253 }
253254
254255 private static Map <DiagnosticType , RuleType > createRuleTypeMap () {
@@ -258,7 +259,7 @@ private static Map<DiagnosticType, RuleType> createRuleTypeMap() {
258259 map .put (DiagnosticType .VULNERABILITY , RuleType .VULNERABILITY );
259260 map .put (DiagnosticType .SECURITY_HOTSPOT , RuleType .SECURITY_HOTSPOT );
260261
261- return map ;
262+ return Collections . unmodifiableMap ( map ) ;
262263 }
263264
264265 private static Map <DiagnosticTag , CleanCodeAttribute > createCleanCodeAttributeMap () {
@@ -277,7 +278,7 @@ private static Map<DiagnosticTag, CleanCodeAttribute> createCleanCodeAttributeMa
277278 map .put (DiagnosticTag .SUSPICIOUS , CleanCodeAttribute .LOGICAL );
278279 map .put (DiagnosticTag .UNPREDICTABLE , CleanCodeAttribute .LOGICAL );
279280 map .put (DiagnosticTag .UNUSED , CleanCodeAttribute .LOGICAL );
280- return map ;
281+ return Collections . unmodifiableMap ( map ) ;
281282 }
282283
283284 private static Map <DiagnosticTag , Pair <SoftwareQuality , Severity >> createImpactsMap () {
@@ -296,7 +297,7 @@ private static Map<DiagnosticTag, Pair<SoftwareQuality, Severity>> createImpacts
296297 map .put (DiagnosticTag .SUSPICIOUS , Pair .of (SoftwareQuality .RELIABILITY , Severity .LOW ));
297298 map .put (DiagnosticTag .UNPREDICTABLE , Pair .of (SoftwareQuality .RELIABILITY , Severity .MEDIUM ));
298299 map .put (DiagnosticTag .UNUSED , Pair .of (SoftwareQuality .MAINTAINABILITY , Severity .INFO ));
299- return map ;
300+ return Collections . unmodifiableMap ( map ) ;
300301 }
301302
302303 @ SneakyThrows
0 commit comments