This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Android: more than one definitely applicable method


On 07/26/2012 11:05 PM, craven@gmx.net wrote:
Sometimes I get the following warning when a method has been overloaded
for multiple types:

test.scm:42:8: more than one definitely applicable method `put' in android.content.ContentValues
   candidate: void android.content.ContentValues.put(java.lang.String,java.lang.Double)
   candidate: void android.content.ContentValues.put(java.lang.String,java.lang.Long)
   candidate: void android.content.ContentValues.put(java.lang.String,java.lang.Float)

In this case, I have the following code:

(let ((values (<android.content.ContentValues>)))
   (let ((oid :: long 5))
     (values:put game-_id oid)))

which should probably choose the second candidate.

I agree. I created: https://savannah.gnu.org/bugs/index.php?36973

It seems that Kawa
gets confused by the implicit casts between primitive types here, but
I've seen the same problem with <java.lang.String> and
<java.lang.CharSequence>.

Is there any way to tell the compiler that I really want exactly the
method for <long> here?

Well, the change the type seems to work:


(let ((values (<android.content.ContentValues>)))
  (let ((oid :: java.lang.Long 5))
    (values:put game-_id oid)))
or you can do:
  (values:put game-_id (as java.lang.Long oid))
or:
  (values:put game-_id (java.lang.Long oid))
or:
  (values:put game-_id (java.lang.Long:valueOf oid))
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]