Mantis - Quercus
Viewing Issue Advanced Details
4246 major always 10-07-10 07:40 03-29-13 00:27
andrew_miah  
domdorn  
normal  
closed 4.0.7  
fixed  
none    
none  
0004246: Invocation of java method, differing only by parameter type: enum versus integer, cannot resolve method.
Quercus could not resolve two methods which differ only by parameter, e.g.:

public void get( Long l );
public void get( MyEnum e );

Exception:

java.lang.UnsupportedOperationException: class com.caucho.quercus.marshal.EnumMarshal
    at com.caucho.quercus.marshal.Marshal.getMarshalingCostImpl(Marshal.java:215)
    at com.caucho.quercus.marshal.Marshal.getMarshalingCost(Marshal.java:210)
    at com.caucho.quercus.env.JavaInvoker.getMarshalingCost(JavaInvoker.java:502)
    at com.caucho.quercus.env.JavaOverloadMethod.getBestFitJavaMethod(JavaOverloadMethod.java:231)
...
 Bugs111010.zip [^] (640 bytes) 10-11-10 03:21

Notes
(0004784)
domdorn   
10-08-10 07:34   
Could you please provide a small testcase?
ideal would be the following files
- MyEnum.java
- the class containing your get methods
- a small php file that shows how you are using the class


Thank you.
(0004789)
andrew_miah   
10-11-10 03:21   
Please find attached a simple example case.

BR,
Andrew.
(0005266)
domdorn   
05-20-11 00:39   
fixed in current trunk, will be in 4.0.19

php/0cs1

package qa;

public enum MyEnum {
A,B,C
}

public class Foo {

        public String get(Long id){

                return "L";
        }

        public String get(MyEnum id){
                return "E";
        }
}

<?php


import qa.MyEnum;
import qa.Foo;

$enum = MyEnum::A;
$longval = (int) 5;

var_dump($enum);
var_dump($longval);


$foo = new Foo();

echo $foo->get($enum);
echo "\n";

echo $foo->get($longval);
echo "\n";

?>

would result in

resource(A)
int(5)
E
L