Taken from RxJava throwIfFatal, which was taken from scala
332245
public static void propagateIfFatal(Throwable t) {
    if (t instanceof VirtualMachineError) {
      throw (VirtualMachineError) t;
    } else if (t instanceof ThreadDeath) {
      throw (ThreadDeath) t;
    } else if (t instanceof LinkageError) {
      throw (LinkageError) t;
    }
  }
1125353
@Incubating
    public static <T> T argLambdaThrowing(ThrowingPredicate<T> throwingLambda) {
        return argLambda(throwingLambda.uncheck(), "Inline lambda expression - add description in code to get more detailed error message");
    }
719403
def wrapply(func, *args, **kwargs):
    ''
    val = args[0]
    if val is None:
        return TypedWrapper(func, None)
    elif isinstance(val, TypedExceptionWrapper):
        tew = copy(val)
        tew.forwarded = True
        return tew
    elif isinstance(val, TypedWrapper):
        return val
    elif isinstance(val, Exception):
        return TypedWrapper(func, *args)

    try:
        return func(*args, **kwargs)
    except Exception as e:
        e.stacktrace = stacktrace()
        return TypedExceptionWrapper(func, *args, exception=e)
1295519
public static void convert(Task task, Function<Throwable, RuntimeException> function) {
        try {
            task.run();
        } catch (Throwable e) {
            throw function.apply(e);
        }
    }
462008
function takeLast(count) {
    return function takeLastOperatorFunction(source) {
        if (count === 0) {
            return Object(_observable_empty__WEBPACK_IMPORTED_MODULE_3__["empty"])();
        }
        else {
            return source.lift(new TakeLastOperator(count));
        }
    };
}
1310912
public static <T, U extends T> CompletableFuture<T> toJava(Future<U> scalaFuture) {
		final CompletableFuture<T> result = new CompletableFuture<>();

		scalaFuture.onComplete(new OnComplete<U>() {
			@Override
			public void onComplete(Throwable failure, U success) {
				if (failure != null) {
					result.completeExceptionally(failure);
				} else {
					result.complete(success);
				}
			}
		}, Executors.directExecutionContext());

		return result;
	}
1243933
public static RuntimeException wrapRuntime(Throwable throwable) {
		if (throwable instanceof RuntimeException) {
			return (RuntimeException) throwable;
		}
		if (throwable instanceof Error) {
			throw (Error) throwable;
		}
		return new RuntimeException(throwable);
	}
1081391
public void throwValue(Local<? extends Throwable> toThrow) {
        addInstruction(new ThrowingInsn(Rops.THROW, sourcePosition,
                RegisterSpecList.make(toThrow.spec()), catches));
    }
1248371
public static <T> Func1<T, Observable<Object>> toEmpty() {
        return Functions.constant(Observable.<Object> empty());
    }
840751
function race() {
    var observables = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        observables[_i] = arguments[_i];
    }
    if (observables.length === 1) {
        if (Object(_util_isArray__WEBPACK_IMPORTED_MODULE_1__["isArray"])(observables[0])) {
            observables = observables[0];
        }
        else {
            return observables[0];
        }
    }
    return Object(_fromArray__WEBPACK_IMPORTED_MODULE_2__["fromArray"])(observables, undefined).lift(new RaceOperator());
}
1025929
private static String takeJavaCore() throws Throwable {
    logger.entry("takeJavaCore");

    String filePath;
    try {
      javaDumpMethod.invoke(null);

      File javacoreFile = getLatestJavacoreFile();
      filePath = javacoreFile.getAbsolutePath();

    } catch (final InvocationTargetException invocationException) {
      // Unpack invocation target exception and throw to outer catch block.
      throw (invocationException.getTargetException() == null) ? invocationException : invocationException.getTargetException();
    }
    logger.exit("takeJavaCore", (Object) filePath);

    return filePath;
  }
