Use 'unused' in noncompliant

Co-authored-by: Dorian Burihabwa <75226315+dorian-burihabwa-sonarsource@users.noreply.github.com>
This commit is contained in:
tomasz-tylenda-sonarsource 2025-03-28 17:53:04 +01:00 committed by GitHub
parent c2c26fa255
commit 5181655269
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,11 +9,11 @@ Library authors often design APIs to be versatile, enabling them to handle diver
==== Noncompliant code example
[source,java,diff-id=1,diff-type=noncompliant]
----
BiFunction<Integer,Integer,Integer> f = (a, b) -> a; // Noncompliant
BiFunction<Integer,Integer,Integer> f = (a, unused) -> a; // Noncompliant
// ...
firstValueMap.merge(event.id, event.value, (oldValue, newValue) -> oldValue); // Noncompliant
firstValueMap.merge(event.id, event.value, (oldValue, unused) -> oldValue); // Noncompliant
----
==== Compliant solution