模拟器中显示了一个堆栈跟踪,可以使用以下简单形式重现
public class EdtProblemForm extends Form {
public EdtProblemForm() {
setLayout(new TextModeLayout(2, 1));
add(firstName);
add(lastName);
}
private final TextComponent firstName = new TextComponent().label("First Name");
private final TextComponent lastName = new TextComponent().label("Last Name");
}
所要做的就是单击第一个字段,然后使用TAB键切换到下一个字段(单击导致没有堆栈跟踪)。
没有我的处理程序,没有我启动或使用的线程,并且stacktrace也没有提到我:
com.codename1.impl.javase.JavaSEPort$EDTViolation: EDT Violation Stack!
at com.codename1.impl.javase.JavaSEPort.checkEDT(JavaSEPort.java:772)
at com.codename1.impl.javase.JavaSEPort.editString(JavaSEPort.java:4412)
at com.codename1.impl.javase.JavaSEPort$56.run(JavaSEPort.java:4397)
at com.codename1.impl.javase.JavaSEPort$2Listener.actionPerformed(JavaSEPort.java:4620)
at com.codename1.impl.javase.JavaSEPort$2Listener.endEditing(JavaSEPort.java:4718)
at com.codename1.impl.javase.JavaSEPort$2Listener$3.run(JavaSEPort.java:4712)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
这种情况总是发生,我问这是我需要的东西还是可以修复或避免的东西。
答案 0 :(得分:0)
这只会在模拟器上发生,因为它在TAB
键处理中违反了EDT。我们有时会以相对安全的方式违反EDT,以保持性能。不幸的是,这会创建一个EDT违规日志。
我们宁愿有这样的“误报”,但如果遇到问题,还会发现实际问题。因此,如果您的代码不涉及到,则可能不是问题。