You should add a subclass test to prove that it works in practice.  If the 
subclasses are required to override the method then shouldn't the 
'withAutoFlush' method check that getClass() == PrintWriter.class otherwise 
throw something like UnsupportedOperationException?

Jason

________________________________________
From: Patrick Reinhart <[email protected]>
Sent: Tuesday, December 27, 2016 8:46 AM
To: Jason Mehrens
Cc: core-libs-dev
Subject: Re: Request for Review and Sponsor needed: JDK-8167648: 
java.io.PrintWriter should have PrintWriter((String|File), Charset) constructors

Hi Jason,

At the moment, a subclass would need to overwrite this method with the
same behaviour. The other solution would be to make the internal state
auto-flush to no longer be final.

-Patrick

On 2016-12-21 22:40, Jason Mehrens wrote:
> Patrick,
>
> How is 'withAutoFlush' expected to behave for subclasses of
> PrintWriter?
>
> Jason

Reply via email to