849003
function mergeMapTo(innerObservable, resultSelector, concurrent) {
    if (concurrent === void 0) {
        concurrent = Number.POSITIVE_INFINITY;
    }
    if (typeof resultSelector === 'function') {
        return Object(_mergeMap__WEBPACK_IMPORTED_MODULE_0__["mergeMap"])(function () { return innerObservable; }, resultSelector, concurrent);
    }
    if (typeof resultSelector === 'number') {
        concurrent = resultSelector;
    }
    return Object(_mergeMap__WEBPACK_IMPORTED_MODULE_0__["mergeMap"])(function () { return innerObservable; }, concurrent);
}
547850
public static <T> T throww(Throwable t) {
		if (isDebugMode()) {
			t.printStackTrace();
		}
		if (t instanceof RuntimeException) {
			throw (RuntimeException) t;
		}
		throw new JKException(t);
	}
1280975
@SuppressWarnings("unchecked")
	public static RTObject jTokenToRuntimeObject(Object token) throws Exception {
		if (token instanceof Integer || token instanceof Float) {
			return AbstractValue.create(token);
		}

		if (token instanceof String) {
			String str = (String) token;
			// String value
			char firstChar = str.charAt(0);
			if (firstChar == '^')
				return new StringValue(str.substring(1));
			else if (firstChar == '\n' && str.length() == 1)
				return new StringValue("\n");

			// Glue
			if ("<>".equals(str))
				return new Glue();

			for (int i = 0; i < controlCommandNames.length; ++i) {
				// Control commands (would looking up in a hash set be faster?)
				String cmdName = controlCommandNames[i];
				if (str.equals(cmdName)) {
					return new ControlCommand(CommandType.values()[i + 1]);
				}

			}

			// Native functions
			// "^" conflicts with the way to identify strings, so now
			// we know it's not a string, we can convert back to the proper
			// symbol for the operator.
			if ("L^".equals(str))
				str = "^";
			if (NativeFunctionCall.callExistsWithName(str))
				return NativeFunctionCall.callWithName(str);

			// Pop
			if ("->->".equals(str))
				return ControlCommand.popTunnel();
			else if ("~ret".equals(str))
				return ControlCommand.popFunction();

			// Void
			if ("void".equals(str))
				return new Void();

		}

		if (token instanceof HashMap<?, ?>) {
			HashMap<String, Object> obj = (HashMap<String, Object>) token;

			Object propValue;

			// Divert target value to path
			propValue = obj.get("^->");

			if (propValue != null) {
				return new DivertTargetValue(new Path((String) propValue));
			}

			// VariablePointerValue
			propValue = obj.get("^var");
			if (propValue != null) {
				VariablePointerValue varPtr = new VariablePointerValue((String) propValue);

				propValue = obj.get("ci");

				if (propValue != null)
					varPtr.setContextIndex((Integer) propValue);

				return varPtr;
			}

			// Divert
			boolean isDivert = false;
			boolean pushesToStack = false;
			PushPopType divPushType = PushPopType.Function;
			boolean external = false;

			propValue = obj.get("->");
			if (propValue != null) {
				isDivert = true;
			} else {
				propValue = obj.get("f()");
				if (propValue != null) {
					isDivert = true;
					pushesToStack = true;
					divPushType = PushPopType.Function;
				} else {
					propValue = obj.get("->t->");
					if (propValue != null) {
						isDivert = true;
						pushesToStack = true;
						divPushType = PushPopType.Tunnel;
					} else {
						propValue = obj.get("x()");
						if (propValue != null) {
							isDivert = true;
							external = true;
							pushesToStack = false;
							divPushType = PushPopType.Function;
						}

					}
				}
			}

			if (isDivert) {
				Divert divert = new Divert();
				divert.setPushesToStack(pushesToStack);
				divert.setStackPushType(divPushType);
				divert.setExternal(external);
				String target = propValue.toString();

				propValue = obj.get("var");
				if (propValue != null) {
					divert.setVariableDivertName(target);
				} else {
					divert.setTargetPathString(target);
				}

				propValue = obj.get("c");
				divert.setConditional(propValue != null);

				if (external) {
					propValue = obj.get("exArgs");
					if (propValue != null) {
						divert.setExternalArgs((Integer) propValue);
					}

				}

				return divert;
			}

			// Choice
			propValue = obj.get("*");
			if (propValue != null) {
				ChoicePoint choice = new ChoicePoint();
				choice.setPathStringOnChoice(propValue.toString());
				propValue = obj.get("flg");

				if (propValue != null) {
					choice.setFlags((Integer) propValue);
				}

				return choice;
			}

			// Variable reference
			propValue = obj.get("VAR?");
			if (propValue != null) {
				return new VariableReference(propValue.toString());
			} else {
				propValue = obj.get("CNT?");
				if (propValue != null) {
					VariableReference readCountVarRef = new VariableReference();
					readCountVarRef.setPathStringForCount(propValue.toString());
					return readCountVarRef;
				}

			}
			// Variable assignment
			boolean isVarAss = false;
			boolean isGlobalVar = false;

			propValue = obj.get("VAR=");
			if (propValue != null) {
				isVarAss = true;
				isGlobalVar = true;
			} else {
				propValue = obj.get("temp=");
				if (propValue != null) {
					isVarAss = true;
					isGlobalVar = false;
				}

			}
			if (isVarAss) {
				String varName = propValue.toString();
				propValue = obj.get("re");
				boolean isNewDecl = propValue == null;

				VariableAssignment varAss = new VariableAssignment(varName, isNewDecl);
				varAss.setIsGlobal(isGlobalVar);
				return varAss;
			}

			// Tag
			propValue = obj.get("#");
			if (propValue != null) {
				return new Tag((String) propValue);
			}

			// List value
			propValue = obj.get("list");

			if (propValue != null) {
				HashMap<String, Object> listContent = (HashMap<String, Object>) propValue;
				InkList rawList = new InkList();

				propValue = obj.get("origins");

				if (propValue != null) {
					List<String> namesAsObjs = (List<String>) propValue;

					rawList.setInitialOriginNames(namesAsObjs);
				}

				for (Entry<String, Object> nameToVal : listContent.entrySet()) {
					InkListItem item = new InkListItem(nameToVal.getKey());
					int val = (int) nameToVal.getValue();
					rawList.put(item, val);
				}

				return new ListValue(rawList);
			}

			// Used when serialising save state only
			if (obj.get("originalChoicePath") != null)
				return jObjectToChoice(obj);

		}

		// Array is always a Runtime.Container
		if (token instanceof List<?>) {
			return jArrayToContainer((List<Object>) token);
		}

		if (token == null)
			return null;

		throw new Exception("Failed to convert token to runtime RTObject: " + token);
	}
