On Tue, 27 Sep 2022 18:41:15 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>> API specification says about BasicTextAreaUI.create "Returns a 
>> WrappedPlainView or PlainView". 
>> But for 
>> [bidi](https://github.com/openjdk/jdk/blob/d14e96d9701dae951aa365029f58afb6687a646a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextAreaUI.java#L168)
>>  text, this method returns BoxView and other views , so the documentation 
>> needs to be updated.
>
> src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextAreaUI.java 
> line 142:
> 
>> 140:      * Creates the view for an element.  Returns a WrappedPlainView or
>> 141:      * PlainView if non-bidi text is handled
>> 142:      * else returns PlainParagraph or BoxView if bidi text is being 
>> handled.
> 
> You cannot specify that this method returns `PlainParagraph`, it's a private 
> class. I think we should relax the specification to allow other types to be 
> returned without mentioning the exact types.
> 
> This issue is also relevant to `BasicTextFieldUI`, yet [it does not state 
> explicitly](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/plaf/basic/BasicTextFieldUI.html#create(javax.swing.text.Element))
>  what types are valid, it only gives a hint that a `FieldView` is returned:
> 
>> Creates a view (FieldView) based on an element.
> 
> So, I propose the following text: *“Creates a view for an element. Usually 
> returns a WrappedPlainView or PlainView.”*
> 
> The `@return` tag may be changed to “a view (for the the element)” for this 
> class as well as for `BasicTextFieldUI`.

I guess we can mention "Creates a view for an element." only.
`Usually returns a WrappedPlainView.. ` can give problem to TCK team to create 
testcase for all scenario. Either we mention the full `returns WrappedView or 
PlainView. or ParagraphView or BoxView`

-------------

PR: https://git.openjdk.org/jdk/pull/10376

Reply via email to