jython type coercion to interface type

Harald Kirsch pifpafpuf at gmx.de
Thu Jun 26 08:35:59 EDT 2003


Ype Kingma <ykingma at accessforall.nl> wrote in message news:<3ef9f6ab$0$141$e4fe514c at dreader5.news.xs4all.nl>...
> Harald Kirsch wrote:
[snip]
> > class X {
> >   public X(CharSequence s) { ... }
> > }
[snip]
> >   x = X(CharSequence("bla"))
> >
> > and got "can't instantiate interface (java.lang.CharSequence)"

> Could you try this:
> 
> from java.lang import String
> 
> x = X(String("bla"))
> 
Yes, this worked.

  Thanks,
  Harald




More information about the Python-list mailing list