647212
function (def, classpath, member) {
        var res;
        if (typeUtils.isFunction(def)) {
            // should already be normalized:
            return __simpleFunctionDefinition;
        } else if (typeUtils.isString(def)) {
            res = {
                $type : def
            };
        } else if (typeUtils.isArray(def)) {
            return __simpleArrayDefinition;
        } else if (typeUtils.isObject(def)) {
            res = def;
        } else {
            return null;
        }
        var memberType = res.$type;
        if (!__acceptedMemberTypes[memberType]) {
            // the error is logged later
            return null;
        }
        if (!(require("./JsonValidator")).normalize({
            json : res,
            beanName : "aria.core.CfgBeans.ItfMember" + memberType + "Cfg"
        })) {
            return null;
        }
        return res;
    }
782411
function(identifier, typemap, args, error) {
		var bufArray = [ new Buffer([ module.exports.EnumExecutionCode.ExecFunction ]) ];
		bufArray.push(new Buffer(4)); // [1] = reserverd for total payload size, minus the execution code
		
		var buf = new Buffer(4);
		buf.writeUInt32LE(identifier.length);
		bufArray.push(buf);
		
		var tempBuf = new Buffer(identifier);
		bufArray.push(tempBuf);
		
		var payloadLength = 4 + identifier.length;
		for(var i = 0; i < args.length; i++) {
			var iStr = i.toString();
			var argtype = typemap[iStr];
			
			if(!argtype) {
				if(args[i] === null) {
					argtype = 'null';
				}
				else {
					switch(typeof args[i]) {
						case 'number':
							if(args[i] === (args[i]|0)) {
								argtype = 'int'; // Default to int for normal numbers
							}
							else {
								argtype = 'float'; // float for anything else
							}
							break;
						case 'string':
							argtype = 'string';
							break;
						case 'boolean':
							argtype = 'boolean';
							break;
						case 'undefined':
							argtype = 'undefined';
							break;
					}
				}
				typemap[iStr] = argtype;
			}
			
			var dataType = module.exports.EnumDataType[argtype];
			if(dataType !== undefined) {
				switch(dataType) {
					case module.exports.EnumDataType.byte:
						tempBuf = new Buffer(1);
						tempBuf.writeInt8(args[i], 0);
						break;
					case module.exports.EnumDataType.ubyte:
						tempBuf = new Buffer(1);
						tempBuf.writeUInt8(args[i], 0);
						break;
					case module.exports.EnumDataType.short:
						tempBuf = new Buffer(2);
						tempBuf.writeInt16LE(args[i], 0);
						break;
					case module.exports.EnumDataType.ushort:
						tempBuf = new Buffer(2);
						tempBuf.writeUInt16LE(args[i], 0);
						break;
					case module.exports.EnumDataType.int:
						tempBuf = new Buffer(4);
						tempBuf.writeInt32LE(args[i], 0);
						break;
					case module.exports.EnumDataType.uint:
						tempBuf = new Buffer(4);
						tempBuf.writeUInt32LE(args[i], 0);
						break;
					case module.exports.EnumDataType.float:
						tempBuf = new Buffer(4);
						tempBuf.writeFloatLE(args[i], 0);
						break;
					case module.exports.EnumDataType.double:
						tempBuf = new Buffer(8);
						tempBuf.writeDoubleLE(args[i], 0);
						break;
					case module.exports.EnumDataType.string:
						tempBuf = new Buffer(args[i]);
						break;
					case module.exports.EnumDataType.boolean:
						tempBuf = new Buffer(1);
						tempBuf.writeUInt8(args[i] ? 0x1 : 0x0, 0);
						break;
					case module.exports.EnumDataType.undefined:
					case module.exports.EnumDataType.null:
						tempBuf = new Buffer(0);
						break;
					default:
						error(new Error('Data type ' + dataType + ' has gone unhandled by client'));
						return;
				}
				var argHeader = new Buffer(5);
				argHeader.writeUInt8(dataType, 0);
				argHeader.writeUInt32LE(tempBuf.length, 1);
				bufArray.push(argHeader);
				bufArray.push(tempBuf);
				
				payloadLength += argHeader.length + tempBuf.length;
			}
			else {
				error(new Error('Unsupported data type argument passed to remote function'));
				return;
			}
		}
		
		bufArray[1].writeUInt32LE(payloadLength);
		
		return Buffer.concat(bufArray);
	}
749517
public static <T, R, E extends Exception> List<R> map(final T[] a, final int fromIndex, final int toIndex,
            final Try.Function<? super T, ? extends R, E> func) throws E {
        checkFromToIndex(fromIndex, toIndex, len(a));
        N.checkArgNotNull(func);

        if (N.isNullOrEmpty(a)) {
            return new ArrayList<>();
        }

        final List<R> result = new ArrayList<>(toIndex - fromIndex);

        for (int i = fromIndex; i < toIndex; i++) {
            result.add(func.apply(a[i]));
        }

        return result;
    }