<Swing Dev> <AWT Dev> Please review fix for 7179482 : Component.accessibleContext and JComponent.accessibleContext refactoring

Artem Ananiev artem.ananiev at oracle.com
Thu Nov 15 10:19:55 UTC 2012


On 11/15/2012 12:01 AM, Pete Brunet wrote:
> This bug includes a coordination of fixes for both awt (2 files) and
> swing (1 file).  Which repo should I use?  jdk8/awt or jdk8/swing?  I'm
> guessing the latter.  (AccessibleJComponent inherits from
> AccessibleAWTContainer).

When you get approvals from AWT and Swing teams for the last version of 
the fix, please use jdk8/awt-gate to push the changes.

Thanks,

Artem

> Pete
>
> On 11/9/12 3:27 PM, Pete Brunet wrote:
>> Please review the following fix planned for JDK8.  Part of the fix will
>> go into 7u12 under 7177111.
>>
>> Problem:
>> In the process of evaluating 7177111 the following problems were noticed:
>> - Both Component and JComponent have field "accessibleContext".  In
>> Component it is package-private and accessed by other classes from
>> java.awt, but in JComponent it is protected and therefore this field
>> hides the same superclass field from any subclass.  These two fields
>> should be refactored to a single protected field in Component.
>> - Container.AccessibleAWTContainer has an addPropertyChangeListener but
>> not a removePropertyChangeListener.  This method is needed so stale
>> listeners can be removed when AT are no longer attached to a Java process.
>> - The JComponent.AccessibleJComponent.accessibleFocusHandler field
>> functionally duplicates its superclass field,
>> Component.AccessibleAWTComponent.accessibleAWTFocusHandler.  When this
>> field is used properly there are no logical issues.  However, the
>> existence of this field could cause confusion for a developer trying to
>> understand the code.  The superclass field is sufficient.
>>
>> Solution:
>> - Change java.awt.Component.accessibleContext from package-private to
>> protected.  This will allow use by subclasses and the removal of the
>> duplicate field in javax.swing.JComponent.
>> - Add
>> java.awt.Container.AccessibleAWTContainer.removePropertyChangeListener
>> so stale listeners can be removed when an Assistive Technology is no
>> longer attached to a Java process.
>> - Remove the protected field javax.swing.JComponent.accessibleContext.
>> Instead the protected field java.awt.Component.accessibleContext, will
>> be used.  With the change subclasses would now use the protected field
>> in the Component superclass.
>> - Remove public method javax.swing.JComponent.getAccessibleContext.
>> Instead it superclass public method
>> java.awt.Component.getAccessibleContext method would be used.
>> - javax.swing.JComponent.AccessibleJComponent.accessibleFocusHandler
>> field will be deprecated.  Developers should use the
>> java.awt.Component.AccessibleAWTComponent.accessibleAWTFocusHandler
>> field instead.
>>
>> Webrev:  http://cr.openjdk.java.net/~ptbrunet/7179482/webrev.00/
>> Bug:  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7179482
>> CCC:  http://ccc.us.oracle.com/7179482
>



More information about the swing-dev mailing list