package-private for testability
173271
@SuppressWarnings("squid:S2259") // Null pointers should not be dereferenced
  void setCellValue(Cell cell, Object value) {
    if (value instanceof Boolean) {
      cell.setCellValue(toBoolean(value));
    } else if (value instanceof LocalDate) {
      Instant instant = toLocalDate(value).atStartOfDay(timeZone.toZoneId()).toInstant();
      cell.setCellValue(simpleDateFormat.format(Date.from(instant)));
    } else if (value instanceof Instant) {
      cell.setCellValue(simpleDateTimeFormat.format(Date.from((Instant) value)));
    } else if (value instanceof Double) {
      cell.setCellValue(toDouble(value));
    } else if (value instanceof Integer) {
      cell.setCellValue(toInt(value));
    } else if (value instanceof Long) {
      cell.setCellValue(toLong(value));
    } else if (value instanceof String) {
      cell.setCellValue(value.toString());
    } else {
      throw new UnsupportedValueException(value);
    }
  }
1096080
public static void illegalStateIf(boolean tester, String msg, Object... args) {
        if (tester) {
            throw new IllegalStateException(S.fmt(msg, args));
        }
    }
11960
private void checkStrictParamType(
      final TemplateNode node, final TemplateParam param, @Nullable SoyValueProvider paramValue) {
    Kind kind = param.type().getKind();
    if (kind == Kind.ANY || kind == Kind.UNKNOWN) {
      // Nothing to check.  ANY and UKNOWN match all types.
      return;
    }
    if (paramValue == null) {
      paramValue = NullData.INSTANCE;
    } else if (paramValue instanceof SoyAbstractCachingValueProvider) {
      SoyAbstractCachingValueProvider typedValue = (SoyAbstractCachingValueProvider) paramValue;
      if (!typedValue.isComputed()) {
        // in order to preserve laziness we tell the value provider to assert the type when
        // computation is triggered
        typedValue.addValueAssertion(
            new ValueAssertion() {
              @Override
              public void check(SoyValue value) {
                checkValueType(param, value, node);
              }
            });
        return;
      }
    } else if (param.hasDefault() && paramValue.resolve() instanceof UndefinedData) {
      // Default parameters are undefined if they're unset.
      return;
    }
    checkValueType(param, paramValue.resolve(), node);
  }
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);
	}
957064
public static void assertAccessibility(URL url, Testable testable) {
        assertThat(url, is(compliantTo(testable)));
    }
855716
function assertPublicBundleOptions(bo: mixed): PublicBundleOptions {
  invariant(
    typeof bo === 'object' && bo != null,
    'bundle options must be an object',
  );
  invariant(
    // eslint-disable-next-line lint/strictly-null
    bo.dev === undefined || typeof bo.dev === 'boolean',
    'bundle options field `dev` must be a boolean',
  );
  const {entryFile} = bo;
  invariant(
    typeof entryFile === 'string',
    'bundle options must contain a string field `entryFile`',
  );
  invariant(
    // eslint-disable-next-line lint/strictly-null
    bo.inlineSourceMap === undefined || typeof bo.inlineSourceMap === 'boolean',
    'bundle options field `inlineSourceMap` must be a boolean',
  );
  invariant(
    // eslint-disable-next-line lint/strictly-null
    bo.minify === undefined || typeof bo.minify === 'boolean',
    'bundle options field `minify` must be a boolean',
  );
  invariant(
    // eslint-disable-next-line lint/strictly-null
    bo.platform === undefined || typeof bo.platform === 'string',
    'bundle options field `platform` must be a string',
  );
  invariant(
    // eslint-disable-next-line lint/strictly-null
    bo.runModule === undefined || typeof bo.runModule === 'boolean',
    'bundle options field `runModule` must be a boolean',
  );
  invariant(
    // eslint-disable-next-line lint/strictly-null
    bo.sourceMapUrl === undefined || typeof bo.sourceMapUrl === 'string',
    'bundle options field `sourceMapUrl` must be a boolean',
  );
  return {entryFile, ...bo};
}
920364
private static boolean javaTimeTypes(ExpressionTree tree, VisitorState state) {
    if (packageStartsWith("java.time").matches(tree, state)) {
      return false;
    }
    Symbol symbol = ASTHelpers.getSymbol(tree);
    if (symbol instanceof MethodSymbol) {
      MethodSymbol methodSymbol = (MethodSymbol) symbol;
      if (methodSymbol.owner.packge().getQualifiedName().toString().startsWith("java.time")
          && methodSymbol.getModifiers().contains(Modifier.PUBLIC)) {
        if (ALLOWED_JAVA_TIME_METHODS.matches(tree, state)) {
          return false;
        }
        return true;
      }
    }
    return false;
  }
706052
private static Class checkClass(ProtoFile protoFile, Type type, Map<String, String> mappedUniName,
            boolean isUniName) {
        String packageName = protoFile.getPackageName();
        String defaultClsName = type.getName();
        // to check if has "java_package" option and "java_outer_classname"
        List<Option> options = protoFile.getOptions();
        if (options != null) {
            for (Option option : options) {
                if (option.getName().equals(JAVA_PACKAGE_OPTION)) {
                    packageName = option.getValue().toString();
                } else if (option.getName().equals(JAVA_OUTER_CLASSNAME_OPTION)) {
                    defaultClsName = option.getValue().toString();
                }
            }
        }

        String simpleName = getProxyClassName(defaultClsName, mappedUniName, isUniName);
        String className = packageName + PACKAGE_SPLIT_CHAR + simpleName;

        Class<?> c = null;
        try {
            c = Class.forName(className);
        } catch (ClassNotFoundException e1) {
            // if class not found so should generate a new java source class.
            c = null;
        }

        return c;
    }
