[jdk11u-dev] RFR: 8315606: Open source few swing text/html tests
Andrew John Hughes
andrew at openjdk.org
Wed Nov 29 01:33:16 UTC 2023
On Fri, 27 Oct 2023 17:02:16 GMT, Sonia Zaldana Calles <szaldana at openjdk.org> wrote:
> Hi all,
> This pull request contains a backport of commit [4127fbb9ed6ca3c3e82da599dbf9cee54de5da31](https://github.com/openjdk/jdk/commit/4127fbb9ed6ca3c3e82da599dbf9cee54de5da31).
>
> Patch doesn't apply cleanly. There are some slight changes in test/jdk/javax/swing/text/html/ImageView/bug4329185.java regarding pattern matching for instanceof. Pattern matching was introduced in Java 14, so it raises a compilation error. I resolved by adding some casting.
>
>
> diff --git a/test/jdk/javax/swing/text/html/ImageView/bug4329185.java b/test/jdk/javax/swing/text/html/ImageView/bug4329185.java
> index 6338e395d45..da43b8b80dc 100644
> --- a/test/jdk/javax/swing/text/html/ImageView/bug4329185.java
> +++ b/test/jdk/javax/swing/text/html/ImageView/bug4329185.java
> @@ -103,8 +103,7 @@ public class bug4329185 {
> public View create(Element elem) {
> Object o = elem.getAttributes()
> .getAttribute(StyleConstants.NameAttribute);
> - if (o instanceof HTML.Tag) {
> - HTML.Tag kind = (HTML.Tag) o;
> + if (o instanceof HTML.Tag kind) {
> if (kind == HTML.Tag.IMG) {
> View v = super.create(elem);
> views[i++] = v;
Changes to work around JEP 394 Pattern Matching look good and backport is otherwise clean. I presume the test passes on 11u?
-------------
Marked as reviewed by andrew (Reviewer).
PR Review: https://git.openjdk.org/jdk11u-dev/pull/2234#pullrequestreview-1754228596
More information about the jdk-updates-dev
mailing list