#49 method overloading with characters and string parameters

open
Josson Smith
5
2009-08-22
2009-08-22
Sebastián Gurin
No

The following thorows browser error "Error: uncaught exception: MethodNotFoundException:Method org.sgx.j2s.BugCharMethod.method1(String,String,String) is not found!:

void method1(String s, char c1, char c2) { }
void method1(BugCharMethod c) { }
public static void main(String[] args) {
new BugCharMethod().method1("s", 'c', 'd');
System.out.println("end");
}

Notes: 1) method1 must be overloaded for this bug to raise (If I comment method1(BugCharMethod) definition, the test works ok). I think the problem could be that natively, characters are represented with strings and so they are undistingishiable.

Discussion