reflection utils
777800
private List<Field> allFields(final Class<?> c) {
        List<Field> l = this.fieldsCache.get(c);
        if (l == null) {
            l = new LinkedList<Field>();
            final Field[] fields = c.getDeclaredFields();
            addAll(l, fields);
            Class<?> sc = c;
            while (((sc = sc.getSuperclass()) != Object.class) && (sc != null)) {
                addAll(l, sc.getDeclaredFields());
            }
            this.fieldsCache.putIfAbsent(c, l);
        }
        return l;
    }
1354091
def method_missing(sym, *args, &block)
      type = sym.to_s
      if type.start_with?('_') && args.empty? && block.nil?
        constant = Object.const_get(type[1..-1])
        type(constant)
      else
        super
      end
    end
1246039
def inspect
      expr = @expr || @unit.expr
      expr = (expr) ? ","+expr.inspect : ""
      sufx = (@@verbose_inspect) ? " "+@unit.inspect : ""
      self.class.to_s+"["+Unit::Utils.num_inspect(@value)+expr+"]"+sufx
    end
411296
function getFlattenedDeps(getter, existing) {
  if (!existing) {
    existing = Immutable.Set()
  }

  const toAdd = Immutable.Set().withMutations(set => {
    if (!isGetter(getter)) {
      throw new Error('getFlattenedDeps must be passed a Getter')
    }

    getDeps(getter).forEach(dep => {
      if (isKeyPath(dep)) {
        set.add(List(dep))
      } else if (isGetter(dep)) {
        set.union(getFlattenedDeps(dep))
      } else {
        throw new Error('Invalid getter, each dependency must be a KeyPath or Getter')
      }
    })
  })

  return existing.union(toAdd)
}
438480
function define (File, utils) {
  const { debug, error, strong } = utils.cnsl;

  return class COFFEESCRIPTFile extends File {
    /**
     * Compile file contents
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Array} ignoredFiles
     *  - {Boolean} helpers
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     * @returns {null}
     */
    compile (buildOptions, fn) {
      try {
        const options = Object.assign({ sourceMap: this.hasMaps }, DEFAULT_OPTIONS, this.options.pluginOptions.coffeescript || {});
        const results = coffee.compile(this.content, options);
        let content, map;

        if ('string' != typeof results) {
          content = results.js;
          map = results.v3SourceMap;
        } else {
          content = results;
        }

        this.setContent(content);
        if (map) this.setMap(map);
        debug(`compile: ${strong(this.relpath)}`, 4);
      } catch (err) {
        if (!this.options.runtimeOptions.watch) return fn(err);
        error(err, 4, false);
      }
      fn();
    }
  };
}
1347487
function $$(instance, Clazz, ctor, args) {
                args = ria.__API.clone(args);
                var clazz = args[0],
                    specs = args[1];

                if (clazz instanceof ria.__API.ClassDescriptor)
                    clazz = clazz.ctor;

                if (clazz instanceof ria.__API.Class) {
                    var instance = clazz;
                    clazz = instance.getClass();
                    // TODO; fetch specs from instance
                }

                if (ria.__API.isSpecification(clazz)) {
                    var specify = clazz;
                    clazz = specify.type;
                    specs = specify.specs;
                }

                if (!ria.__API.isClassConstructor(clazz))
                    throw new ria.reflection.Exception('ReflectionFactory works only on CLASS');

                args.splice(0, 1, clazz, specs);

                var name = ria.__API.getIdentifierOfType(ria.__API.specify(clazz, specs)) + '@' + clazz.__REF_ID;
                if (cache.hasOwnProperty(name))
                    return cache[name];

                return cache[name] = new ria.__API.init(instance, Clazz, ctor, args);
            }
1228078
function $$(instance, Clazz, ctor, args) {
                args = ria.__API.clone(args);
                var clazz = args[0],
                    methodName = args[1],
                    specs = args[2];

                if (!ria.__API.isClassConstructor(clazz))
                    throw new ria.reflection.Exception('ReflectionFactory works only on CLASS');

                var name = ria.__API.getIdentifierOfType(ria.__API.specify(clazz, specs)) + '@' + clazz.__REF_ID + '#' + methodName;
                if (cache.hasOwnProperty(name))
                    return cache[name];

                return cache[name] = new ria.__API.init(instance, Clazz, ctor, args);
            }
18262
private AssumptionSet generateFunctionOrMethodAssumptionSet(WyilFile.Decl.FunctionOrMethod declaration,
			LocalEnvironment environment) {
		Tuple<WyilFile.Decl.Variable> parameters = declaration.getParameters();
		Expr[] preconditions = new Expr[declaration.getRequires().size()];
		Expr[] arguments = new Expr[parameters.size()];
		// Translate parameters as arguments to invocation
		for (int i = 0; i != arguments.length; ++i) {
			WyilFile.Decl.Variable var = parameters.get(i);
			WyalFile.VariableDeclaration versionedVar = environment.read(var);
			arguments[i] = new Expr.VariableAccess(versionedVar);
		}
		//
		for (int i = 0; i != preconditions.length; ++i) {
			WyalFile.Name name = convert(declaration.getQualifiedName(), "_requires_" + i, declaration.getName());
			preconditions[i] = new Expr.Invoke(null, name, null, arguments);
		}
		// Add all the preconditions as assupmtions
		return AssumptionSet.ROOT.add(preconditions);
	}
