RFR: JDK-6229853: BasicTextAreaUI:create incompletely documents the possible returned View types

Alexey Ivanov aivanov at openjdk.org
Wed Sep 28 11:28:20 UTC 2022


On Tue, 27 Sep 2022 22:51:10 GMT, Phil Race <prr at openjdk.org> wrote:

> Yeah I don't like the way this is documented at all. And it seems this can be swapped out on the fly when content changes too.

`BasicTestUI` implements `ViewFactory` which supplies views for text components.

The type of view returned depends on the document content, in particular whether it contains bidirectional text or not.

> I think we need to start with WHY we need to document the return types. And if we don't then we don't. If we do I'd like some detailed reasoning and contemplation of what we say about if it changes later.

We don't need to. The views for regular text are in public API: [`FieldView`](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/text/FieldView.html) that's used by `BasicTextFieldUI` as well as [`PlainView`](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/text/PlainView.html) and [`WrappedPlainView`](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/text/WrappedPlainView.html) which are used by `BasicTextAreaUI`. Yet the views for bidirectional text aren't public. So it looks, the spec hints at the public types of views returned for the regular text, yet it says nothing about package-private views which support bidirectional text.

`BasicTextFieldUI` says the view is likely `FieldView` in parentheses, but `BasicTextAreaUI` states it returns `WrappedPlainView` or `PlainView` (only), which is incorrect.

Can we leave the reference to public API classes?  
Should we remove the references to types completely? If yes, `BasicTextFieldUI.create` should be updated as well.

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

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



More information about the client-libs-dev mailing list