This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Android: more than one definitely applicable method
- From: Per Bothner <per at bothner dot com>
- To: craven at gmx dot net
- Cc: kawa mailing list <kawa at sourceware dot org>
- Date: Thu, 26 Jul 2012 23:22:01 -0700
- Subject: Re: Android: more than one definitely applicable method
- References: <8762997n8z.fsf@nexoid.at>
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/