anonym -> lambda

master
Anna.Kozlova 8 years ago
parent 52b31bf325
commit ffd54ff4f4
  1. 35
      src/org/jetbrains/java/decompiler/code/InstructionSequence.java
  2. 12
      src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java
  3. 6
      src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java
  4. 7
      test/org/jetbrains/java/decompiler/SingleClassesTest.java

@ -186,34 +186,31 @@ public int getOffset(int index) {
public void sortHandlers(final StructContext context) {
Collections.sort(exceptionTable.getHandlers(), new Comparator<ExceptionHandler>() {
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;
}
});
}

@ -133,14 +133,12 @@ public class ImportCollector {
private List<String> packImports() {
List<Entry<String, String>> lst = new ArrayList<Entry<String, String>>(mapSimpleNames.entrySet());
Collections.sort(lst, new Comparator<Entry<String, String>>() {
public int compare(Entry<String, String> par0, Entry<String, String> 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<String> res = new ArrayList<String>();

@ -191,11 +191,7 @@ public class DomHelper {
lstPosts.add(stt.id);
}
Collections.sort(lstPosts, new Comparator<Integer>() {
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));

@ -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);
}

Loading…
Cancel
Save