egofree
|
|
Posted on: May 30, 2014, 11:05:08 am |
|
|
Joined: Jun 2013
Posts: 601
|
Here is the error message : java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeHi(TimSort.java:868) at java.util.TimSort.mergeAt(TimSort.java:485) at java.util.TimSort.mergeForceCollapse(TimSort.java:426) at java.util.TimSort.sort(TimSort.java:223) at java.util.TimSort.sort(TimSort.java:173) at java.util.Arrays.sort(Arrays.java:659) at java.util.Collections.sort(Collections.java:217) at javax.swing.SortingFocusTraversalPolicy.enumerateAndSortCycle(SortingFocusTraversalPolicy.java:136) at javax.swing.SortingFocusTraversalPolicy.getFocusTraversalCycle(SortingFocusTraversalPolicy.java:110) at javax.swing.SortingFocusTraversalPolicy.getComponentAfter(SortingFocusTraversalPolicy.java:280) at javax.swing.LayoutFocusTraversalPolicy.getComponentAfter(LayoutFocusTraversalPolicy.java:106) at sun.swing.SwingUtilities2.compositeRequestFocus(SwingUtilities2.java:1556) at javax.swing.plaf.basic.BasicTreeUI.startEditing(BasicTreeUI.java:2179) at javax.swing.plaf.basic.BasicTreeUI.startEditingAtPath(BasicTreeUI.java:618) at javax.swing.JTree.startEditingAtPath(JTree.java:2390) at org.lateralgm.main.Listener.actionPerformed(Listener.java:390) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.AbstractButton.doClick(AbstractButton.java:376) at javax.swing.AbstractButton.doClick(AbstractButton.java:356) at javax.swing.plaf.basic.BasicMenuItemUI$Actions.actionPerformed(BasicMenuItemUI.java:802) at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1662) at javax.swing.JComponent.processKeyBinding(JComponent.java:2869) at javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:689) at javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:697) at javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:697) at javax.swing.JMenuBar.processKeyBinding(JMenuBar.java:668) at javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:307) at javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:293) at javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2961) at javax.swing.JComponent.processKeyBindings(JComponent.java:2953) at javax.swing.JComponent.processKeyEvent(JComponent.java:2832) at java.awt.Component.processEvent(Component.java:6282) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1895) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:762) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1027) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:899) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:727) at java.awt.Component.dispatchEventImpl(Component.java:4731) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87) at java.awt.EventQueue$4.run(EventQueue.java:708) at java.awt.EventQueue$4.run(EventQueue.java:706) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:705) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
It happens only under linux. With Windows, it's fine.
|
|
« Last Edit: June 03, 2014, 03:46:09 am by egofree »
|
Logged
|
|
|
|
Goombert
|
|
Reply #1 Posted on: May 30, 2014, 09:58:48 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Sorry egofree, I am not able to reproduce this on Ubuntu. As you can see in the screenshot below I am able to rename resources fine using the right click menu, the edit box, or the edit menu. I also attempted loading another game and renaming resources as well as creating a blank game and one of every resource type and renaming each, and was still not able to reproduce the issue. Can I ask what resource type you are renaming, how you are renaming it, and what distro you are experiencing this under?
|
|
« Last Edit: May 30, 2014, 10:04:06 pm by Robert B Colton »
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
egofree
|
|
Reply #2 Posted on: May 31, 2014, 04:30:57 am |
|
|
Joined: Jun 2013
Posts: 601
|
It happens with all resources, by double-clicking on it, or by pressing f2, or also with the contextual menu. I've Linux Mint KDE 64 bits. It comes with OpenJDK. First i tried to remove OpenJDK and install instead the official Oracle version of Java. It doesn't change anything. Then, i tried to open the LateralGm code in Eclipse and to see why i had this error. But when i run the Lateralgm code from Eclipse i didn't have this error anymore ! I did more tests, and i've found that if i run lateralgm.jar in another directory i don't have this error. (Of course if i run LateralGm alone i can't do much, but it's still possible to create a resource and to rename it). I did more tests, and i've found that if i rename the plugins folder in the enigma-dev folder, i don't have this error. I think the error must come from the jna.jar file. If i rename the enigma.jar file, i've still this error, and i can't run LateralGm if i try to change the name of the jna.jar file.
|
|
« Last Edit: May 31, 2014, 04:40:24 am by egofree »
|
Logged
|
|
|
|
Goombert
|
|
Reply #3 Posted on: May 31, 2014, 08:38:15 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
How are you launching LGM? I cd to enigma-dev then java -jar lateralgm.jar, make sure you cd to the dir that contains LGM. I promise you egofree, nothing has changed, it has always been this way.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
egofree
|
|
Reply #4 Posted on: May 31, 2014, 11:08:25 am |
|
|
Joined: Jun 2013
Posts: 601
|
How are you launching LGM? I cd to enigma-dev then java -jar lateralgm.jar, make sure you cd to the dir that contains LGM. I promise you egofree, nothing has changed, it has always been this way.
Yes that's what i am doing. Perhaps it's because i am using the 64 bits version of Java. I tried to install first the 32 bits version of Java, but when i tried to run LateralGM, it didn't find some libraries needed to run awt and swing. It is looking for 32 bits libraries, but as my OS is 64 bits, only the 32 bits version are installed. I tried to install also 32 bits version of these libraries but i didn't succeed so far.
|
|
« Last Edit: May 31, 2014, 11:12:46 am by egofree »
|
Logged
|
|
|
|
Goombert
|
|
Reply #5 Posted on: May 31, 2014, 11:11:20 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Oh that certainly could be causing issues, why not try a 32bit Java installation?
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
|
Goombert
|
|
Reply #7 Posted on: May 31, 2014, 11:31:29 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
:O That shouldn't be happening though egofree, they are both a part of SE.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
egofree
|
|
Reply #8 Posted on: June 01, 2014, 07:13:34 am |
|
|
Joined: Jun 2013
Posts: 601
|
I did more tests. First i tried on a virtual machine Linux Mint 16 KDE 32 bits with the oracle version of Java 32 bits. Same error. Then i tried Linux Cinnamon 32 bits and it didn't have this problem. Is this related to KDE ? I don't know, but i searched for the error message, and i've found this: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7075600and also: It seems to me like you've hit a bug in the JDK since the error seems to come from Swing classes.
Options:
Define the property java.util.Arrays.useLegacyMergeSort as true. Either using in your code the line
System.setProperty("java.util.Arrays.useLegacyMergeSort", "true"); before any Swing code. As the first line in the main method should work.
Or adding
-Djava.util.Arrays.useLegacyMergeSort=true to your starting options (in the console, or in the project properties in an IDE, Ant script, etc.)
Upgrade your JDK and see if the problem goes away
Downgrade to Java 6 http://stackoverflow.com/questions/13575224/comparison-method-violates-its-general-contract-timsort-and-gridlayoutIt seems this error happens only on some systems with Java >= 7. So in LGM.java i added in the main method the following line : public static void main(final String[] args) { .... System.setProperty("java.util.Arrays.useLegacyMergeSort", "true"); And i don't have anymore this error ! Robert, as i don't know yet git very well, could you do for me a pull request with this line ? Thanks in advance ! Update: It seems Sort algorithm has changed since Java 7 : Area: API: Utilities Synopsis: Updated sort behavior for Arrays and Collections may throw an IllegalArgumentException Description: The sorting algorithm used by java.util.Arrays.sort and (indirectly) by java.util.Collections.sort has been replaced. The new sort implementation may throw an IllegalArgumentException if it detects a Comparable that violates the Comparable contract. The previous implementation silently ignored such a situation. If the previous behavior is desired, you can use the new system property, java.util.Arrays.useLegacyMergeSort, to restore previous mergesort behavior. Nature of Incompatibility: behavioral RFE: 6804124 http://www.oracle.com/technetwork/java/javase/compatibility-417013.htmlSort algorithm changes in Java 7: http://dertompson.com/2012/11/23/sort-algorithm-changes-in-java-7/
|
|
« Last Edit: June 01, 2014, 07:22:18 am by egofree »
|
Logged
|
|
|
|
Goombert
|
|
Reply #9 Posted on: June 01, 2014, 10:45:20 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Ugh, thanks for finding it out egofree. But I can't do that one line fix I don't think, I should actually fix the collection sorting. But also, this doesn't make sense, because renaming a resource in the tree does not do any sorting?
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
Josh @ Dreamland
|
|
Reply #10 Posted on: June 01, 2014, 12:17:27 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
You're doing it wrong; Windows should be inside the VM, and Xubuntu on the outside.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
egofree
|
|
Reply #11 Posted on: June 03, 2014, 03:45:11 am |
|
|
Joined: Jun 2013
Posts: 601
|
But also, this doesn't make sense, because renaming a resource in the tree does not do any sorting?
I did more tests. I think it's not directly related to tree editing, but to some change in the focus between Lateralgm and its plugin. If the plugin is not loaded, you don't have this error. In the error message, you can see : at sun.swing.SwingUtilities2.compositeRequestFocus(SwingUtilities2.java:1556) And in order to have this focus Swing uses internally some arrays sorting. I've tested also Enigma with Kubuntu, and you have also this error ! It seems very likely that this error will happen with every distribution with KDE installed. I don't know how Swing works internally, but i guess depending on the OS and its graphics layer, some rendering and functionalities are not always working in the same way, even if in theory the result should be always the same. The only possible fix i've found so far is adding in LateralGm: System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
|
|
« Last Edit: June 03, 2014, 09:53:07 am by egofree »
|
Logged
|
|
|
|
Goombert
|
|
Reply #12 Posted on: June 04, 2014, 12:43:52 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
ego, how would we go about just putting LGM back into focus? It seems as though that would be technically more correct.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
egofree
|
|
Reply #13 Posted on: June 07, 2014, 08:55:16 am |
|
|
Joined: Jun 2013
Posts: 601
|
I worked again on this bug. I think i've finally found the culprit ! It seems it is the stopb button which is also managed in the plugin!! This button is used to stop the compiling process. It is enabled when we are starting the process, but anyway as far i can tell it is never displayed, so it is useless. If i comment all lines which are related to this button in EnigmaRunner.java, the bug is gone. As this button is in fact never really used, what about removing this button and the corresponding stop menu ? The stop menu and button are declared in EnigmaRunner.java : public JMenuItem busy, run, debug, design, compile, rebuild, stop; public JButton stopb, runb, debugb, compileb; If you search the stopb and stop keywords, you will find only a few lines of code, so it is very easy to comment. By the way, i tested the other day another distro of Linux Mint (i think it was Mate). This is non KDE, but still the bug is present in this distro.
|
|
« Last Edit: June 07, 2014, 10:52:19 am by egofree »
|
Logged
|
|
|
|
Goombert
|
|
Reply #14 Posted on: June 07, 2014, 11:01:49 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Thank you egofree, I will investigate, the button being there but hidden should not be causing errors.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
|