Checks access of class, field or method.
351083
public boolean checkAccess(AccessFlags flags){

        boolean isPublic = flags.is(AccessFlags.ACC_PUBLIC);
        boolean isProtected = flags.is(AccessFlags.ACC_PROTECTED);
        boolean isPrivate = flags.is(AccessFlags.ACC_PRIVATE);
        boolean isPackage = !(isPublic || isProtected || isPrivate);

        if ((showAccess == AccessFlags.ACC_PUBLIC) && (isProtected || isPrivate || isPackage))
            return false;
        else if ((showAccess == AccessFlags.ACC_PROTECTED) && (isPrivate || isPackage))
            return false;
        else if ((showAccess == 0) && (isPrivate))
            return false;
        else
            return true;
    }
466771
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case TYPE_CLASS_NAME:
      return isSetTypeClassName();
    }
    throw new IllegalStateException();
  }
255596
private boolean checkSupertypes(Class<?> cls) {
    for(Class<?> c : knownParameterizables) {
      if(c.isAssignableFrom(cls)) {
        return true;
      }
    }
    return false;
  }
342939
private void checkDynamic(int accessor) throws JMFSchemaViolationException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.entry(this, tc, "checkDynamic", new Object[] { Integer.valueOf(accessor) });

        JSField field = getFieldDef(accessor, false);

        if (field instanceof JSDynamic) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                JmfTr.exit(this, tc, "checkDynamic");
            return;
        }

        JMFSchemaViolationException e = new JMFSchemaViolationException("Field type at accessor " + accessor + " is not Dynamic");
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.exit(this, tc, "checkDynamic", e);
        throw e;
    }
1017114
private void evaluateObject() {
        if (evaluatedClasses.contains(clazz)) {
            return;
        }

        Field[] fields = clazz.getDeclaredFields();

        for (Field field : fields) {
            if (field.isAnnotationPresent(ModelField.class)
            && !isAllowed(field)) {
                throw new RuntimeException("Field '"
                        + field.getName()
                        + "' has type '" + field.getType().getSimpleName()
                        + "' that is not allowed!");
            }
        }

        evaluatedClasses.add(clazz);
    }
476867
private static boolean tryToSetValueThroughField(OpenEngSBModelEntry entry, Object instance)
        throws IllegalAccessException {
        try {
            Field field = instance.getClass().getDeclaredField(entry.getKey());
            field.setAccessible(true);
            field.set(instance, entry.getValue());
            field.setAccessible(false);
            return true;
        } catch (NoSuchFieldException e) {
            // if no field with this name exist, try to use the corresponding setter
        } catch (SecurityException e) {
            // if a security manager is installed which don't allow this change of a field value, try
            // to use the corresponding setter
        }
        return false;
    }
538700
private void check(Class clazz) {

        final Constructor<?>[] constructors = clazz.getDeclaredConstructors();

        if (constructors.length > 1) {
            throw new AssertionError(clazz + " has more than one constructor");
        }

        final Constructor<?> constructor = constructors[0];

        constructor.setAccessible(true);

        if (!Modifier.isPrivate(constructor.getModifiers())) {
            throw new AssertionError("Constructor of " + clazz + " must be private");
        }

        final Class<?>[] parameterTypes = constructor.getParameterTypes();

        if (parameterTypes.length > 0) {
            if (expectedParameters == null) {
                throw new AssertionError(clazz + " has non-default constructor with some parameters");
            } else {
                if (!Arrays.equals(parameterTypes, expectedParameters)) {
                    throw new AssertionError("Expected constructor with parameters " + getReadableClassesOutput(expectedParameters) + " but found constructor with parameters " + getReadableClassesOutput(parameterTypes));
                } else {
                    return;
                }
            }
        }

        try {
            constructor.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException("Can not instantiate instance of " + clazz, e);
        } catch (IllegalAccessException e) {
            // Fixed by setAccessible(true)
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            final Throwable cause = e.getCause();

            // It's okay case if we expect some exception from this constructor
            if (expectedTypeOfException != null || expectedExceptionMessage != null) {
                if (expectedTypeOfException != null && !expectedTypeOfException.equals(cause.getClass())) {
                    throw new IllegalStateException("For " + clazz + " expected exception of type = " + expectedTypeOfException + ", but was exception of type = " + e.getCause().getClass());
                }

                if (expectedExceptionMessage != null && !expectedExceptionMessage.equals(cause.getMessage())) {
                    throw new IllegalStateException("For " + clazz + " expected exception message = '" + expectedExceptionMessage + "', but was = '" + cause.getMessage() + "'", e.getCause());
                }

                // Everything is okay
            } else {
                throw new IllegalStateException("For " + clazz + " no exception was expected", e);
            }
        } catch (IllegalArgumentException e) {
            throw new RuntimeException("Looks like constructor of " + clazz + " is not default", e);
        }
    }