1354348
@GwtIncompatible("incompatible method")
    private void reflectionAppend(
        final Object lhs,
        final Object rhs,
        final Class<?> clazz) {

        if (isRegistered(lhs, rhs)) {
            return;
        }

        try {
            register(lhs, rhs);
            final Field[] fields = clazz.getDeclaredFields();
            AccessibleObject.setAccessible(fields, true);
            for (int i = 0; i < fields.length && isEquals; i++) {
                final Field f = fields[i];
                if (!ArrayUtils.contains(excludeFields, f.getName())
                    && !f.getName().contains("$")
                    && (testTransients || !Modifier.isTransient(f.getModifiers()))
                    && !Modifier.isStatic(f.getModifiers())
                    && !f.isAnnotationPresent(EqualsExclude.class)) {
                    try {
                        append(f.get(lhs), f.get(rhs));
                    } catch (final IllegalAccessException e) {
                        //this can't happen. Would get a Security exception instead
                        //throw a runtime exception in case the impossible happens.
                        throw new InternalError("Unexpected IllegalAccessException");
                    }
                }
            }
        } finally {
            unregister(lhs, rhs);
        }
    }
488341
def reflection_for(path, for_join_table_only = false)
      @join_table_joins << path if for_join_table_only and !reflections[path]
      reflections[path] ||= map_reflection_for( path )
    end
1149293
static <T> Object[] arguments(final Class<T> klass, final T instance,
                                  final Class<?>[] types,
                                  final String[] literals)
            throws ReflectiveOperationException {
        final Object[] arguments = new Object[literals.length];
        for (int i = 0; i < literals.length; i++) {
            if ("null".equals(literals[i])) {
                arguments[i] = null;
                continue;
            }
            if (literals[i].startsWith(":")) {
                final String name = literals[i].substring(1);
                final Field field = field(klass, name);
                if (!field.isAccessible()) {
                    field.setAccessible(true);
                }
                arguments[i] = field.get(instance);
                continue;
            }
            if (types[i] == String.class) {
                arguments[i] = literals[i];
                continue;
            }
            if (types[i].isPrimitive()) {
                types[i] = wrapper(types[i]);
            }
            arguments[i] = types[i]
                    .getMethod("valueOf", String.class)
                    .invoke(null, literals[i]);
        }
        return arguments;
    }
619361
protected function getReflectionInfos()
    {
        try {
            $this->constructMethod = new \ReflectionMethod($this->className, "__construct");
            $params = $this->constructMethod->getParameters();
            $i = 0;
            foreach ($params as $param) {
                $paramsInfos = ['name' => $param->getName()];
                // Either the class is typehinted
                if (!empty($param->getClass())) {
                    $paramsInfos['class'] = $param->getClass()->getName();
                } elseif (!empty($this->propertyTypes[$param->getName()])) {
                    // Or we take it from the argument name
                    $paramsInfos['class'] = $this->propertyTypes[$param->getName()];
                }
                $this->requiredParams[$i++] = $paramsInfos;
            }
        } catch (\ReflectionException $e) {
            // There is no construct method but we don't really care
        }
    }
1319476
def utils(self):
        
        if self._utils is None:
            from .tcex_utils import TcExUtils

            self._utils = TcExUtils(self)
        return self._utils
80391
@Override
	public void doTag() throws JspException, IOException
	{
		JspContext context = getJspContext();
		Object component = getComponent(context);
		Reflector<?> reflector = getReflector(context);
		
		try
		{
			reflect(reflector, component, context.getOut());
		}
		catch (ReflectorException exception)
		{
			throw new JspTagException("Error writing component", exception);
		}
	}
692251
private static void unwrapArgs(final Class<?>[] types, final Object[] args) {
        if (args == null) {
            return;
        }
        try {
            for (int i = 0; i < args.length; ++i) {
                args[i] = ReflectionHelper.unwrap(types[i], args[i]);
            }
        } catch (Exception e) {
            throw new IllegalArgumentException(e);
        }

    }
270720
function () {
	          var _this = this;
	          var args = [];
	          for (var _i = 0; _i < arguments.length; _i++) {
	              args[_i - 0] = arguments[_i];
	          }
	          var instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars);
	          _classStmt.fields.forEach(function (field) { _this[field.name] = undefined; });
	          _executeFunctionStatements(ctorParamNames, args, _classStmt.constructorMethod.body, instanceCtx, _visitor);
	      }
110203
public function getUtils(): Utils
    {
        if ($this->_utils === null) {
            $this->_utils = new Utils($this->getSystemService());
        }

        return $this->_utils;
    }