public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* warning when invoking method on java object
@ 2017-09-17 14:34 Sonny To
  2017-09-17 14:45 ` Sudarshan S Chawathe
  0 siblings, 1 reply; 2+ messages in thread
From: Sonny To @ 2017-09-17 14:34 UTC (permalink / raw)
  To: Kawa mailing list

 (context:startActivity i)

gives a warningi
/dev/stdin:23:2: warning - no known slot 'startActivity' in java.lang.Object

it works but why is it giving a warning?

I could do
((as android.app.Application context):startActivity i)

and not get a warning but its more verbose. what is more idiomatic? I
prefer the former but I am concern about getting warnings.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: warning when invoking method on java object
  2017-09-17 14:34 warning when invoking method on java object Sonny To
@ 2017-09-17 14:45 ` Sudarshan S Chawathe
  0 siblings, 0 replies; 2+ messages in thread
From: Sudarshan S Chawathe @ 2017-09-17 14:45 UTC (permalink / raw)
  To: Sonny To; +Cc: Kawa mailing list

I have found that declaring the types of a few key variables and
procedures (using the ::footype syntax) usually gives the
type-inferencing engine enough information to infer the needed types for
the remaining variables (typically generated from the earlier ones by
applying Java methods) and avoid the warnings.

Regards,

-chaw

> From: Sonny To <son.c.to@gmail.com>
> Date: Sun, 17 Sep 2017 07:34:11 -0700
> Subject: warning when invoking method on java object
> To: Kawa mailing list <kawa@sourceware.org>
> 
>  (context:startActivity i)
> 
> gives a warningi
> /dev/stdin:23:2: warning - no known slot 'startActivity' in java.lang.Object
> 
> it works but why is it giving a warning?
> 
> I could do
> ((as android.app.Application context):startActivity i)
> 
> and not get a warning but its more verbose. what is more idiomatic? I
> prefer the former but I am concern about getting warnings.
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-17 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-17 14:34 warning when invoking method on java object Sonny To
2017-09-17 14:45 ` Sudarshan S Chawathe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).