On Wed, 24 Aug 2022 17:08:11 GMT, Phil Race <[email protected]> wrote:
> > > Although I've reviewed the CSR I'd prefer it not be finalized yet. I
> > > think it needs more changes. The spec is SILENT about what then happens
> > > if length is negative and SILENT about an out of range offset too. I
> > > think we should address these issues as well.
> > > Also everywhere - in the CSR and the bug description and summary the text
> > > said the method is called setCharacterAttribute whereas it is
> > > setCharacterAttributes.
> >
> >
> > For negative length, now it just returns the control without processing it
> > whereas before it used to raise an exception in arrayCopy method. Upper
> > bound for length should be the text length(which is to be modified/added) I
> > feel, still even if it crosses overall text size that case is handled by
> > limiting to text length. These are not mentioned in spec, so should we
> > modify the spec by adding the range bounds for length......?
>
> Yes I am saying we should mention all of this
Will this addition to spec be fine -
* A write lock is held by this operation while changes
* are being made, and a DocumentEvent is sent to the listeners
* after the change has been successfully completed.
+ *
+ * <p>
+ * The expected {@Code length} range is the length of the text
+ * in which the attributes are set. If the length is <= 0, then no
+ * attributes are set, the control returns. If the length is > the
+ * length of text in which the attributes are to be set then the
+ * extra length is trimmed.
+ * </p>
+ *
* <p>
* This method is thread safe, although most Swing methods
* are not. Please see
-------------
PR: https://git.openjdk.org/jdk/pull/9830