<Swing Dev> [11][JDK-6303622]Use generic in Swing components like JComboBox
Krishna Addepalli
krishna.addepalli at oracle.com
Fri Feb 23 14:55:19 UTC 2018
Hi All,
I have modified the webrev to accommodate suggestions made by Joe.
Here is the webrev: http://cr.openjdk.java.net/~kaddepalli/6303622/webrev01/
Thanks,
Krishna
From: Krishna Addepalli
Sent: Tuesday, January 30, 2018 7:21 PM
To: Kevin Rushforth <kevin.rushforth at oracle.com>
Cc: swing-dev at openjdk.java.net
Subject: RE: <Swing Dev> [11][JDK-6303622]Use generic in Swing components like JComboBox
Hi Kevin,
Thanks for your review.
I have filed a CSR here: https://bugs.openjdk.java.net/browse/JDK-8196396
Source compatibility wise, the changes will produce warnings only in some cases. For example, with the below code snippet, there would be no warnings:
JComboBox cb = new JComboBox(new String[]{"one", "two", "three"});
String c = (String)cb.getSelectedItem();
Whereas the below code snippet would generate "redundant cast" warning on compilation.
JComboBox<String> cb = new JComboBox<>(new String[]{"one", "two", "three"});
String c = (String)cb.getSelectedItem();
Binary compatibility wise, I have checked that code that was compiled in jdk10 ran without any problems in jdk11. And also, behavior wise, there are no changes.
Thanks,
Krishna
From: Kevin Rushforth
Sent: Thursday, January 25, 2018 9:46 PM
To: Krishna Addepalli <HYPERLINK "mailto:krishna.addepalli at oracle.com"krishna.addepalli at oracle.com>
Cc: HYPERLINK "mailto:swing-dev at openjdk.java.net"swing-dev at openjdk.java.net
Subject: Re: <Swing Dev> [11][JDK-6303622]Use generic in Swing components like JComboBox
I presume you plan to file a CSR? Have you verified that this change preserves both binary and source code compatibility?
-- Kevin
Krishna Addepalli wrote:
Hi All,
Please review a fix for the Enhancement:
JDK-6303622: https://bugs.openjdk.java.net/browse/JDK-6303622
Webrev: HYPERLINK "http://cr.openjdk.java.net/%7Ekaddepalli/6303622/webrev00/"http://cr.openjdk.java.net/~kaddepalli/6303622/webrev00/
The enhancement requests to provide the generic return type for getSelectedItem() to avoid ugly casts for the developers using the api. Have done changes accordingly for JComboBox and JList, and all supporting classes.
Thanks,
Krishna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20180223/a1fc3faf/attachment.html>
More information about the swing-dev
mailing list