CHECKSTYLE:OFF:RedundantThrows
183983
public static void requireArgValid(@NotNull final String name, @NotNull final String value) throws ConstraintViolationException {
        // CHECKSTYLE:ON
        final String trimmedValue = value.trim();
        Contract.requireArgNotEmpty(name, trimmedValue);
    }
409749
public static <T> T check(T value, T elseValue, boolean res) {
        return res ? value : elseValue;
    }
352993
public static <T> Comparator<T> comparator(CheckedComparator<T> comparator) {
        return Unchecked.comparator(comparator, Unchecked.RETHROW_ALL);
    }
535360
public static void requireValid(@NotNull final Validator validator, @NotNull final Object value, @Nullable final Class<?>... groups)
            throws ConstraintViolationException {
        // CHECKSTYLE:ON

        final Set<ConstraintViolation<Object>> constraintViolations = validator.validate(value);
        if (constraintViolations.size() > 0) {
            final StringBuffer sb = new StringBuffer();
            for (final ConstraintViolation<Object> constraintViolation : constraintViolations) {
                if (sb.length() > 0) {
                    sb.append(", ");
                }
                sb.append("[" + constraintViolation.getPropertyPath() + "] " + constraintViolation.getMessage() + " {"
                        + constraintViolation.getInvalidValue() + "}");
            }
            throw new ConstraintViolationException(sb.toString(), constraintViolations);
        }

    }
44353
public static void requireArgValid(@NotNull final String name, @NotNull final String value) throws ConstraintViolationException {
        // CHECKSTYLE:ON

        if (!isValid(value)) {
            throw new ConstraintViolationException(
                    "The argument '" + name + "' does not represent a valid hour range like '09:00-12:00+13:00-17:00': '" + value + "'");
        }

    }
1356243
function assertThrows(test) {
    var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Error;
    var contains = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];


    if (!Array.isArray(contains)) contains = [contains];

    var shouldErrorName = typeof error === 'string' ? error : error.name;

    var nonThrown = new Error('util.assertThrowsAsync(): Missing rejection' + (error ? ' with ' + error.name : ''));
    var ensureErrorMatches = function ensureErrorMatches(error) {
        // wrong type
        if (error.constructor.name != shouldErrorName) {
            return new Error('\n             util.assertThrowsAsync(): Wrong Error-type\n             - is    : ' + error.constructor.name + '\n             - should: ' + shouldErrorName + '\n             - error: ' + error.toString() + '\n             ');
        }
        // check if contains
        var errorString = error.toString();
        if (contains.length > 0 && (0, _utils.oneOfArrayNotInString)(contains, errorString)) {
            return new Error('\n               util.assertThrowsAsync(): Error does not contain\n               - should contain: ' + contains + '\n               - is string: ' + error.toString() + '\n             ');
        }
        return false;
    };

    return new Promise(function (res, rej) {
        var val = void 0;
        try {
            val = test();
        } catch (err) {
            var wrong = ensureErrorMatches(err);
            if (wrong) rej(wrong);else res(err);
            return;
        }
        if ((0, _isPromise2['default'])(val)) {
            val.then(function () {
                // has not thrown
                rej(nonThrown);
            })['catch'](function (err) {
                var wrong = ensureErrorMatches(err);
                if (wrong) rej(wrong);else res(err);
            });
        } else rej(nonThrown);
    });
}
152717
public static void parseArg(@NotNull final String name, @NotNull final String value) throws ConstraintViolationException {
        // CHECKSTYLE:ON
        final String trimmed = value.trim().toLowerCase();
        if (!isValid(trimmed)) {
            throw new ConstraintViolationException("The argument '" + name + "' is not valid: '" + trimmed + "'");
        }
    }
