JDK-8277243 : Cast to DefaultButtonModel to access getGroup() is unnecessary
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 10,11,17
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2021-11-16
  • Updated: 2024-01-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
As of JDK-8182577, ButtonModel interface has the method getGroup(). Previously, whenever getGroup() was needed, the model object required casting to DefaultButtonModel.

There are a couple of places where model object is cast to DefaultButtonModel before calling getGroup() method.

BasicButtonUI.ButtonGroupInfo.getButtonGroupInfo() (lines 717-719):
            ButtonModel model = activeBtn.getModel();
            if (!(model instanceof DefaultButtonModel))
                return false;