bugKawa - Bugs: bug #39948, Better Java method resolution when...

 
 

bug #39948: Better Java method resolution when using primitive arguments

Submitter:  None
Submitted:  Wed 04 Sep 2013 10:39:09 PM UTC
   
 
Category:  Type declaration and inference Severity:  3 - Normal
Item Group:  Feature Request Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 04 Sep 2013 10:39:09 PM UTC, original submission:  

Example:


$ cat Test.java
public class Test {

  public void put(int i, Object o) {
    System.out.println("int " + i + " -> " + o);
  }

  public void put(Integer i, Object o) {
    System.out.println("Integer " + i + " -> " + o);
  }

}

$ javac Test.java
$ java -cp kawa-1.13.jar:. kawa.repl
#|kawa:1|# (define (put x::Test i::int) (x:put i "dummy"))
/dev/stdin:1:30: warning - more than one definitely applicable method `put' in Test
  candidate: void Test.put(java.lang.Integer,java.lang.Object)
  candidate: void Test.put(int,java.lang.Object)
#|kawa:2|# (put (Test) 44)
Integer 44 -> dummy


Since put was defined as taking a primitive int and not an Integer I'd expect the put method to resolve to the int version of Test and not the Integer version of Test.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

No changes have been made to this item

Back to the top

Powered by Savane 3.13-f8d8.
Corresponding source code