kawa 1.14: java.io.PrintWriter prints everything as "true"

Ito Kazumitsu kaz@maczuka.gcd.org
Wed Oct 9 01:51:00 GMT 2013


From: Per Bothner <per@bothner.com>
Subject: Re: kawa 1.14: java.io.PrintWriter prints everything as "true"
Date: Tue, 08 Oct 2013 00:05:14 -0700

> * Try using the latest Subversion of Kawa - it's possible the fix
> I checked in for your previous bug report may be relevant.

I tried the latest Subversion of Kawa, but it did not help.

> * Simplify your script as much as you can.  For example:

I succeeded in simplifying the script significantly.

> * Try removing the --no-warn-unknown-member flags - that warning
> tells you useful information.
> 
> * If you're adventurous, try adding the --debug-print-final-expr
> flag.  That tells you how Kawa has analyzed your code - i.e.
> what it looks like just before bytecode generation.

Here it is.

$ cat test.scm
(define wtr
   (java.io.PrintWriter
       (java.io.OutputStreamWriter (java.lang.System:.out) "UTF-8")))
(define (print-it)
    (wtr:println "PRINT ME"))
(print-it)
(wtr:flush)

$ java -cp kawa-1.14.1-svn.jar kawa.repl --debug-print-final-expr  --script test.scm
[Compiling final atInteractiveLevel$1 to atInteractiveLevel$1:
(Module/atInteractiveLevel$1/1/ (Declarations: wtr/15/fl:40809)
  (Define line:1:1 /Declaration[wtr/15]
    (Apply => ClassType java.io.PrintWriter line:2:4
      (Quote
        java.io.PrintWriter java.io.PrintWriter.<init>(java.io.Writer) ::gnu.expr.PrimProcedure)
      (Quote class java.io.PrintWriter ::class)
      (Apply => ClassType java.io.OutputStreamWriter line:3:8
        (Quote
          java.io.OutputStreamWriter java.io.OutputStreamWriter.<init>(java.io.OutputStream,java.lang.String) ::gnu.expr.PrimProcedure)
        (Quote class java.io.OutputStreamWriter ::class)
        (Apply => ClassType java.io.PrintStream line:3:36
          (Quote #<procedure static-field> ::gnu.kawa.reflect.SlotGet)
          (Quote ClassType java.lang.System ::class-type)
          (Quote Field:java.lang.System.out ::gnu.bytecode.Field))
        (Quote "UTF-8" ::java.lang.String)))))]
test.scm:5:6: warning - no known slot 'println' in java.lang.Object
[Compiling final atInteractiveLevel$2 to atInteractiveLevel$2:
(Module/atInteractiveLevel$2/6/
  (Declarations: print-it/26/fl:408c8::gnu.mapping.Procedure)
  (Define line:4:1 /Declaration[print-it/26]
    (Lambda/print-it/8/fl:3 line:4:9 ()
      (Apply [tailcall] line:5:5 (Ref/15/Declaration[applyToArgs/2])
        (Apply line:5:6
          (Quote
            #<procedure gnu.kawa.functions.GetNamedPart> ::gnu.kawa.functions.GetNamedPart)
          (Ref/13/Declaration[wtr/15])
          (Quote println ::gnu.mapping.SimpleSymbol))
        (Quote "PRINT ME" ::java.lang.String)))))]
[Compiling final atInteractiveLevel$3 to atInteractiveLevel$3:
(Module/atInteractiveLevel$3/10/ ()
  (Apply [tailcall] line:6:1 (Ref/17/Declaration[print-it/26])))]
test.scm:7:2: warning - no known slot 'flush' in java.lang.Object
[Compiling final atInteractiveLevel$4 to atInteractiveLevel$4:
(Module/atInteractiveLevel$4/11/ ()
  (Apply [tailcall] line:7:1 (Ref/24/Declaration[applyToArgs/2])
    (Apply line:7:2
      (Quote
        #<procedure gnu.kawa.functions.GetNamedPart> ::gnu.kawa.functions.GetNamedPart)
      (Ref/22/Declaration[wtr/15])
      (Quote flush ::gnu.mapping.SimpleSymbol))))]
true



More information about the Kawa mailing list