anonym -> lambda

This commit is contained in:
Anna.Kozlova
2016-05-18 11:57:04 +02:00
parent 52b31bf325
commit ffd54ff4f4
4 changed files with 29 additions and 41 deletions

View File

@@ -186,35 +186,32 @@ 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;
}
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 (Util.instanceOf(context, handler0.exceptionClass, handler1.exceptionClass)) {
return -1;
}
else {
return 1;
}
}
}
if (handler0.to == handler1.to) {
if (handler0.exceptionClass == null) {
return 1;
}
else {
return (handler0.to > handler1.to) ? 1 : -1;
if (handler1.exceptionClass == null) {
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;
}
}
}
}
else {
return (handler0.to > handler1.to) ? 1 : -1;
}
});
}