question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.IllegalArgumentException: Comparison method violates its general contract!

See original GitHub issue

Please describe what you did before the error occurred. IMPORTANT! If the error occurs with a specific APK file please attach or provide link to apk file!

  • Jadx version: 1.4.3
  • Java version: 11.0.12
  • Java VM: JetBrains s.r.o OpenJDK 64-Bit Server VM
  • Platform: Windows 10 (10.0 amd64)
  • Max heap size: 30688 MB
  • Program args: -Xms128M -XX:MaxRAMPercentage=70.0 -XX:+UseG1GC -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true
java.lang.IllegalArgumentException: Comparison method violates its general contract!
	at java.base/java.util.ComparableTimSort.mergeHi(ComparableTimSort.java:870)
	at java.base/java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:487)
	at java.base/java.util.ComparableTimSort.mergeCollapse(ComparableTimSort.java:413)
	at java.base/java.util.ComparableTimSort.sort(ComparableTimSort.java:213)
	at java.base/java.util.Arrays.sort(Arrays.java:1249)
	at java.desktop/sun.awt.shell.Win32ShellFolderManager2.get(Win32ShellFolderManager2.java:313)
	at java.desktop/sun.awt.shell.ShellFolder.get(ShellFolder.java:259)
	at java.desktop/javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.addItem(MetalFileChooserUI.java:1029)
	at java.desktop/javax.swing.plaf.metal.MetalFileChooserUI.doDirectoryChanged(MetalFileChooserUI.java:717)
	at java.desktop/javax.swing.plaf.metal.MetalFileChooserUI$5.propertyChange(MetalFileChooserUI.java:806)
	at java.desktop/java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:341)
	at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
	at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:266)
	at java.desktop/java.awt.Component.firePropertyChange(Component.java:8754)
	at java.desktop/javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:608)
	at java.desktop/javax.swing.JFileChooser.<init>(JFileChooser.java:362)
	at java.desktop/javax.swing.JFileChooser.<init>(JFileChooser.java:338)
	at jadx.gui.ui.dialog.FileDialog$FileChooser.<init>(FileDialog.java:156)
	at jadx.gui.ui.dialog.FileDialog.buildFileChooser(FileDialog.java:138)
	at jadx.gui.ui.dialog.FileDialog.show(FileDialog.java:74)
	at jadx.gui.ui.MainWindow.openFileOrProject(MainWindow.java:295)
	at jadx.gui.ui.MainWindow.processCommandLineArgs(MainWindow.java:252)
	at jadx.gui.ui.MainWindow.init(MainWindow.java:247)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
xxr0sscommented, Aug 11, 2022

@jpstotz @skylot I’ve debugged FileDialog and it turned out to be a bug in javax.swing.JFileChooser.

Here’s the quick fix: Add -Djava.util.Arrays.useLegacyMergeSort=true to JVM_OPTS

0reactions
xxr0sscommented, Aug 13, 2022

@jpstotz Oh! I just stopped getting the exception after I removed all special folders (Documents, Pictures …) from Quick Access.

And I went to C:\Users\<UserName> and added them all (Documents, Pictures…) back to Quick Access, I debugged again and the special and non-special Documents both exist and the code here was executed, however, the exception does not show up any more.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java error: Comparison method violates its general contract
sort has been replaced. The new sort implementation may throw an IllegalArgumentException if it detects a Comparable that violates the Comparable contract. The ......
Read more >
Comparison method violates its general contract ... - JFrog
How to fix “IllegalArgumentException: Comparison method violates its general contract!” when indexing a Gems Repository. Loren Yeung 2022-04-27 ...
Read more >
Comparison method violates its general contract!
Something about the object you are passing to the compare() method is incorrect, most commonly it may be returning a bad value like...
Read more >
Odd error! "Comparison method violates its general contract!"
Hello everyone, I got this very strange error on products of Sentinel 3 'Comparison method violates its general contract!'.
Read more >
"Comparison method violates its general contract!" error when ...
This Technote specifically relates to the scenario where the cause is a limitation of Controller, caused by default settings of Oracle JAVA.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found