History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GROOVY-1044
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Paul King
Reporter: Antti Karanta
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

println invoked on a writer object still prints to System.out and not to the given writer

Created: 06/Sep/05 02:31 AM   Updated: 23/Dec/07 12:25 PM
Component/s: None
Affects Version/s: 1.0-JSR-3
Fix Version/s: 1.5.2

Time Tracking:
Not Specified

File Attachments: 1. File printlntest.groovy (0.5 kb)
2. File printlntest.groovy (0.5 kb)

Environment: groovy jsr03, jdk 1.4.2_09

Testcase included: yes


 Description  « Hide
println does not seem to be interpreted as just another method on an object even if it should, e.g.

mywriter.println("FOO")

still seems print to System.out and not invoke the println method on the mywriter object.

Please see the included test case.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Antti Karanta - 06/Sep/05 02:44 AM
Woops, there is a bug in the test case. The line:

assertEquals(foo.join(""), writer.toString())

should be:

assertEquals(foo.join("\n"), writer.toString())

This does not change this being a bug, though. = )


Antti Karanta - 06/Sep/05 02:47 AM
Corrected a bug in the test case. Actually the line I mentioned should be

assertEquals(foo.join("\n") + "\n", writer.toString())

This is corrected in the attached file.


Antti Karanta - 12/Sep/05 02:24 AM
Ah, this seems to be the same issue that made the mailing list today. println method is not actually defined in Writer, so the println that is added to Object class by Groovy is invoked.

I would propose that the added method Object.println be made protected thus making examples like the one I gave fail due to trying to access a method where it is not visible.


Andres Almiray - 28/Nov/07 12:08 AM
This one is still around, DGM does not have a Writer.println version so any calls route to Object.println, effectively printing to stdout instead.
Push it to 1.2?

Paul King - 23/Dec/07 03:35 AM
Now has special code to handle print and println for writers.