<Swing Dev> [11] RFR JDK-8190763:Class cast exception on (CompoundEdit) UndoableEditEvent.getEdit()

Semyon Sadetsky semyon.sadetsky at oracle.com
Thu Dec 14 17:22:59 UTC 2017

Hi Prasanta,

This is a compatibility issue.

The complexity of 8030702 is that it had to fix the concurrency issue 
without changing the API. So the only fix that may help here is the one 
that does not change the API.


On 12/14/2017 02:16 AM, Prasanta Sadhukhan wrote:
> Hi All,
> Please review a fix for a regression introduced inJDK-8030702: 
> <https://bugs.openjdk.java.net/browse/JDK-8030702>Deadlock between 
> subclass of AbstractDocument and UndoManager
> where UndoableEditEvent.getEdit() was made to return 
> DefaultDocumentEventUndoableWrapper (or UndoableEdit, an interface) 
> instead of CompoundEdit (a concrete class)
> so when application wants to cast to CompoundEdit, it results in CCE.
> Also, it seems the application expects DefaultDocumentEvent instance 
> also via UndoableEditEvent.getEdit() so that it can utilise it to get 
> offset and length of editable change.
> Proposed fix is to make DefaultDocumentEvent implement 
> UndoableEditLockSupport (used to prevent deadlock in 8030702 
> <https://bugs.openjdk.java.net/browse/JDK-8030702>).
> With this, no CCE is seen and the 8030702 
> <https://bugs.openjdk.java.net/browse/JDK-8030702> also passed.
> http://cr.openjdk.java.net/~psadhukhan/8190763/webrev.00/
> Regards
> Prasanta

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20171214/be32e1a5/attachment.html>

More information about the swing-dev mailing list