Checks that class-level annotations like @interface/@extends are not used on member functions.
763490
private void validateClassLevelJsDoc(Node n, JSDocInfo info) {
    if (info != null && n.isMemberFunctionDef()
        && hasClassLevelJsDoc(info)) {
      report(n, DISALLOWED_MEMBER_JSDOC);
    }
  }
1130576
private boolean canBeSkipped (TypeRef importedClass) {
		// skip known imported classes and the ones in JRE
		if (allReferencedTypes.contains(importedClass) || importedReferencedTypes.contains(importedClass) || importedClass.isJava())
			return true;
		// Skip the imported classes which are excluded 
		String classPackage = importedClass.getPackageRef().getFQN();
		for (String excludePrefix: excludePrefixes) {		// skip by the package prefix
			if (classPackage.startsWith(excludePrefix))
				return true;
		}
		if (excludes.contains(classPackage))				// skip by the full package name
			return true;
		return classPackage.length()<2;						// special situation for the primitive array 
	}
364208
public static boolean isAnnotationPresent(Annotation[] annotations,
      Class<? extends Annotation> cls) {
    for (Annotation annotation : annotations) {
      if (cls.isInstance(annotation)) {
        return true;
      }
    }
    return false;
  }
157633
public static List<Method> getAllAnnotationPresentMethod(Class<?> type,
                                                             Class<? extends Annotation> annotation) {
        List<Method> methods = getAllMethod(type);

        if (methods.isEmpty()) {
            return Collections.emptyList();
        }

        return methods.stream().filter(method -> method.isAnnotationPresent(annotation))
            .collect(Collectors.toList());
    }
1014338
public static boolean isInheritedMapped(Class<?> classToCheck){
		
		for (Class<?> clazz : getAllsuperClasses(classToCheck)) 
			if(!isNull(clazz.getAnnotation(JGlobalMap.class))) 
				return true;

		for (Field field : getListOfFields(classToCheck)) 
			if(!isNull(field.getAnnotation(JMap.class))) 
				return true;
		
		return false;
	}
761510
protected boolean isValidType(Class<?> type, Annotation[] classAnnotations) {
		if (type == null)
			return false;
		
		if (annotated) {
			return checkAnnotation(type);			
		} else if (scanpackages != null) {
			String classPackage = type.getPackage().getName();
			for (String pkg : scanpackages) {
				if (classPackage.startsWith(pkg)) {
					if (annotated) {
						return checkAnnotation(type);		
					} else
						return true;
				}
					
			}

			return false;
		} else if (clazzes != null) {
			for (Class<?> cls : clazzes) { // must strictly equal. Don't check
											// inheritance
				if (cls == type)
					return true;
			}

			return false;
		}

		return true;
	}
1105250
@SuppressWarnings("unchecked")
    @SafeVarargs
    public final boolean containsAnnotations(Class<? extends Annotation>... annotationClass) {
        if (ArrayUtils.isEmpty(annotationClass)) {
            return false;
        }

        for (Object anno : getAnnotations()) {
            for (Class cls : annotationClass) {
                if (((Annotation) anno).annotationType().equals(cls)) {
                    return true;
                }
            }
        }
        return false;
    }
1058925
private static boolean classHasRuntimeVisibleAnnotation(JavaClass cls) {
		AnnotationEntry[] annotations = cls.getAnnotationEntries();
		if (annotations != null) {
			for (AnnotationEntry annotation : annotations) {
				if (annotation.isRuntimeVisible()) {
					return true;
				}
			}
		}

		return false;
	}
873576
private boolean baseUsedInClass(Node n){
    for (Node curr = n; curr != null; curr = curr.getParent()){
      if (curr.isClassMembers()) {
        return true;
      }
    }
    return false;
  }
765988
@SafeVarargs
    private static void checkNoAnnotations(Method method, Class<? extends Annotation> foundAn,
            Class<? extends Annotation>... disallowedAn) {

        for (Class<? extends Annotation> an : disallowedAn) {
            if (method.isAnnotationPresent(an)) {
                throw new EventsException("Method " + Utils.methodToString(method)
                        + " marked with @" + foundAn.getSimpleName()
                        + " cannot be marked with @" + an.getSimpleName());
            }
        }
    }
917240
@Check
	public void checkRedundantImplementedInterfaces(SarlClass xtendClass) {
		checkRedundantInterfaces(
				xtendClass,
				XTEND_CLASS__IMPLEMENTS,
				xtendClass.getImplements(),
				Utils.singletonList(xtendClass.getExtends()));
	}
1069919
private boolean methodExists(Class clazz, String name) {
        Method[] methods = clazz.getDeclaredMethods();
        for (int i = 0; i < methods.length; i++) {
            if (methods[i].getName().equals(name)) {
                return true;
            }
        }

        if (clazz.getSuperclass() != null
                && methodExists(clazz.getSuperclass(), name)) {
            return true;
        }

        Class[] interfaces = clazz.getInterfaces();
        for (int i = 0; i < interfaces.length; i++) {
            if (methodExists(interfaces[i], name)) {
                return true;
            }
        }

        return false;
    }
371326
def is_classmethod(fn):
    """"""
    # This is True for bound methods
    if not inspect.ismethod(fn):
        return False
    if not hasattr(fn, "__self__"):
        return False
    im_self = fn.__self__
    # This is None for instance methods on classes, but True
    # for instance methods on instances.
    if im_self is None:
        return False
    # This is True for class methods of new- and old-style classes, respectively
    return isinstance(im_self, six.class_types)
521194
private function isParseExtendAnnotations(array $annotations, int $type = 1): bool
    {
        foreach ($this->extends as $extend) {
            if ($type == 1) {
                $isParse = $extend->isParseClassAnnotations($annotations);
            } elseif ($type == 2) {
                $isParse = $extend->isParsePropertyAnnotations($annotations);
            } else {
                $isParse = $extend->isParseMethodAnnotations($annotations);
            }
            if ($isParse) {
                return true;
            }
        }

        return false;
    }
62917
@SuppressWarnings("unchecked")
    private boolean isClassTrivial(ClassTraceInfo info) {
        AnnotationNode trivialAnnotation = getAnnotation(TRIVIAL_TYPE.getDescriptor(), info.classNode.visibleAnnotations);
        if (trivialAnnotation != null) {
            return true;
        }
        return false;
    }
301776
public static boolean isBindingAnnotation(Class<? extends Annotation> annotation) {
    return annotation.isAnnotationPresent(BindingAnnotation.class)
        || annotation.isAnnotationPresent(Qualifier.class);
  }
210670
def _validate_overriden_fields_are_not_defined_in_superclasses(class_to_field_type_overrides,
                                                               schema_graph):
    """"""
    for class_name, field_type_overrides in six.iteritems(class_to_field_type_overrides):
        for superclass_name in schema_graph.get_inheritance_set(class_name):
            if superclass_name != class_name:
                superclass = schema_graph.get_element_by_class_name(superclass_name)
                for field_name in field_type_overrides:
                    if field_name in superclass.properties:
                        raise AssertionError(
                            u'Attempting to override field "{}" from class "{}", but the field is '
                            u'defined in superclass "{}"'
                            .format(field_name, class_name, superclass_name))