Determines whether an expression has an annotation with the given simple name. This does not
include annotations inherited from superclasses due to @Inherited.

@param simpleName the simple name of the annotation (e.g. "Nullable")
14601
public static <T extends Tree> Matcher<T> hasAnnotationWithSimpleName(final String simpleName) {
    return new Matcher<T>() {
      @Override
      public boolean matches(T tree, VisitorState state) {
        return ASTHelpers.hasDirectAnnotationWithSimpleName(
            ASTHelpers.getDeclaredSymbol(tree), simpleName);
      }
    };
  }
537038
@Override
    public boolean isDeclaredAnnotationWithin(Collection<String> annotationNames) {
        if (declaredAnnotations != null) {
            for (AnnotationInfo annotation : declaredAnnotations) {
                if (annotationNames.contains(annotation.getAnnotationClassName())) {
                    return true;
                }
            }
        }

        return false;
    }
501936
public static boolean isValidatorAnnotation(Class<?> annoType) { // as utility
        final String annoName = annoType.getName();
        return Srl.startsWith(annoName, JAVAX_CONSTRAINTS_PKG, HIBERNATE_CONSTRAINTS_PKG) // normal annotations
                || isNestedBeanAnnotation(annoType) // has validation nested bean
                || isLastaPresentsAnnotation(annoType); // LastaFlute provides
    }
1248919
@Override
    public boolean hasObjectWithPrefix(JavaColonNamespace namespace, String name) throws NamingException {
        ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData();
        J2EEName j2eeName = cmd.getJ2EEName();

        boolean b;
        try {
            b = (JavaColonNamespace.APP.equals(namespace) || JavaColonNamespace.GLOBAL.equals(namespace)) &&
                clientSupportFactory.getRemoteClientSupport().hasRemoteObjectWithPrefix(j2eeName.getApplication(), j2eeName.getModule(), j2eeName.getComponent(), namespace.toString(), name);
        } catch (RemoteException ex) {
            //ffdc
            b = false;
        }
        return b;
    }
566346
public static boolean isJavaBasicType(@Nullable String name) {
        if (StringUtils.isEmpty(name)) {
            return false;
        }
        return isJavaLangType(name) || BASIC_TYPE_MAP.containsKey(name);
    }
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;
    }
1365841
def has_annotation(self, annotation: str) -> bool:
        """"""
        return (
            self.has_enumerated_annotation(annotation) or
            self.has_regex_annotation(annotation) or
            self.has_local_annotation(annotation)
        )
1076258
@Nullable static AnnotationMirror getAnnotationWithSimpleName(Element element, String name) {
    for (AnnotationMirror mirror : element.getAnnotationMirrors()) {
      String annotationName = mirror.getAnnotationType().asElement().getSimpleName().toString();
      if (name.equals(annotationName)) {
        return mirror;
      }
    }
    return null;
  }
1299112
public static boolean hasAnnotation(final List<AnnotationInstance> annotations, final String annotationClaszName) {
        final DotName annotationName = DotName.createSimple(annotationClaszName);
        for (final AnnotationInstance annotation : annotations) {
            if (annotation.name().equals(annotationName)) {
                return true;
            }
        }
        return false;
    }
907669
public static Predicate<Field> isAnnotatedWith(Class<? extends Annotation>... annotations) {
        return field -> {
            for (Class<? extends Annotation> annotation : annotations) {
                if (field.isAnnotationPresent(annotation)) {
                    return true;
                }
            }
            return false;
        };
    }
765682
public static boolean hasAnnotation(CtField field, String annotationName) {
        FieldInfo info = field.getFieldInfo();
        AnnotationsAttribute ainfo = (AnnotationsAttribute)
            info.getAttribute(AnnotationsAttribute.invisibleTag);
        AnnotationsAttribute ainfo2 = (AnnotationsAttribute)
            info.getAttribute(AnnotationsAttribute.visibleTag);
        return checkAnnotation(ainfo, ainfo2, annotationName);
    }
178867
public static boolean isMemberName(String name)
  {
    if(name == null) {
      return false;
    }
    Matcher matcher = MEMBER_NAME_PATTERN.matcher(name);
    return matcher.find();
  }
