This is a temporary static method, when there are more factory
        methods, we can move this to another class or find a way to maintain
        it in a scalable manner
541065
def handle_other_factory_method(attr, minimum, maximum):
        
        if attr == 'percentage':
            if minimum:
                minimum = ast.literal_eval(minimum)
            else:
                minimum = 0
            if maximum:
                maximum = ast.literal_eval(maximum)
            else:
                maximum = 100
            val = random.uniform(minimum, maximum)
            return val
        
        # If `attr` isn't specified above, we need to raise an error
        raise ValueError('`%s` isn\'t a valid factory method.' % attr)
750279
public Datatype.Builder clearNestedClasses() {
    if (nestedClasses instanceof ImmutableList) {
      nestedClasses = ImmutableList.of();
    } else {
      nestedClasses.clear();
    }
    return (Datatype.Builder) this;
  }
385380
function protectStaticMethod(name, meta, constructor) {
        constructor[cacheKeyword].methods[name] = meta.implementation;

        if (meta.isPrivate) {
            Object.defineProperty(constructor, name, {
                get: function get() {
                    var method = constructor[cacheKeyword].methods[name],
                        currCaller;

                    currCaller = process._dejavu.caller;

                    if (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && meta.allowed === currCaller.constructorId) {
                        return method;
                    }

                    throw new Error('Cannot access private static method "' + name + '" of class "' + constructor.prototype.$name + '".');
                },
                set: function set(newVal) {
                    if (!constructor[$class].locked || constructor[$class].forceUnlocked) {
                        constructor[cacheKeyword].methods[name] = newVal;
                    } else {
                        throw new Error('Cannot set private static method "' + name + '" of class "' + constructor.prototype.$name + '".');
                    }
                },
                configurable: false,
                enumerable: true
            });
        } else if (meta.isProtected) {
            Object.defineProperty(constructor, name, {
                get: function get() {
                    var method = constructor[cacheKeyword].methods[name],
                        currCaller;

                    currCaller = process._dejavu.caller;

                    if (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && (contains(meta.allowed, currCaller.constructorId) || constructor.prototype instanceof currCaller.constructor)) {
                        return method;
                    }

                    throw new Error('Cannot access protected static method "' + name + '" of class "' + constructor.prototype.$name + '".');
                },
                set: function set(newVal) {
                    if (!constructor[$class].locked || constructor[$class].forceUnlocked) {
                        constructor[cacheKeyword].methods[name] = newVal;
                    } else {
                        throw new Error('Cannot set protected static method "' + name + '" of class "' + constructor.prototype.$name + '".');
                    }
                },
                configurable: false,
                enumerable: true
            });
        } else {
            Object.defineProperty(constructor, name, {
                get: function get() {
                    return constructor[cacheKeyword].methods[name];
                },
                set: function set(newVal) {
                    if (!constructor[$class].locked || constructor[$class].forceUnlocked) {
                        constructor[cacheKeyword].methods[name] = newVal;
                    } else {
                        throw new Error('Cannot set public static method "' + name + '" of class "' + constructor.prototype.$name + '".');
                    }
                },
                configurable: false,
                enumerable: true
            });
        }
    }
1255176
function(factory, time, options) {
			if(typeof options != "object") {
				options = {};
			}

			if(!options.minimumDigits) {
				options.minimumDigits = factory.minimumDigits;
			}

			this.base(options);
			this.factory = factory;

			if(time) {
				this.time = time;
			}
		}
1208515
static BshMethod staticMethodImport(Class<?> baseClass, String methodName) {
        Invocable method = BshClassManager.memberCache.get(baseClass)
                .findStaticMethod(methodName);
        if (null != method)
            return new BshMethod(method, null);
        return null;
    }
104278
@Override
    public final void afterPropertiesSet() throws Exception {
        if (this.getLocator() != null) {
            this.logger.warn(
                    "Static "
                            + this.getClass().getName()
                            + " reference has already been set and setInstance is being called");
        }
        this.setLocator(this);
    }
399373
public void addNewInstanceMethod(Method method) {
        final CachedMethod cachedMethod = CachedMethod.find(method);
        NewInstanceMetaMethod newMethod = new NewInstanceMetaMethod(cachedMethod);
        final CachedClass declaringClass = newMethod.getDeclaringClass();
        addNewInstanceMethodToIndex(newMethod, metaMethodIndex.getHeader(declaringClass.getTheClass()));
    }
692939
private void visitFrameAfterOnMethodEntry() {
        if (!visitFramesAfterCallbacks)
            return;

        // The frame that is required after the trace guard must be
        // fully specified as 'this' is no longer an 'uninitialized this'
        if (isConstructor()) {
            List<Object> stackLocals = new ArrayList<Object>(argTypes.length + 1);
            stackLocals.add(classAdapter.getClassType().getInternalName());
            for (Type type : argTypes) {
                switch (type.getSort()) {
                    case Type.ARRAY:
                    case Type.OBJECT:
                        stackLocals.add(type.getInternalName());
                        break;
                    case Type.BOOLEAN:
                    case Type.CHAR:
                    case Type.BYTE:
                    case Type.SHORT:
                    case Type.INT:
                        stackLocals.add(INTEGER);
                        break;
                    case Type.LONG:
                        stackLocals.add(LONG);
                        break;
                    case Type.FLOAT:
                        stackLocals.add(FLOAT);
                        break;
                    case Type.DOUBLE:
                        stackLocals.add(DOUBLE);
                        break;
                }
            }
            visitFrame(F_FULL, stackLocals.size(), stackLocals.toArray(), 0, new Object[] {});
            visitInsn(NOP);
        } else {
            visitFrame(F_SAME, 0, null, 0, null);
            visitInsn(NOP);
        }
    }
