mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-08 11:33:29 +00:00
Issue #1189 Sort imports to have same order always
This commit is contained in:
@@ -54,6 +54,7 @@ import java.io.Serializable;
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -264,6 +265,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
}
|
||||
|
||||
boolean hasImport = false;
|
||||
Collections.sort(imports);
|
||||
for (DottedChain imp : imports) {
|
||||
if (imp.size() > 1) { //No imports from root package
|
||||
writer.appendNoHilight("import " + imp.toPrintableString(true) + ";").newLine();
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.List;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DottedChain implements Serializable {
|
||||
public class DottedChain implements Serializable, Comparable<DottedChain> {
|
||||
|
||||
public static final DottedChain EMPTY = new DottedChain(true);
|
||||
|
||||
@@ -278,4 +278,9 @@ public class DottedChain implements Serializable {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(DottedChain o) {
|
||||
return toRawString().compareTo(o.toRawString());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user