squid:S128: False positive

14 views
Skip to first unread message

Tobias Stadler

unread,
Apr 8, 2017, 4:14:24 PM4/8/17
to sona...@googlegroups.com
Hello,

I think a found a false positive for squid:S128:

public class Test {

public enum E {
A, B
}

public int test(String s, E e) {
switch (s) {
case "FOO":
return 0;
case "BAR":
switch(e) {
case A:
return 1;
case B:
return 2;
default:
throw new IllegalArgumentException();
}
default:
throw new IllegalArgumentException();
}
}
}

Yes, the „BAR“ case is missing a break or return at the end, but the following case is not executed, because. the „BAR“ case always returns/throws an exception. What do you think?

Best Regards
Tobias

Michael Gumowski

unread,
Apr 10, 2017, 5:13:11 AM4/10/17
to Tobias Stadler, sona...@googlegroups.com
Hey Tobias,

Thanks a lot for the feedback. This is indeed a FP.
Ticket created to handle the issue: SONARJAVA-2231

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/37271872-FE87-4A6B-AA16-8F448DFF8EED%40gmx.de.
For more options, visit https://groups.google.com/d/optout.
--

Michael GUMOWSKI | SonarSource
Software Developer @ Language Team
http://sonarsource.com
Reply all
Reply to author
Forward
0 new messages