695395
protected T createInstance() {
        try {
            Constructor<T> ctor = clazz.getDeclaredConstructor();
            ctor.setAccessible(true);
            return ctor.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (SecurityException e) {
            throw new RuntimeException(e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        } catch (IllegalArgumentException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }
    }
716853
public void addNewStaticMethod(Method method) {
        final CachedMethod cachedMethod = CachedMethod.find(method);
        NewStaticMetaMethod newMethod = new NewStaticMetaMethod(cachedMethod);
        final CachedClass declaringClass = newMethod.getDeclaringClass();
        addNewStaticMethodToIndex(newMethod, metaMethodIndex.getHeader(declaringClass.getTheClass()));
    }
688749
@Override
    public void constructorFactory(Sink sink, String dataTypeName, String factoryName, List<String> typeParametrs, Constructor constructor) {
        if (constructor.args.isEmpty()) {
        	if (typeParametrs.isEmpty()) {
            	logger.finest("Generating no args, no types factory for " + constructor.name);
        	} else {
            	logger.finest("Generating no args, type arguments factory for " + constructor.name);
        		sink.write("   @SuppressWarnings(\"rawtypes\")\n");
        	}
            sink.write("   private static final " + dataTypeName + " _" + factoryName + " = new " + constructor.name + "();\n");
            sink.write(ASTPrinter.printComments("   ", commentProcessor.leftAlign(commentProcessor.javaDocOnly(constructor.comments))));
        	if (!typeParametrs.isEmpty()) {
        		sink.write("   @SuppressWarnings(\"unchecked\")\n");
        	}
        	sink.write("   public static final ");
        	emitParameterizedTypeName(sink, typeParametrs);
        	sink.write(" ");
        	sink.write(dataTypeName);
        	emitParameterizedTypeName(sink, typeParametrs);
        	sink.write(" _" + factoryName + "() { return _" + factoryName + "; }");
        } else {
        	logger.finest("Generating args factory for " + constructor.name);
            sink.write(ASTPrinter.printComments("   ", commentProcessor.leftAlign(constructor.comments)));
            sink.write("   public static final ");
            emitParameterizedTypeName(sink, typeParametrs);
        	sink.write(" ");
        	sink.write(dataTypeName);
            emitParameterizedTypeName(sink, typeParametrs);
            sink.write(" _" + factoryName + "(");
            constructorArgs(sink, constructor, true);
            sink.write(") { return new " + constructor.name);
            emitParameterizedTypeName(sink, typeParametrs);
            sink.write("("); 
            constructorArgs(sink, constructor, false);
            sink.write("); }");            
        }
    }
20017
@Override
    public void visitCode(Code obj) {
        if (Values.CONSTRUCTOR.equals(methodName) || Values.STATIC_INITIALIZER.equals(methodName)) {
            return;
        }

        Method m = getMethod();
        if (m.isSynthetic()) {
            return;
        }

        if (!interfaceMethods.contains(new QMethod(methodName, m.getSignature()))) {
            super.visitCode(obj);
        }
    }
328514
protected void makeMethodDoc(MethodSymbol meth, TreePath treePath) {
        MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
        if (result != null) {
            if (treePath != null) result.setTreePath(treePath);
        } else {
            result = new MethodDocImpl(this, meth, treePath);
            methodMap.put(meth, result);
        }
    }
307151
static Method checkTimeMethod(Method timeMethod) throws InvalidBenchmarkException {
    checkArgument(isTimeMethod(timeMethod));
    Class<?>[] parameterTypes = timeMethod.getParameterTypes();
    if (!Arrays.equals(parameterTypes, new Class<?>[] {int.class})
        && !Arrays.equals(parameterTypes, new Class<?>[] {long.class})) {
      throw new InvalidBenchmarkException(
          "Microbenchmark methods must accept a single int parameter: " + timeMethod.getName());
    }

    // Static technically doesn't hurt anything, but it's just the completely wrong idea
    if (Util.isStatic(timeMethod)) {
      throw new InvalidBenchmarkException(
          "Microbenchmark methods must not be static: " + timeMethod.getName());
    }
    return timeMethod;
  }
341778
def add_field_factory(name, type, options = {}, &block)
      stored, more_like_this = options[:stored], options[:more_like_this]
      field_factory = FieldFactory::Static.new(name, type, options, &block)
      @field_factories[field_factory.signature] = field_factory
      @field_factories_cache[field_factory.name] = field_factory
      if stored
        @stored_field_factories_cache[field_factory.name] << field_factory
      end
      if more_like_this
        @more_like_this_field_factories_cache[field_factory.name] << field_factory
      end
    end
1351782
def static_method(cls, f):
        """"""
        setattr(cls, f.__name__, staticmethod(f))
        return f
224512
private static void removeMethodByName(Method method, List<Method> methods) {
    if(methods != null) {
      Iterator<Method> itr = methods.iterator();
      Method aMethod = null;
      while(itr.hasNext()) {
        aMethod = itr.next();
        if(aMethod.getName().equals(method.getName())) {
          itr.remove();
          break;
        }
      }
      if(aMethod != null) {
        methods.add(aMethod);
      }
    }
  }