667822
@Override
    public boolean hasRemoteObjectWithPrefix(String appName, String moduleName, String compName, String namespaceString, String name) throws NamingException {
        boolean b = false;
        NamingConstants.JavaColonNamespace namespace = NamingConstants.JavaColonNamespace.fromName(namespaceString);
        ComponentMetaData cmd = getCMD(appName, moduleName, compName, namespace);
        try {
            ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().beginContext(cmd);

            Iterator<RemoteJavaColonNamingHelper> remoteJCNHelpers = remoteJavaColonNamingHelpers.getServices();
            while (remoteJCNHelpers.hasNext()) {
                RemoteJavaColonNamingHelper helper = remoteJCNHelpers.next();
                b = helper.hasRemoteObjectWithPrefix(namespace, name);
                if (b == true)
                    break;
            }
        } finally {
            ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().endContext();
        }
        return b;
    }
297548
public boolean hasDeclaredFieldAnnotation(final String fieldAnnotationName) {
        for (final FieldInfo fi : getDeclaredFieldInfo()) {
            if (fi.hasAnnotation(fieldAnnotationName)) {
                return true;
            }
        }
        return false;
    }
559867
private boolean isQuotableParam(String name){
            boolean isQuotableParameter = false;
            List<String> params = getQuotableParams();
            for (String param : params){
                if (param.equalsIgnoreCase(name)){
                    isQuotableParameter = true;
                    break;
                }
            }
            return isQuotableParameter;
        }
152937
private static boolean hasAnnotation(String pkgInfo, String annotation) {
    if (!annotation.contains(".")) {
      ErrorUtil.warning(annotation + " is not a fully qualified name");
    }
    if (pkgInfo.contains("@" + annotation)) {
      return true;
    }
    int idx = annotation.lastIndexOf(".");
    String annotationPackageName = annotation.substring(0, idx);
    String annotationSimpleName = annotation.substring(idx + 1);
    if (pkgInfo.contains("@" + annotationSimpleName)) {
      String importRegex =
          "import\\s*" + annotationPackageName + "(\\.\\*|\\." + annotationSimpleName + ")";
      Pattern p = Pattern.compile(importRegex);
      Matcher m = p.matcher(pkgInfo);
      if (m.find()) {
        return true;
      }
    }
    return false;
  }
423430
private Variable checkVariableNameForDeclaration(String name, Expression expression) {
        if ("super".equals(name) || "this".equals(name)) return null;

        VariableScope scope = currentScope;
        Variable var = new DynamicVariable(name, currentScope.isInStaticContext());
        Variable orig = var;
        // try to find a declaration of a variable
        boolean crossingStaticContext = false;
        while (true) {
            crossingStaticContext = crossingStaticContext || scope.isInStaticContext();
            Variable var1;
            var1 = scope.getDeclaredVariable(var.getName());

            if (var1 != null) {
                var = var1;
                break;
            }

            var1 = scope.getReferencedLocalVariable(var.getName());
            if (var1 != null) {
                var = var1;
                break;
            }

            var1 = scope.getReferencedClassVariable(var.getName());
            if (var1 != null) {
                var = var1;
                break;
            }

            ClassNode classScope = scope.getClassScope();
            if (classScope != null) {
                Variable member = findClassMember(classScope, var.getName());
                if (member != null) {
                    boolean staticScope = crossingStaticContext || isSpecialConstructorCall;
                    boolean staticMember = member.isInStaticContext();
                    // We don't allow a static context (e.g. a static method) to access
                    // a non-static variable (e.g. a non-static field).
                    if (!(staticScope && !staticMember))
                        var = member;
                }
                break;
            }
            scope = scope.getParent();
        }
        if (var == orig && crossingStaticContext) {
            var = new DynamicVariable(var.getName(), true);
        }

        VariableScope end = scope;

        scope = currentScope;
        while (scope != end) {
            if (end.isClassScope() ||
                    (end.isReferencedClassVariable(name) && end.getDeclaredVariable(name) == null)) {
                scope.putReferencedClassVariable(var);
            } else {
                //var.setClosureSharedVariable(var.isClosureSharedVariable() || inClosure);
                scope.putReferencedLocalVariable(var);
            }
            scope = scope.getParent();
        }

        return var;
    }