667275
private boolean isNull(Field field, Object obj) {
    try {
      if (!field.isAccessible()) {
        field.setAccessible(true);
      }
      return field.get(obj) == null;
    } catch (Exception e) {
      e.printStackTrace();
    }

    return false;
  }
1187190
public void check(Declaration decl, AnnotationProcessorEnvironment env) {

        _locale = Locale.getDefault();

        if (decl instanceof TypeDeclaration) {

            //
            // Check method annotations
            //
            Collection<? extends MethodDeclaration> methods = ((TypeDeclaration) decl).getMethods();
            for (MethodDeclaration method : methods) {
                checkSQL(method, env);

            }
        } else if (decl instanceof FieldDeclaration) {

            //
            // NOOP
            //
        } else {

            //
            // NOOP
            //
        }
    }
1281366
private static Field findFieldOrThrowException(Class<?> fieldType, Class<?> where) {
        if (fieldType == null || where == null) {
            throw new IllegalArgumentException("fieldType and where cannot be null");
        }
        Field field = null;
        for (Field currentField : where.getDeclaredFields()) {
            currentField.setAccessible(true);
            if (currentField.getType().equals(fieldType)) {
                field = currentField;
                break;
            }
        }
        if (field == null) {
            throw new FieldNotFoundException("Cannot find a field of type " + fieldType + "in where.");
        }
        return field;
    }
781890
private boolean isSynthetic(FieldOrMethod member) {
        if (BCELUtil.isSynthetic(member)) {
            return true;
        }

        String name = member.getName();

        return name.startsWith("class$") || name.startsWith("access$");
    }
346553
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case QUALIFIERS:
      return isSetQualifiers();
    }
    throw new IllegalStateException();
  }
877100
private function checkMethodsAccessibility(): void
    {
        $publicMethods = $this->getClassPublicMethods();
        \sort($publicMethods);

        $allowedPublicMethods = $this->getAllowedPublicMethods();

        foreach (static::$allowedMagicMethods as $magicMethod) {
            if (\array_search($magicMethod, $publicMethods, true) !== false) {
                $allowedPublicMethods[] = $magicMethod;
            }
        }

        \sort($allowedPublicMethods);

        if (\count($publicMethods) > \count($allowedPublicMethods)
            || \count(\array_diff($allowedPublicMethods, $publicMethods)) !== 0
        ) {
            throw new ImmutabilityViolationException(\sprintf(
                'Class %s should not have public methods',
                static::class
            ));
        }
    }
670220
private boolean checkForSecureAccess() {
        Class[] classContext = getClassContext();
        for (Class clazz : classContext) {
            if (clazz.equals(SecureAccess.class) || clazz.equals(SecurityBreachHandler.class)
                    || clazz.equals(SecurityFunctions.class) || clazz.equals(SecureStorageImpl.class)) {
                return true;
            }
        }
        return false;
    }
515267
private void checkInnerClass(ClassDeclaration jclass)
            throws FatalCompileTimeException
    {
        boolean noFormBeanAnnotation = true;
        if (CompilerUtils.getAnnotation(jclass, FORM_BEAN_TAG_NAME, true) != null) {
            noFormBeanAnnotation = false;
        }
        else {
            //
            // check the methods for validatable property annotations that
            // would be processed elsewhere.
            //
            MethodDeclaration[] methods = CompilerUtils.getClassMethods(jclass, null);
            for (int i = 0; i < methods.length && noFormBeanAnnotation; i++) {
                MethodDeclaration method = methods[i];
                if (CompilerUtils.getAnnotation(method, VALIDATABLE_PROPERTY_TAG_NAME) != null) {
                    noFormBeanAnnotation = false;
                }
            }
        }

        if (noFormBeanAnnotation) {
            _formBeanChecker.check(jclass);
        }
    }
282926
private void checkMethod(String methodName, String signature) {
    JavaClass javaClass = checkClass();
    if (javaClass == null) {
      return;
    }

    for (JavaClass current = javaClass; current != null; current = getSuperclass(current)) {
      for (Method method : current.getMethods()) {
        if (methodName.equals(method.getName()) && signature.equals(method.getSignature())) {
          // method has been found - check if it's beta
          if (isBeta(method.getAnnotationEntries())) {
            bugReporter.reportBug(createBugInstance(BETA_METHOD_USAGE).addCalledMethod(this));
          }
          return;
        }
      }
    }
    if (!javaClass.isAbstract()) {
      bugReporter.logError(
          "Can't locate method " + javaClass.getClassName() + "." + methodName + signature);
    }
  }
784633
public <T> T access(Class<T> clazz)
    {
        if ( configuration.getClass().equals(clazz) )
        {
            return clazz.cast(configuration);
        }

        try
        {
            return clazz.cast(fieldCache.get(clazz).get(configuration));
        }
        catch ( Exception e )
        {
            log.error("Could not access field for " + clazz, e);
            throw new RuntimeException(e);
        }
    }