112322
void check_type() throws DevFailed
	{
		boolean unsuported = true;
		if (type == Tango_DEV_SHORT)
			unsuported = false;
		else if (type == Tango_DEV_USHORT)
			unsuported = false;
		else if (type == Tango_DEV_LONG)
			unsuported = false;
		else if (type == Tango_DEV_LONG64)
			unsuported = false;
		else if (type == Tango_DEV_ULONG)
			unsuported = false;
		else if (type == Tango_DEV_ULONG64)
			unsuported = false;
		else if (type == Tango_DEV_BOOLEAN)
			unsuported = false;
		else if (type == Tango_DEV_FLOAT)
			unsuported = false;
		else if (type == Tango_DEV_DOUBLE)
			unsuported = false;
		else if (type == Tango_DEV_STRING)
			unsuported = false;
		else if (type == Tango_DEV_STATE)
			unsuported = false;
		else if (type == Tango_DEV_ENCODED)
			unsuported = false;

		if (unsuported == true)
		{
			Util.out3.println("Attr.check_type throwing exception");
		
			StringBuffer o = new StringBuffer("Attribute : ");
			o.append(name).append(": Data type is not supported");
			Except.throw_exception("API_AttrWrongDefined",
				    o.toString(),
					"Attr.check_type");
		}
	}
367775
private boolean hasExpandableVarArgs(IMockMethod method, List<Object> args) {
    List<Class<?>> paramTypes = method.getParameterTypes();
    return !paramTypes.isEmpty()
        && CollectionUtil.getLastElement(paramTypes).isArray()
        && CollectionUtil.getLastElement(args) != null;
  }
107506
@Override
    public R visitCompilationUnit(CompilationUnitTree node, P p) {
        R r = scan(node.getPackage(), p);
        r = scanAndReduce(node.getImports(), p, r);
        r = scanAndReduce(node.getTypeDecls(), p, r);
        return r;
    }
1039684
@Override
	public List<GigJavaProblem> validate(TypeDeclaration declaration,
			IType type, CompilationUnit unit, String file)
			throws JavaModelException {
		List<GigJavaProblem> problems = new ArrayList<GigJavaProblem>();
		int flags = type.getFlags();
		
		if (!Flags.isAbstract(flags)) {
			if (!Flags.isPublic(flags)) {
				GigJavaProblem problem = new GigJavaProblem(
						Severity.ERROR, "Concrete Component class must be public", file);
				ISourceRange range = type.getNameRange();
				int offset = range.getOffset();
				problem.setSourceStart(offset);
				problem.setSourceEnd(offset + range.getLength() - 1);
				problem.setSourceLineNumber(unit.getLineNumber(offset));
				problems.add(problem);
				return problems;
			}
		}
		
		return problems;
	}
1066020
private static ImmutableSet<Symbol> lookup(
      Symbol.TypeSymbol typeSym,
      Symbol.TypeSymbol start,
      Name identifier,
      Types types,
      Symbol.PackageSymbol pkg) {
    if (typeSym == null) {
      return ImmutableSet.of();
    }

    ImmutableSet.Builder<Symbol> members = ImmutableSet.builder();

    members.addAll(lookup(types.supertype(typeSym.type).tsym, start, identifier, types, pkg));

    for (Type i : types.interfaces(typeSym.type)) {
      members.addAll(lookup(i.tsym, start, identifier, types, pkg));
    }

    OUTER:
    for (Symbol member : typeSym.members().getSymbolsByName(identifier)) {
      if (!member.isStatic()) {
        continue;
      }
      switch ((int) (member.flags() & Flags.AccessFlags)) {
        case Flags.PRIVATE:
          continue OUTER;
        case 0:
        case Flags.PROTECTED:
          if (member.packge() != pkg) {
            continue OUTER;
          }
          break;
        case Flags.PUBLIC:
        default:
          break;
      }
      if (member.isMemberOf(start, types)) {
        members.add(member);
      }
    }

    return members.build();
  }
288606
private final void checkInvariants() throws Error {

        if (_lineBreak == null) {
            throw new Error("_lineBreak == null");
        } else if (_lineBreak == LineBreak.NONE && _indentation.length() > 0) {
            throw new Error("_lineBreak == LineBreak.NONE && _indentation = \"" + _indentation + "\".");
        } else if (_elementStack == null) {
            throw new Error("_elementStack (" + _elementStack + " == null");
        } else if (_elementStackSize < 0) {
            throw new Error("_elementStackSize (" + _elementStackSize + ") < 0");
        }
    }
255596
private boolean checkSupertypes(Class<?> cls) {
    for(Class<?> c : knownParameterizables) {
      if(c.isAssignableFrom(cls)) {
        return true;
      }
    }
    return false;
  }
599836
private boolean checkPathAndPackage(Path dir, JCTree pkgName) {
        Iterator<String> pathIter = new ParentIterator(dir);
        Iterator<String> pkgIter = new EnclosingPkgIterator(pkgName);
        while (pathIter.hasNext() && pkgIter.hasNext()) {
            if (!pathIter.next().equals(pkgIter.next()))
                return false;
        }
        return !pkgIter.hasNext(); /*&& !pathIter.hasNext() See JDK-8059598 */
    }
875053
private static Class checkClass(String packageName, TypeElement type, Map<String, String> mappedUniName,
            boolean isUniName) {
        String simpleName = getProxyClassName(type.name(), mappedUniName, isUniName);
        String className = packageName + PACKAGE_SPLIT_CHAR + simpleName;

        Class<?> c = null;
        try {
            c = Class.forName(className);
        } catch (ClassNotFoundException e1) {
            // if class not found so should generate a new java source class.
            c = null;
        }

        return c;
    }