restricted methods
338482
@Override
  long[] getCache() {
    final int curCount = getRetainedEntries(true);
    if (curCount > 0) {
      final long[] cache = new long[curCount];
      final int preLongs = getCurrentPreambleLongs(true);
      mem_.getLongArray(preLongs << 3, cache, 0, curCount);
      return cache;
    }
    return new long[0];
  }
210429
def hide_methods(mod, except_defaults, *stuff)
      options = stuff.last.is_a?(Hash) ? stuff.pop : {}
      include_ancestors  = options.fetch(:ancestors){false}
      except             = Array(options.fetch(:except){except_defaults})
      protect            = Array(options[:protect])
      except_methods     = collect_methods(true, *except)
      protect_methods    = collect_methods(true, *protect)
      methods_to_hide    = collect_methods(include_ancestors, *stuff)
      (methods_to_hide - except_methods).each do |method_name|
        mod.module_eval do 
          next unless method_defined?(method_name)
          if protect_methods.include?(method_name)
            protected method_name
          else
            private method_name
          end
        end
      end
    end
1116391
private static void setMethodAccessible(Method method) {
        try {
            //
            // XXX Default access superclass workaround
            //
            // When a public class has a default access superclass
            // with public methods, these methods are accessible.
            // Calling them from compiled code works fine.
            //
            // Unfortunately, using reflection to invoke these methods
            // seems to (wrongly) to prevent access even when the method
            // modifer is public.
            //
            // The following workaround solves the problem but will only
            // work from sufficiently privilages code.
            //
            // Better workarounds would be greatfully accepted.
            //
            if (!method.isAccessible()) {
                method.setAccessible(true);
            }

        } catch (SecurityException se) {
            // log but continue just in case the method.invoke works anyway
            // Log log = LogFactory.getLog(MethodUtils.class);
            if (!loggedAccessibleWarning) {
                boolean vulnerableJVM = false;
                try {
                    String specVersion = System.getProperty("java.specification.version");
                    if (specVersion.charAt(0) == '1' &&
                            (specVersion.charAt(2) == '0' ||
                             specVersion.charAt(2) == '1' ||
                             specVersion.charAt(2) == '2' ||
                             specVersion.charAt(2) == '3')) {

                        vulnerableJVM = true;
                    }
                } catch (SecurityException e) {
                    // don't know - so display warning
                    vulnerableJVM = true;
                }
                if (vulnerableJVM) {
                    log.warn(
                        "Current Security Manager restricts use of workarounds for reflection bugs "
                        + " in pre-1.4 JVMs.");
                }
                loggedAccessibleWarning = true;
            }
            log.debug("Cannot setAccessible on method. Therefore cannot use jvm access bug workaround.", se);
        }
    }
1264053
private Object doPrivileged(final String methodName, final Object[] params) {
        try{
            return invokeMethod(context, methodName, params);
        }catch(Throwable t){
            throw new RuntimeException(t.getMessage(), t);
        }
    }
1330281
@SuppressWarnings({"unchecked"})
    private static <T> Class<T> bruteForceDefineClass(Method method, ClassLoader loader, Object... args)
            throws InvocationTargetException, IllegalAccessException {

        LOCK.lock();
        try {
            assert !method.isAccessible() : "This method shouldn't be left accessible, something is wrong!";
            method.setAccessible(true);
            Class<T> cls = (Class<T>) method.invoke(loader, args);
            method.setAccessible(false);
            return cls;
        } finally {
            LOCK.unlock();
        }
    }
510562
private void setRestrictedAttributes(Map<String, String> attributes) {

        // Translate disabled attribute
        getModel().setDisabled("true".equals(attributes.get(DISABLED_ATTRIBUTE_NAME)));

    }
632563
function permittedAttributes() {
        let filteredKeys = ghostBookshelf.Model.prototype.permittedAttributes.apply(this, arguments);

        this.relationships.forEach((key) => {
            filteredKeys.push(key);
        });

        return filteredKeys;
    }
1249599
private static Set<String> excludedMethods(String... methodNames)
   {
      Set<String> set = new HashSet<String>(MpxjTreeNode.DEFAULT_EXCLUDED_METHODS);
      set.addAll(Arrays.asList(methodNames));
      return set;
   }