187356
private void analyzeIfNullBranch(BasicBlock basicBlock, InstructionHandle lastHandle) throws DataflowAnalysisException {

        Location location = new Location(lastHandle, basicBlock);

        IsNullValueFrame frame = invDataflow.getFactAtLocation(location);

        if (!frame.isValid()) {
            // This is probably dead code due to an infeasible exception edge.
            return;
        }

        IsNullValue top = frame.getTopValue();

        // Find the line number.
        int lineNumber = getLineNumber(method, lastHandle);
        if (lineNumber < 0) {
            return;
        }

        if (!(top.isDefinitelyNull() || top.isDefinitelyNotNull())) {
            if (DEBUG) {
                System.out.println("Line " + lineNumber + " undetermined");
            }
            undeterminedBranchSet.set(lineNumber);
            return;
        }

        // Figure out if the branch is always taken
        // or always not taken.
        short opcode = lastHandle.getInstruction().getOpcode();
        boolean definitelySame = top.isDefinitelyNull();
        if (opcode != Const.IFNULL) {
            definitelySame = !definitelySame;
        }

        if (definitelySame) {
            if (DEBUG) {
                System.out.println("Line " + lineNumber + " always same");
            }
            definitelySameBranchSet.set(lineNumber);
        } else {
            if (DEBUG) {
                System.out.println("Line " + lineNumber + " always different");
            }
            definitelyDifferentBranchSet.set(lineNumber);
        }

        RedundantBranch redundantBranch = new RedundantBranch(location, lineNumber, top);

        // Determine which control edge is made infeasible by the redundant
        // comparison
        boolean wantNull = (opcode == Const.IFNULL);
        int infeasibleEdgeType = (wantNull == top.isDefinitelyNull()) ? EdgeTypes.FALL_THROUGH_EDGE : EdgeTypes.IFCMP_EDGE;
        Edge infeasibleEdge = invDataflow.getCFG().getOutgoingEdgeWithType(basicBlock, infeasibleEdgeType);
        redundantBranch.setInfeasibleEdge(infeasibleEdge);

        if (DEBUG) {
            System.out.println("Adding redundant branch: " + redundantBranch);
        }
        redundantBranchList.add(redundantBranch);
    }
647550
@Override
  protected void onMethodExit(int opcode) {
    if ((withPreconditions || withPostconditions || withInvariants)
        && opcode != ATHROW) {
      if (withPostconditions || withInvariants) {
        Label skip = enterBusySection();

        if (withPostconditions) {
          Type returnType = Type.getReturnType(methodDesc);
          int returnIndex = -1;
          if (returnType.getSort() != Type.VOID) {
            if (returnType.getSize() == 2) {
              dup2();
            } else {
              dup();
            }
            returnIndex = newLocal(returnType);
            storeLocal(returnIndex);
          }
          invokeCommonPostconditions(ContractKind.POST, oldValueLocals,
                                     returnIndex);
        }

        if (withInvariants && !statik) {
          invokeInvariants();
        }

        leaveBusySection(skip);
      }
      leaveContractedMethod();
    }
  }
1087195
@Override public Object invokeMethod(final String name, final Object arguments) {
    if (GantState.dryRun) {
      if (GantState.verbosity > GantState.SILENT) {
        final StringBuilder sb = new StringBuilder();
        int padding = 9 - name.length();
        if (padding < 0) { padding = 0; }
        sb.append("         ".substring(0, padding) + '[' + name + "] ");
        final Object[] args = (Object[]) arguments;
        if (args[0] instanceof Map<?,?>) {
          //////////////////////////////////////////////////////////////////////////////////////////////////////////
          // Eclipse and IntelliJ IDEA warn that (Map) is not a proper cast but using the
          // cast (Map<?,?>) causes a type check error due to the capture algorithm.
          //
          //  TODO : Fix this rather than use a SuppressWarnings.
          //////////////////////////////////////////////////////////////////////////////////////////////////////////
          @SuppressWarnings({ "unchecked", "rawtypes" } ) final Iterator<Map.Entry<?,?>> i =((Map) args[0]).entrySet().iterator();
          while (i.hasNext()) {
            final Map.Entry<?,?> e = i.next();
            sb.append(e.getKey() + " : '" + e.getValue() + '\'');
            if (i.hasNext()) { sb.append(", "); }
          }
          sb.append('\n');
          getProject().log(sb.toString());
          if (args.length == 2) {((Closure<?>) args[1]).call(); }
        }
        else if (args[0] instanceof Closure) { ((Closure<?>) args[0]).call(); }
        else { throw new RuntimeException("Unexpected type of parameter to method " + name); }
      }
      return null;
    }
    return super.invokeMethod(name, arguments);
  }
