terryyin / lizard

A simple code complexity analyser without caring about the C/C++ header files or Java imports, supports most of the popular languages.
Other
1.82k stars 248 forks source link

Java CCN issue with bounded wildcards #323

Closed MarcW1g closed 3 years ago

MarcW1g commented 3 years ago

When the following code snippet is evaluated, the ? in Class<? extends String> is counted as a condition (thus, adding 1 to the CCN). This results in the following method:

void A(){
    List<?> list = new ArrayList<Set<Class<? extends String>>>();
}

having a Cyclomatic Complexity of 2, even though this should be 1.

terryyin commented 3 years ago

Thanks for the report. It was very easy to reproduce this in a test.

This bug is fixed now.