398962
private Collection<String> checkMethodNames(
            Collection<HttpMethodConstraintElement> methodConstraints) {
        Collection<String> methodNames = new HashSet<String>();
        for (HttpMethodConstraintElement methodConstraint :
                        methodConstraints) {
            String methodName = methodConstraint.getMethodName();
            if (!methodNames.add(methodName)) {
                throw new IllegalArgumentException(
                    "Duplicate HTTP method name: " + methodName);
            }
        }
        return methodNames;
    }
1349391
def restrict(d,restrict):
    '''
    
    '''
    notqs = ['t','xs','ys','zs','fd','sd']
    keys  = [k for k in d if k not in notqs];
    if len(restrict) == 2:
        for k in keys:
            d[k] = d[k][restrict[0]:restrict[1]]
    elif len(restrict) == 4:
        for k in keys:
            d[k] = d[k][
                restrict[0]:restrict[1],
                restrict[2]:restrict[3]
            ];
    elif len(restrict) == 6:
        for k in keys:
            d[k] = d[k][
                restrict[0]:restrict[1],
                restrict[2]:restrict[3],
                restrict[4]:restrict[5]
            ];
    else:
        raise ValueError("restrict of length {} is not valid".format(
            len(restrict)));
771378
function bypass(method, options) {
    // jscs:disable
    // jshint -W040
    const self = this;
    // jshint +W040
    // jscs:enable
    const shield = self.constructor.shield;

    if (!_.includes(shield.protectedMethods, method)) {
        return Promise.reject(new Error('no such protected method'));
    }
    const protectedMethod = `_${method}`;
    return shield[protectedMethod].call(self, options);
}
1293246
function ( obj, arg ) {
		arg = arg || 1;

		if ( arg < 1 ) {
			arg = 1;
		}

		return array.limit( obj, arg, obj.length );
	}
1019428
def restrict_to(self, restriction):
        
        if type(restriction) != list:
            restriction = [ restriction ]
        self._restriction = restriction
997025
def _iter_restrict(self, zeros, ones):
        """"""
        inputs = list(self.inputs)
        unmapped = dict()
        for i, v in enumerate(self.inputs):
            if v in zeros:
                inputs[i] = 0
            elif v in ones:
                inputs[i] = 1
            else:
                unmapped[v] = i
        vs = sorted(unmapped.keys())
        for num in range(1 << len(vs)):
            for v, val in boolfunc.num2point(num, vs).items():
                inputs[unmapped[v]] = val
            yield sum((val << i) for i, val in enumerate(inputs))
1123741
public function AllowedMethods()
    {
        $externalFunctions = parent::AllowedMethods();
        $externalFunctions[] = 'ShowShippingAddressInput';
        $externalFunctions[] = 'HideShippingAddressInput';

        $externalFunctions[] = 'UpdateUser';
        $externalFunctions[] = 'Register';
        $externalFunctions[] = 'UpdateUserAddress';
        $externalFunctions[] = 'Login';

        $externalFunctions[] = 'SelectBillingAddress';
        $externalFunctions[] = 'SelectShippingAddress';
        $externalFunctions[] = 'DeleteShippingAddress';

        return $externalFunctions;
    }
902207
private void handleWhereBlock(Method method) {
    Block block = method.getLastBlock();
    if (!(block instanceof WhereBlock)) return;

    new DeepBlockRewriter(this).visit(block);
    WhereBlockRewriter.rewrite((WhereBlock) block, this);
  }
101764
def method_missing(method, *args, &block)
      attribute = Ldaptic.encode(method)
      if attribute[-1] == ?=
        attribute.chop!
        if may_must(attribute)
          return write_attribute(attribute, *args, &block)
        end
      elsif attribute[-1] == ??
        attribute.chop!
        if may_must(attribute)
          if args.empty?
            return !read_attribute(attribute).empty?
          else
            return args.flatten.any? {|arg| compare(attribute, arg)}
          end
        end
      elsif attribute =~ /\A(.*)-before-type-cast\z/ && may_must($1)
        return read_attribute($1, *args, &block)
      elsif may_must(attribute)
        return read_attribute(attribute, *args, &block).one
      end
      super(method, *args, &block)
    end