lizard icon indicating copy to clipboard operation
lizard copied to clipboard

Fail to recognize the java anonymous class

Open cyw3 opened this issue 4 years ago • 0 comments

Lizard can not recognize the anonymous class very well, and then adds the cyclomatic complexity of all functions in the anonymous class and calculates it in the cyclomatic complexity of the function where the anonymous class is located.

I think this is inaccurate.

For example, here is a demo java:

class Demo{
	public void test() {
		new Thread(new Runnable() {
			
			@Override
			public void run() {
				if(true) {
					System.out.println("Hello");
				}
			}
			
			public void testA() {
				if(true) {
					System.out.println("World!");
				}
			}
		}).start();
	}
}

output is: 15,3,66,0,17,"Demo::test@4-20@/xxx/Demo.java","/xxx/Demo.java","Demo::test","Demo::test()",4,20

cyw3 avatar May 06 '20 07:05 cyw3