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: kawa 1.14: java.io.PrintWriter prints everything as "true"


On 10/08/2013 06:51 PM, Ito Kazumitsu wrote:
I succeeded in simplifying the script significantly.

Indeed, that is a helpful testcase.  Thanks.

The bug war introduced 2013-06-02 when fixing Savannah bug #39047
"Wrong incompatible type (boolean) with expected int".
Specifically the changes in the compare method in LangPrimType.java.
"Fixing" that method fixes your bug, but causes other issues
I'm looking at.

The underlying issue is that Scheme allows any value to
used as a boolean.  Kawa generalizes this so that any value
can be converted to boolean - which then leads to some
awkwardness with overload resolution: Which is the
"more specific method" of:

PrintWriter#println(boolean)
PrintWriter#println(Object)

They are equally general, in that any value can be converted to boolean,
and any value can be converted to Object.  I think we have this ok
when it comes to compile-time method selection (bug #39047 was partly
about fixing this), but it may be harder to get it right for run-time
method selection.  However, I will keep looking at the problem.

To work around the problem you can do:

(define-constant wtr
   (java.io.PrintWriter
       (java.io.OutputStreamWriter (java.lang.System:.out) "UTF-8")))

or:

(define wtr ::java.io.PrintWriter
   (java.io.PrintWriter
       (java.io.OutputStreamWriter (java.lang.System:.out) "UTF-8")))

--
	--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]