diff --git a/src/org/jetbrains/java/decompiler/code/InstructionSequence.java b/src/org/jetbrains/java/decompiler/code/InstructionSequence.java index bce3b60..cde9284 100644 --- a/src/org/jetbrains/java/decompiler/code/InstructionSequence.java +++ b/src/org/jetbrains/java/decompiler/code/InstructionSequence.java @@ -186,34 +186,31 @@ public int getOffset(int index) { public void sortHandlers(final StructContext context) { - Collections.sort(exceptionTable.getHandlers(), new Comparator() { + Collections.sort(exceptionTable.getHandlers(), (handler0, handler1) -> { - public int compare(ExceptionHandler handler0, ExceptionHandler handler1) { - - if (handler0.to == handler1.to) { - if (handler0.exceptionClass == null) { - return 1; + if (handler0.to == handler1.to) { + if (handler0.exceptionClass == null) { + return 1; + } + else { + if (handler1.exceptionClass == null) { + return -1; + } + else if (handler0.exceptionClass.equals(handler1.exceptionClass)) { + return (handler0.from > handler1.from) ? -1 : 1; // invalid code } else { - if (handler1.exceptionClass == null) { + if (Util.instanceOf(context, handler0.exceptionClass, handler1.exceptionClass)) { return -1; } - else if (handler0.exceptionClass.equals(handler1.exceptionClass)) { - return (handler0.from > handler1.from) ? -1 : 1; // invalid code - } else { - if (Util.instanceOf(context, handler0.exceptionClass, handler1.exceptionClass)) { - return -1; - } - else { - return 1; - } + return 1; } } } - else { - return (handler0.to > handler1.to) ? 1 : -1; - } + } + else { + return (handler0.to > handler1.to) ? 1 : -1; } }); } diff --git a/src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java b/src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java index ada6abc..48f8db8 100644 --- a/src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java +++ b/src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java @@ -133,14 +133,12 @@ public class ImportCollector { private List packImports() { List> lst = new ArrayList>(mapSimpleNames.entrySet()); - Collections.sort(lst, new Comparator>() { - public int compare(Entry par0, Entry par1) { - int res = par0.getValue().compareTo(par1.getValue()); - if (res == 0) { - res = par0.getKey().compareTo(par1.getKey()); - } - return res; + Collections.sort(lst, (par0, par1) -> { + int res = par0.getValue().compareTo(par1.getValue()); + if (res == 0) { + res = par0.getKey().compareTo(par1.getKey()); } + return res; }); List res = new ArrayList(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java index c93be38..00eea78 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java @@ -191,11 +191,7 @@ public class DomHelper { lstPosts.add(stt.id); } - Collections.sort(lstPosts, new Comparator() { - public int compare(Integer o1, Integer o2) { - return mapSortOrder.get(o1).compareTo(mapSortOrder.get(o2)); - } - }); + Collections.sort(lstPosts, (o1, o2) -> mapSortOrder.get(o1).compareTo(mapSortOrder.get(o2))); if (lstPosts.size() > 1 && lstPosts.get(0).intValue() == st.id) { lstPosts.add(lstPosts.remove(0)); diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index 3d14216..f20ae55 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -124,11 +124,8 @@ public class SingleClassesTest { File parent = classFile.getParentFile(); if (parent != null) { final String pattern = classFile.getName().replace(".class", "") + "\\$.+\\.class"; - File[] inner = parent.listFiles(new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - return name.matches(pattern); - } + File[] inner = parent.listFiles((dir, name) -> { + return name.matches(pattern); }); if (inner != null) Collections.addAll(files, inner); }