portletspec3
  1. portletspec3
  2. PORTLETSPEC3-21

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

    Details

      Description

      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.

        Activity

        Hide
        Neil Griffin added a comment -

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

        Show
        Neil Griffin added a comment - 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...
        Hide
        julien_viet added a comment - - 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

        Show
        julien_viet added a comment - - 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
        Hide
        Neil Griffin added a comment -

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

        Show
        Neil Griffin added a comment - @julien_viet: You're right – I was thinking of source-compatible and not binary-compatible. Need to keep things binary compatible.
        Hide
        msnicklous added a comment -

        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.

        Show
        msnicklous added a comment - 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.

          People

          • Assignee:
            Unassigned
            Reporter:
            julien_viet
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: