TODO: refactor this method
334048
public static List<StackTraceElement> getTraceTillPackage(String packageName) {
        StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
        // skip all elements until proxied call
        int startIndex = 0;
        for (int i = 1; i < stackTraceElements.length; i++) {
            StackTraceElement traceElement = stackTraceElements[i];
            String traceElementClassName = traceElement.getClassName();
            if (!traceElementClassName.startsWith(packageName) &&
                    !traceElementClassName.startsWith("java") &&
                    !traceElementClassName.startsWith("com.sun") &&
                    !traceElementClassName.startsWith("sun") &&
                    !"io.sniffy.Sniffy".equals(traceElementClassName) &&
                    !"io.sniffy.socket.SnifferSocketImpl".equals(traceElementClassName) &&
                    !"io.sniffy.socket.SnifferInputStream".equals(traceElementClassName) &&
                    !"io.sniffy.socket.SnifferOutputStream".equals(traceElementClassName) &&
                    !"io.sniffy.util.StackTraceExtractor".equals(traceElementClassName)
                    ) {
                startIndex = i > 1 ? i - 1 : i;
                break;
            }
            // go back until non java.io. trace
        }
        if (startIndex <= 0) {
            // no proxy, return entire collection
            return Arrays.asList(stackTraceElements);
        } else {
            return Arrays.asList(Arrays.copyOfRange(stackTraceElements, startIndex, stackTraceElements.length - 1));
        }
    }
431696
function(method){
            method = this.string(method);
            if(methods.indexOf(method.toLowerCase()) < 0){
                throw new TypeError('a method in [' + methods.join(', ') + '] is expected, but ' + method + ' given');
            }
            return method.toLowerCase();
        }
494744
protected void processReturnTypeOfMethodDeclaration( MethodDeclaration methodDeclaration,
                                                         MethodMetadata methodMetadata ) {
        Type type = methodDeclaration.getReturnType2();
        if (type.isPrimitiveType()) {
            methodMetadata.setReturnType(FieldMetadata.primitiveType(((PrimitiveType)type).getPrimitiveTypeCode().toString()));
        }
        if (type.isSimpleType()) {
            methodMetadata.setReturnType(FieldMetadata.simpleType(JavaMetadataUtil.getName(((SimpleType)type).getName())));
        }
    }
122484
function (method) {
            if (this.subviews.length !== 0) {
                var params = slice.call(arguments);
                params.shift();
                _.each(this.subviews, function (s) {
                    if (s[method]) {
                        s[method].apply(s, params);
                    }
                });
            }
        }
950258
public function methodChanged(): void
    {
        assert($this->offsetExists(self::VAR_LINE_METHOD));

        if (self::METHOD_POST === $this->offsetGet(self::VAR_LINE_METHOD)) {
            $this->offsetSet(self::VAR_BODY, null);
            if ($this->offsetExists(self::VAR_PARSED_POST)
                && is_null($this->offsetGet(self::VAR_PARSED_POST))) {
                $this->offsetSet(self::VAR_PARSED_POST, new MutableArray());
            }
            if ($this->offsetExists(self::VAR_PARSED_FILES)
                && is_null($this->offsetGet(self::VAR_PARSED_FILES))) {
                $this->offsetSet(self::VAR_PARSED_FILES, new MutableArray());
            }
        } else if (self::METHOD_PUT === $this->offsetGet(self::VAR_LINE_METHOD)) {
            if ($this->offsetExists(self::VAR_BODY)
                && is_null($this->offsetGet(self::VAR_BODY))) {
                $this->offsetSet(self::VAR_BODY, '');
            }
            $this->offsetSet(self::VAR_PARSED_POST, null);
            $this->offsetSet(self::VAR_PARSED_FILES, null);
        } else {
            $this->offsetSet(self::VAR_BODY, null);
            $this->offsetSet(self::VAR_PARSED_POST, null);
            $this->offsetSet(self::VAR_PARSED_FILES, null);
        }
    }
796967
@Override
    public void visitMethod(Method obj) {
        state = State.SAW_NOTHING;
        iConst0Looped.clear();
        stack.resetForMethodEntry(this);
    }
769089
function(methodName) {
                    var origMethod = that[methodName],
                        ret;

                    that[methodName] = function() {
                        args = _simplifyArray(Array.prototype.slice.call(arguments, 0));
                        ret = origMethod.apply(that, arguments);
           
                        that._trace({
                            method: methodName,
                            args: args
                        });
                 
                        return ret;
                    };
            }
505741
function self_method(data, methods) {
            if (!data) {
                return data;
            }

            var i, ii, prop;

            if (data.constructor === ({}).constructor) {
                for (prop in data) {
                    if (_.isUndefined(data[prop])) {
                        delete data[prop];
                        continue;
                    }

                    data[prop] = self_method(data[prop], methods);
                }
            }
            else if (_.isArray(data)) {
                for (i = 0, ii = data.length; i < ii; ++i) {
                    if (_.isUndefined(data[i])) {
                        --i; --ii;
                        continue;
                    }

                    data[i] = self_method(data[i], methods);
                }
            }
            else {

                methods = _.extend({}, methods, { __getData: null });

                _.each(methods, function(params, method) {

                    if (!_.isFunction(data[method])) {
                        return;
                    }

                    if (_.isNull(params) || _.isUndefined(params)) {
                        params = [];
                    }
                    if (!_.isArray(params)) {
                        params = [params];
                    }

                    data = data[method].apply(data, params);
                });
            }

            return data;
        }
542770
def refactor_create_inline(self, offset, only_this):
        """"""
        refactor = create_inline(self.project, self.resource, offset)
        if only_this:
            return self._get_changes(refactor, remove=False, only_current=True)
        else:
            return self._get_changes(refactor, remove=True, only_current=False)
953745
private List<Object> reprocessFormParams(Method method, List<Object> origParams, Message m) {
        Form form = null;
        boolean hasFormParamAnnotations = false;
        Object[] newValues = new Object[origParams.size()];
        java.lang.reflect.Parameter[] methodParams = method.getParameters();
        for (int i = 0; i < methodParams.length; i++) {
            if (Form.class.equals(methodParams[i].getType())) {
                form = (Form) origParams.get(i);
            }
            if (methodParams[i].getAnnotation(FormParam.class) != null) {
                hasFormParamAnnotations = true;
            } else {
                newValues[i] = origParams.get(i);
            }
        }

        if (!hasFormParamAnnotations || form == null) {
            return origParams;
        }

        for (int i = 0; i < newValues.length; i++) {
            if (newValues[i] == null) {
                String formFieldName = methodParams[i].getAnnotation(FormParam.class).value();
                List<String> values = form.asMap().get(formFieldName);
                newValues[i] = InjectionUtils.createParameterObject(values, 
                                                                    methodParams[i].getType(),
                                                                    methodParams[i].getParameterizedType(),
                                                                    methodParams[i].getAnnotations(),
                                                                    (String) origParams.get(i),
                                                                    false,
                                                                    ParameterType.FORM,
                                                                    m);
                if (LOG.isLoggable(Level.FINEST)) {
                    LOG.log(Level.FINEST, "replacing @FormParam value of {0} with {1}",
                        new Object[]{origParams.get(i), newValues[i]});
                }
            }
        }
        return Arrays.asList(newValues);
    }
1032257
public void detail(MethodNode methodNode, MethodAttributes attrs, StringBuilder output) {
        Validate.notNull(methodNode);
        Validate.notNull(attrs);
        Validate.notNull(output);

        int methodId = attrs.getSignature().getMethodId();

        output.append("Class Name: ").append(attrs.getSignature().getClassName().replace('/', '.')).append('\n');
        output.append("Method Name: ").append(attrs.getSignature().getMethodName()).append('\n');
        output.append("Method Params: ").append(attrs.getSignature().getMethodDescriptor()).append('\n');
        output.append("Method Return: ").append(attrs.getSignature().getReturnType()).append('\n');
        output.append("Method ID: ").append(methodId).append('\n');
        output.append("------------------------------------\n");

        UnmodifiableList<ContinuationPoint> cps = attrs.getContinuationPoints();
        for (int i = 0; i < cps.size(); i++) {
            ContinuationPoint cp = cps.get(i);

            int line = cp.getLineNumber() == null ? -1 : cp.getLineNumber();
            String header = String.format("Continuation Point ID: %-4d Line: %-4d Type: %s",
                    i,
                    line,
                    cp.getClass().getSimpleName());
            output.append(header).append('\n');

            // Check out PackStateGenerators class for how things are organized. Brief overview follows...
            // container[0] has local variables that are bytes/shorts/ints
            // container[1] has local variables that are floats
            // container[2] has local variables that are longs
            // container[3] has local variables that are doubles
            // container[4] has local variables that are Objects
            // container[5] has operands that are bytes/shorts/ints
            // container[6] has operands that are floats
            // container[7] has operands that are longs
            // container[8] has operands that are doubles
            // container[9] has operands that are Objects
            detailLocals(cp, methodNode, output);
            detailOperands(cp, output);

            output.append('\n');
        }
        
        output.append('\n');
    }
829229
@Override
  public String method()
  {
    if (_methodString == null) {
      CharSegment cb = getMethodBuffer();
      if (cb.length() == 0) {
        _methodString = "GET";
        return _methodString;
      }

      switch (cb.charAt(0)) {
      case 'G':
        _methodString = cb.equals(_getCb) ? "GET" : cb.toString();
        break;

      case 'H':
        _methodString = cb.equals(_headCb) ? "HEAD" : cb.toString();
        break;

      case 'P':
        _methodString = cb.equals(_postCb) ? "POST" : cb.toString();
        break;

      default:
        _methodString = cb.toString();
      }
    }

    return _methodString;
  }
104132
private ImmutableList<MethodDeclaration> generateStateMethodsForSoyElementClass(
      String soyElementClassName, TemplateStateVar stateVar) {
    JsType jsType = JsType.forIncrementalDomState(stateVar.type());
    String stateAccessorSuffix =
        Ascii.toUpperCase(stateVar.name().substring(0, 1)) + stateVar.name().substring(1);
    Expression stateValue = id("this").dotAccess(STATE_PREFIX + stateVar.name());
    MethodDeclaration getStateMethod =
        MethodDeclaration.create(
            "get" + stateAccessorSuffix,
            JsDoc.builder().addParameterizedAnnotation("return", jsType.typeExpr()).build(),
            Statement.returnValue(stateValue));

    jsType = JsType.forIncrementalDomState(stateVar.type());
    ImmutableList.Builder<Statement> setStateMethodStatements = ImmutableList.builder();
    Optional<Expression> typeAssertion =
        jsType.getSoyTypeAssertion(
            id(stateVar.name()), stateVar.name(), templateTranslationContext.codeGenerator());
    if (typeAssertion.isPresent()) {
      setStateMethodStatements.add(typeAssertion.get().asStatement());
    }
    setStateMethodStatements.add(
        stateValue.assign(id(stateVar.name())).asStatement(), Statement.returnValue(id("this")));
    MethodDeclaration setStateMethod =
        MethodDeclaration.create(
            "set" + stateAccessorSuffix,
            JsDoc.builder()
                .addParam(stateVar.name(), jsType.typeExpr())
                .addParameterizedAnnotation("return", "!" + soyElementClassName)
                .build(),
            Statement.of(setStateMethodStatements.build()));
    return ImmutableList.of(getStateMethod, setStateMethod);
  }
837116
function() {
    var key = Array.prototype.shift.call(arguments);
    if (typeof Modifiers[key] != 'function') return Modifiers.error.call(this, {reason: 'no method', val: key});
    var ob = arguments[0];
    if (Modifiers.mappers[key] instanceof Array && (ob == null || (typeof ob != 'object') || (ob.constructor != Object))) {
      var context = {};
      Array.prototype.forEach.call(arguments, function(v, k) {
        var arg = Modifiers.mappers[key][k];
        if (arg) context[arg] = v;
      });
      return Modifiers[key].bind(context);
    }

    return Modifiers[key].bind(arguments[0] || {});
  }
587520
@Override
    public void visitMethod(Method obj) {
        stack.resetForMethodEntry(this);
        enumRegs.clear();
        super.visitMethod(obj);
    }
467083
@Override
    public void visitMethod(Method obj) {
        if (!obj.isAbstract())
            return;

        String methodName = obj.getName();
        String methodSig = obj.getSignature();
        outer: for (JavaClass cls : superClasses) {
            Method[] methods = cls.getMethods();
            for (Method m : methods) {
                if (m.isPrivate() || m.isAbstract())
                    continue;
                if (methodName.equals(m.getName()) && methodSig.equals(m.getSignature())) {
                    BugInstance bug = new BugInstance(this, BugType.AOM_ABSTRACT_OVERRIDDEN_METHOD.name(), NORMAL_PRIORITY).addClass(this).addMethod(this);

                    Code code = obj.getCode();
                    if (code != null)
                        bug.addSourceLineRange(clsContext, this, 0, code.getLength() - 1);
                    bugReporter.reportBug(bug);

                    break outer;
                }
            }
        }
    }
784620
function () {
        return function () {
          var args = Array.prototype.slice.call(arguments, 0);
          var sig = (function () {
            var ret = [];
            for (var i = 0, len = args.length; i < len; i++) {
              ret.push(toType(args[i]));
            }
            return ret;
          })().join('::');

          if (map[sig]) {
            if (map[sig].inject) args.unshift(input);
            return map[sig].fn.apply(ctx || null, args);
          }

          return input && input.apply(ctx || null, args);
        }
      }