diffj icon indicating copy to clipboard operation
diffj copied to clipboard

Java Varargs syntax not supported

Open rafaelmotaalves opened this issue 4 years ago • 0 comments

Hello, Code that has Overloaded Methods and two of the method have same parameters, but one has varargs is causing inconsistencies on diffj's output, here is an example:

When running this class against itself on diffj:

class Test {
	public void test(String message) {
		System.out.println(message);
	}

	public void test(String ...message) {
		for (int i = 0; i < message.length; i++) {
			System.out.println(message[i]);
		}
	}
}

the following output is returned:

Test.java <=> Test.java
3c7,8 code changed in test(String)
< 		System.out.println(message);
---
> 		for (int i = 0; i < message.length; i++) {
> 			System.out.println(message[i]);

4a9 code added in test(String)
< 	}
---
> 		}

7d3 code removed in test(String)
< 		for (int i = 0; i < message.length; i++) {
---
> 		System.out.println(message);

8d3 code removed in test(String)
< 			System.out.println(message[i]);
---
> 		System.out.println(message);

9d4 code removed in test(String)
< 		}
---
> 	}

I think this is happening because diffj is considering those two methods are same, and it is comparing them with each other.

rafaelmotaalves avatar May 11 '20 22:05 rafaelmotaalves