Issue Details (XML | Word | Printable)

Key: PORTLETSPEC3-21
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: julien_viet
Votes: 0
Watchers: 0
Operations

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

Add a method for writing a BaseURL to a java.lang.Appendable

Created: 10/May/13 08:12 AM   Updated: 23/Aug/13 04:25 PM   Resolved: 23/Aug/13 04:25 PM
Component/s: Ideas for JSR 362 Extensions
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Tags:
Participants: julien_viet, msnicklous and Neil Griffin


 Description  « Hide

The current BaseURL interface provides capability to write to a java.io.Writer .

It would be a good thing to add the same method for a java.lang.Appendable as the appendable is an abstraction implemented by java.io.Writer but also by many other objects such as java.lang.StringBuilder.



Neil Griffin added a comment - 14/May/13 04:40 AM

I suppose that the standard approach would be to @Deprecate the java.io.Writer methods, but since java.io.Writer implements java.lang.Appendable, the method signatures could simply be changed to:

BaseURL.write(java.lang.Appendable out);
BaseURL.write(java.lang.Appendable out, boolean escapeXML);

All existing code would still compile...


julien_viet added a comment - 14/May/13 05:51 AM - edited

We need to keep the existing method otherwise it will create binary incompatible classes for classes compiled with JSR 286 jar and executed with this API change by throwing a NoSuchMethodError on write(Ljava/io/Writer


Neil Griffin added a comment - 14/May/13 08:13 PM

@julien_viet: You're right – I was thinking of source-compatible and not binary-compatible. Need to keep things binary compatible.


msnicklous added a comment - 23/Aug/13 04:25 PM

Added the proposed BaseURL.write(Appendable) methods.

I did not deprecate the write(Writer) methods due to feedback that we should make it obvious to people that a method accepting a Writer exists and should be used when possible to avoid overhead associated with String / CharSequence processing.