[Java] False positive on squid:S1905 when casting lambda to FunctionalInterface and assigning to non-FunctionalInterface supertype

14 views
Skip to first unread message

cba...@mimsoftware.com

unread,
Mar 8, 2018, 3:30:24 PM3/8/18
to SonarQube
The following raises a false positive on S1905:

interface A {
default void foo(){}
default void bar(){}

interface B extends A {
void foo();
}

static void main() {
A a = (B) ()->{}; //Triggers S1905 but A is not a valid target for the lambda
}
}


Using SonarLint 3.2.1.2406

Michael Gumowski

unread,
Mar 9, 2018, 3:21:11 AM3/9/18
to cba...@mimsoftware.com, SonarQube
Hello,

Thank you for your feedback. Nice catch. Ticket created to fix the issue: SONARJAVA-2667 

Cheers,
Michael

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/4c5d0c1c-ee84-46a3-b1c7-83e91fe01e64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Michael Gumowski | SonarSource
Software Developer, Language Team
https://www.sonarsource.com
Reply all
Reply to author
Forward
0 new messages