<div dir="ltr">Hi Laurent,<div><br></div><div>Thanks for confirming this. I'm not surprised by the results you got: it's pretty clear that there is something on the macOS windows subsystem that is preventing this bug from easily showing there -but your 1st reproducer does not depend on that-.</div><div><br></div><div>Kind regards,</div><div>Martin.-</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 18, 2018 at 9:46 PM, Laurent Bourgès <span dir="ltr"><<a href="mailto:bourges.laurent@gmail.com" target="_blank">bourges.laurent@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="auto"><div>Martin & Sergey,<div dir="auto"><br></div><div dir="auto">Here are my test results on macOS New Sierra:<br></div><div dir="auto"><div dir="auto"><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)">$ uname -a<br></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)">Darwin xxxx 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_<wbr>X86_64 x86_64</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)"><br></p></div><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)">$ source ~/Desktop/test-jdk11.sh </p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)">openjdk version "11" 2018-09-25</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)">OpenJDK Runtime Environment 18.9 (build 11+28)</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)">OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)"><br></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)">$ java TestWinEvent</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)">java.lang.<wbr>IllegalStateException: Total [0] != expected [400] !</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)"><br></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)">$ java TestSeqEventsMultipleContexts</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)">Total [400] - Expected [400]</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:menlo;background-color:rgb(244,255,181)">Test PASSED</p><br></div>So I conclude my former test submitting SequencedEvent directly fails in contrary to using the public Window toBack()/toFront() API on MacOS.</div><div dir="auto">I suppose these last methods do not emit SequencedEvent on macOS (native code) ?</div><div dir="auto"><br></div><div dir="auto">Finally I am a bit annoyed that the <wbr>TestSeqEventsMultipleContexts does not fail on mac, but fails on other platforms Yes, so it is enough for me.</div><div dir="auto">Sergey, should I test on windows too ?</div><div dir="auto"><br></div><div dir="auto">To conclude, I tried adopting a more conservative approach in my last hack, but I needed dispatching InvocationEvents to let swing.Timer continue to work.</div><div dir="auto">I do not know if it is better to select which events to accept (while list) or to select which events not reject (black list): it depends on the number of cases.</div><div dir="auto"><br></div><div>Best Regards,</div><div>Laurent<br></div><div><div class="h5"><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr">Le jeu. 18 oct. 2018 à 16:42, Martin Balao <<a href="mailto:mbalao@redhat.com" target="_blank">mbalao@redhat.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes, your results are exactly what I was expecting.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 18, 2018 at 4:35 PM, Laurent Bourgès <span dir="ltr"><<a href="mailto:bourges.laurent@gmail.com" rel="noreferrer" target="_blank">bourges.laurent@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi Martin,</div><div><br></div><div>Here are my test outputs:<br></div><div><br></div><div>1/ First<br></div><div>$ java TestWinEvent<br>reject ID = 1200 : java.awt.event.<wbr>InvocationEvent[INVOCATION_<wbr>DEFAULT,runnable=javax.swing.<wbr>RepaintManager$<wbr>ProcessingRunnable@28985415,<wbr>notifier=null,catchExceptions=<wbr>false,when=1539872732255] on sun.awt.X11.XToolkit@4645926f</div><div></div><div>reject ID = 1200 : java.awt.event.<wbr>InvocationEvent[INVOCATION_<wbr>DEFAULT,runnable=javax.swing.<wbr>Timer$DoPostEvent@1a954cb5,<wbr>notifier=null,catchExceptions=<wbr>false,when=1539872733214] on sun.awt.X11.XToolkit@4645926f</div><div></div><div>reject ID = 1200 : java.awt.event.<wbr>InvocationEvent[INVOCATION_<wbr>DEFAULT,runnable=javax.swing.<wbr>RepaintManager$<wbr>ProcessingRunnable@1208f81d,<wbr>notifier=null,catchExceptions=<wbr>false,when=1539872733286] on sun.awt.X11.XToolkit@4645926f<br>reject ID = 1100 : java.awt.event.<wbr>InputMethodEvent[INPUT_METHOD_<wbr>TEXT_CHANGED, no text, 0 characters committed, no caret, no visible position] on javax.swing.JButton[,0,51,<wbr>300x25,invalid,alignmentX=0.0,<wbr>alignmentY=0.5,border=javax.<wbr>swing.plaf.BorderUIResource$<wbr>CompoundBorderUIResource@<wbr>75806c8,flags=296,maximumSize=<wbr>,minimumSize=,preferredSize=,<wbr>defaultIcon=,disabledIcon=,<wbr>disabledSelectedIcon=,margin=<wbr>javax.swing.plaf.<wbr>InsetsUIResource[top=2,left=<wbr>14,bottom=2,right=14],<wbr>paintBorder=true,paintFocus=<wbr>true,pressedIcon=,<wbr>rolloverEnabled=true,<wbr>rolloverIcon=,<wbr>rolloverSelectedIcon=,<wbr>selectedIcon=,text=TEST 2,defaultCapable=true]<br>reject ID = 1200 : java.awt.event.<wbr>InvocationEvent[INVOCATION_<wbr>DEFAULT,runnable=javax.swing.<wbr>Timer$DoPostEvent@1a6b3cd6,<wbr>notifier=null,catchExceptions=<wbr>false,when=1539872733215] on sun.awt.X11.XToolkit@4645926f<br>java.lang.<wbr>IllegalStateException: Total [4] != expected [400] !<br>    at TestWinEvent.main(<wbr>TestWinEvent.java:53)<br><br><b>java.lang.<wbr>IllegalStateException: Total [4] != expected [400] !</b><br></div><div><br></div><div>$ java TestSeqEventsMultipleContexts<br>java TestSeqEventsMultipleContexts<br>reject ID = 1200 : java.awt.event.<wbr>InvocationEvent[INVOCATION_<wbr>DEFAULT,runnable=javax.swing.<wbr>RepaintManager$<wbr>ProcessingRunnable@6d620f31,<wbr>notifier=null,catchExceptions=<wbr>false,when=1539872801695] on sun.awt.X11.XToolkit@65746729<br>reject ID = 1200 : java.awt.event.<wbr>InvocationEvent[INVOCATION_<wbr>DEFAULT,runnable=javax.swing.<wbr>Timer$DoPostEvent@2bfb82e8,<wbr>notifier=null,catchExceptions=<wbr>false,when=1539872801890] on sun.awt.X11.XToolkit@65746729<br>reject ID = 1200 : java.awt.event.<wbr>InvocationEvent[INVOCATION_<wbr>DEFAULT,runnable=javax.swing.<wbr>RepaintManager$<wbr>ProcessingRunnable@754b4fe7,<wbr>notifier=null,catchExceptions=<wbr>false,when=1539872801894] on sun.awt.X11.XToolkit@65746729<br>reject ID = 1100 : java.awt.event.<wbr>InputMethodEvent[INPUT_METHOD_<wbr>TEXT_CHANGED, no text, 0 characters committed, no caret, no visible position] on javax.swing.JButton[,0,51,<wbr>300x25,invalid,alignmentX=0.0,<wbr>alignmentY=0.5,border=javax.<wbr>swing.plaf.BorderUIResource$<wbr>CompoundBorderUIResource@<wbr>51861d7a,flags=296,<wbr>maximumSize=,minimumSize=,<wbr>preferredSize=,defaultIcon=,<wbr>disabledIcon=,<wbr>disabledSelectedIcon=,margin=<wbr>javax.swing.plaf.<wbr>InsetsUIResource[top=2,left=<wbr>14,bottom=2,right=14],<wbr>paintBorder=true,paintFocus=<wbr>true,pressedIcon=,<wbr>rolloverEnabled=true,<wbr>rolloverIcon=,<wbr>rolloverSelectedIcon=,<wbr>selectedIcon=,text=TEST 4,defaultCapable=true]<br>reject ID = 1200 : java.awt.event.<wbr>InvocationEvent[INVOCATION_<wbr>DEFAULT,runnable=javax.swing.<wbr>Timer$DoPostEvent@e20778b,<wbr>notifier=null,catchExceptions=<wbr>false,when=1539872801893] on sun.awt.X11.XToolkit@65746729<br><b>Total [8] - Expected [400]<br>Test FAILED</b><br></div><div><br></div><div>So the TestSeqEventsMultipleContexts is failing now: <br></div><div>InvocationEvent must be dispatched as the test uses a Timer() to post 1 event at a time (and avoid polluting the event queue in contrary to the initial TestWinEvent).<br></div><div><br></div><div>2/ Dispatch InvocationEvents:</div><div><br></div><div><br></div><div>$ java TestWinEvent<br>reject ID = 1100 : java.awt.event.<wbr>InputMethodEvent[INPUT_METHOD_<wbr>TEXT_CHANGED, no text, 0 characters committed, no caret, no visible position] on javax.swing.JButton[,0,51,<wbr>300x25,alignmentX=0.0,<wbr>alignmentY=0.5,border=javax.<wbr>swing.plaf.BorderUIResource$<wbr>CompoundBorderUIResource@<wbr>25550fd7,flags=296,<wbr>maximumSize=,minimumSize=,<wbr>preferredSize=,defaultIcon=,<wbr>disabledIcon=,<wbr>disabledSelectedIcon=,margin=<wbr>javax.swing.plaf.<wbr>InsetsUIResource[top=2,left=<wbr>14,bottom=2,right=14],<wbr>paintBorder=true,paintFocus=<wbr>true,pressedIcon=,<wbr>rolloverEnabled=true,<wbr>rolloverIcon=,<wbr>rolloverSelectedIcon=,<wbr>selectedIcon=,text=TEST 45,defaultCapable=true]<br>reject ID = 103 : java.awt.event.ComponentEvent[<wbr>COMPONENT_HIDDEN] on frame0<br></div><div><br></div><div>$ java TestSeqEventsMultipleContexts<br>reject ID = 1100 : java.awt.event.<wbr>InputMethodEvent[INPUT_METHOD_<wbr>TEXT_CHANGED, no text, 0 characters committed, no caret, no visible position] on javax.swing.JButton[,0,51,<wbr>300x25,alignmentX=0.0,<wbr>alignmentY=0.5,border=javax.<wbr>swing.plaf.BorderUIResource$<wbr>CompoundBorderUIResource@<wbr>70122df1,flags=296,<wbr>maximumSize=,minimumSize=,<wbr>preferredSize=,defaultIcon=,<wbr>disabledIcon=,<wbr>disabledSelectedIcon=,margin=<wbr>javax.swing.plaf.<wbr>InsetsUIResource[top=2,left=<wbr>14,bottom=2,right=14],<wbr>paintBorder=true,paintFocus=<wbr>true,pressedIcon=,<wbr>rolloverEnabled=true,<wbr>rolloverIcon=,<wbr>rolloverSelectedIcon=,<wbr>selectedIcon=,text=TEST 17,defaultCapable=true]<br><b>Total [400] - Expected [400]<br>Test PASSED</b></div><div><br></div><div>Here is my last hack:</div><div><span style="font-family:monospace,monospace"><span>    private static final class SequencedEventsFilter implements EventFilter {<br>        private final SequencedEvent currentSequencedEvent;<br>        private SequencedEventsFilter(<wbr>SequencedEvent currentSequencedEvent) {<br>            this.currentSequencedEvent = currentSequencedEvent;<br>        }<br>        @Override<br>        public FilterAction acceptEvent(AWTEvent ev) {<br>            if (ev.getID() == ID) {<br>                // Move forward dispatching only if the event is previous<br>                // in SequencedEvent.list. Otherwise, hold it for reposting later.<br>                synchronized (SequencedEvent.class) {<br></span>                    for (SequencedEvent iev : list) {<span><br>                        if (iev.equals(<wbr>currentSequencedEvent)) {<br>                            break;<br>                        } else if (iev.equals(ev)) {<br>                            return FilterAction.ACCEPT;<br>                        }<br>                    }<br>                }<br>                currentSequencedEvent.<wbr>pendingEvents.add(ev);<br>                return FilterAction.REJECT;<br></span><b>// LAURENT HACK <<<br>            } else if (ev.getID() == SentEvent.ID<br>                        || ev.getID() == java.awt.event.<wbr>InvocationEvent.INVOCATION_<wbr>DEFAULT) { <br>                return FilterAction.ACCEPT;<br>            }<br>System.out.println("reject ID = "+ ev.getID() + " : " + ev.toString());<br>            return FilterAction.REJECT;<br>// LAURENT HACK >></b><br>//            return FilterAction.ACCEPT;<br>        }<br>    }<br></span></div><div><br></div><div>I will then test on Mac  ...</div><span class="m_5747236855151270561m_-968507223820514273m_-2895696877522039491HOEnZb"><font color="#888888"><div></div><div><br></div><div>Laurent<br></div></font></span></div></div></div></div></div></div>
</blockquote></div><br></div>
</blockquote></div></div></div></div></div>
</div>
</blockquote></div><br></div>