1319794
Row<T>[] sortItems(final long threshold, final ErrorType errorType) {
    final ArrayList<Row<T>> rowList = new ArrayList<>();
    final ReversePurgeItemHashMap.Iterator<T> iter = hashMap.iterator();
    if (errorType == ErrorType.NO_FALSE_NEGATIVES) {
      while (iter.next()) {
        final long est = getEstimate(iter.getKey());
        final long ub = getUpperBound(iter.getKey());
        final long lb = getLowerBound(iter.getKey());
        if (ub >= threshold) {
          final Row<T> row = new Row<>(iter.getKey(), est, ub, lb);
          rowList.add(row);
        }
      }
    } else { //NO_FALSE_POSITIVES
      while (iter.next()) {
        final long est = getEstimate(iter.getKey());
        final long ub = getUpperBound(iter.getKey());
        final long lb = getLowerBound(iter.getKey());
        if (lb >= threshold) {
          final Row<T> row = new Row<>(iter.getKey(), est, ub, lb);
          rowList.add(row);
        }
      }
    }

    // descending order
    rowList.sort(new Comparator<Row<T>>() {
      @Override
      public int compare(final Row<T> r1, final Row<T> r2) {
        return r2.compareTo(r1);
      }
    });

    @SuppressWarnings("unchecked")
    final Row<T>[] rowsArr =
      rowList.toArray((Row<T>[]) Array.newInstance(Row.class, rowList.size()));
    return rowsArr;
  }
288775
void accessStaticUnchecked(CodeBuilder mv) {
    checkState(isStatic());
    mv.getStatic(owner().type(), FieldRef.this.name(), type());
  }
1320066
public void check(FieldDescriptorDef fieldDef, String checkLevel) throws ConstraintException
    {
        ensureColumn(fieldDef, checkLevel);
        ensureJdbcType(fieldDef, checkLevel);
        ensureConversion(fieldDef, checkLevel);
        ensureLength(fieldDef, checkLevel);
        ensurePrecisionAndScale(fieldDef, checkLevel);
        checkLocking(fieldDef, checkLevel);
        checkSequenceName(fieldDef, checkLevel);
        checkId(fieldDef, checkLevel);
        if (fieldDef.isAnonymous())
        {
            checkAnonymous(fieldDef, checkLevel);
        }
        else
        {
            checkReadonlyAccessForNativePKs(fieldDef, checkLevel);
        }
    }
1081391
public void throwValue(Local<? extends Throwable> toThrow) {
        addInstruction(new ThrowingInsn(Rops.THROW, sourcePosition,
                RegisterSpecList.make(toThrow.spec()), catches));
    }
1054977
function checkForIrregularLineTerminators(node) {
            const source = sourceCode.getText(),
                sourceLines = sourceCode.lines,
                linebreaks = source.match(LINE_BREAK);
            let lastLineIndex = -1,
                match;

            while ((match = IRREGULAR_LINE_TERMINATORS.exec(source)) !== null) {
                const lineIndex = linebreaks.indexOf(match[0], lastLineIndex + 1) || 0;
                const location = {
                    line: lineIndex + 1,
                    column: sourceLines[lineIndex].length
                };

                errors.push({ node, message: "Irregular whitespace not allowed.", loc: location });
                lastLineIndex = lineIndex;
            }
        }
81919
public static void requireArgNotEmpty(@NotNull final String name, final String value) throws ConstraintViolationException {
        // CHECKSTYLE:ON
        requireArgNotNull(name, value);
        if (value.length() < 1) {
            throw new ConstraintViolationException("The argument '" + name + "' cannot be empty");
        }
    }
1334494
private void checkAst(Node externs, Node root) {
    astValidator.validateCodeRoot(externs);
    astValidator.validateCodeRoot(root);
  }