Find an unqualified identifier which matches a specified kind set.
@param env       The current environment.
@param name      The identifier's name.
@param kind      Indicates the possible symbol kinds
(a subset of VAL, TYP, PCK).
175641
Symbol findIdent(Env<AttrContext> env, Name name, int kind) {
        Symbol bestSoFar = typeNotFound;
        Symbol sym;

        if ((kind & VAR) != 0) {
            sym = findVar(env, name);
            if (sym.exists()) return sym;
            else if (sym.kind < bestSoFar.kind) bestSoFar = sym;
        }

        if ((kind & TYP) != 0) {
            sym = findType(env, name);
            if (sym.kind==TYP) {
                 reportDependence(env.enclClass.sym, sym);
            }
            if (sym.exists()) return sym;
            else if (sym.kind < bestSoFar.kind) bestSoFar = sym;
        }

        if ((kind & PCK) != 0) return reader.enterPackage(name);
        else return bestSoFar;
    }
639705
Symbol findIdentInPackage(Env<AttrContext> env, TypeSymbol pck,
                              Name name, KindSelector kind) {
        Name fullname = TypeSymbol.formFullName(name, pck);
        Symbol bestSoFar = typeNotFound;
        if (kind.contains(KindSelector.TYP)) {
            RecoveryLoadClass recoveryLoadClass =
                    allowModules && !kind.contains(KindSelector.PCK) &&
                    !pck.exists() && !env.info.isSpeculative ?
                        doRecoveryLoadClass : noRecovery;
            Symbol sym = loadClass(env, fullname, recoveryLoadClass);
            if (sym.exists()) {
                // don't allow programs to use flatnames
                if (name == sym.name) return sym;
            }
            else bestSoFar = bestOf(bestSoFar, sym);
        }
        if (kind.contains(KindSelector.PCK)) {
            return lookupPackage(env, fullname);
        }
        return bestSoFar;
    }
637398
@Requires({
    "element != null",
    "clazz != null",
    "kinds != null"
  })
  @SuppressWarnings("unchecked")
  public static <T extends ElementModel> T findEnclosingElement(
      ElementModel element, Class<T> clazz, ElementKind... kinds) {
    List<ElementKind> list = Arrays.asList(kinds);
    for (;;) {
      element = element.getEnclosingElement();
      if (element == null) {
        return null;
      }
      if (list.contains(element.getKind())
          && clazz.isAssignableFrom(element.getClass())) {
        return (T) element;
      }
    }
  }
88343
public static Integer getEnvironmentInteger(String name, Integer defaultValue) {
        if (envVars == null) {
            throw new IllegalStateException("The environment vars must be provided before calling getEnvironmentInteger.");
        }

        String value = getEnvironmentString(name, null);

        if (value == null) {
            return defaultValue;
        }
        else {
            return Integer.parseInt(value);
        }
    }
820656
public static <T extends Tree> Matcher<T> kindIs(final Kind kind) {
    return new Matcher<T>() {
      @Override
      public boolean matches(T tree, VisitorState state) {
        return tree.getKind() == kind;
      }
    };
  }
709690
public static Expression constantSanitizedContentKindAsContentKind(
      @Nullable SanitizedContentKind kind) {
    return (kind == null)
        ? BytecodeUtils.constantNull(CONTENT_KIND_TYPE)
        : FieldRef.enumReference(ContentKind.valueOf(kind.name())).accessor();
  }
873984
public static int getIdentifier(String name) {
        Resources res = Resources.getSystem();
        return res.getIdentifier(name, TYPE_ID, NATIVE_PACKAGE);
    }
399281
def find_generic(self, name):
        """"""
        defgeneric = lib.EnvFindDefgeneric(self._env, name.encode())
        if defgeneric == ffi.NULL:
            raise LookupError("Generic '%s' not found" % name)

        return Generic(self._env, defgeneric)
172117
private Symbol resolveType(String name, SearchSuperTypes searchSuperTypes) {
    Symbol type = null;
    if (searchSuperTypes == SearchSuperTypes.YES) {
      type = getSuperType(enclosingClass, name);
    }
    if (enclosingClass.getSimpleName().contentEquals(name)) {
      type = enclosingClass;
    }
    if (type == null) {
      type = getLexicallyEnclosing(enclosingClass, name);
    }
    if (type == null) {
      type = attribIdent(name);
    }
    checkGuardedBy(
        !(type instanceof Symbol.PackageSymbol),
        "All we could find for '%s' was a package symbol.",
        name);
    return type;
  }
295027
@Nullable
  public static Symbol findIdent(String name, VisitorState state, KindSelector kind) {
    ClassType enclosingClass = ASTHelpers.getType(state.findEnclosing(ClassTree.class));
    if (enclosingClass == null || enclosingClass.tsym == null) {
      return null;
    }
    Env<AttrContext> env = Enter.instance(state.context).getClassEnv(enclosingClass.tsym);
    MethodTree enclosingMethod = state.findEnclosing(MethodTree.class);
    if (enclosingMethod != null) {
      env = MemberEnter.instance(state.context).getMethodEnv((JCMethodDecl) enclosingMethod, env);
    }
    try {
      Method method =
          Resolve.class.getDeclaredMethod("findIdent", Env.class, Name.class, KindSelector.class);
      method.setAccessible(true);
      Symbol result =
          (Symbol) method.invoke(Resolve.instance(state.context), env, state.getName(name), kind);
      return result.exists() ? result : null;
    } catch (ReflectiveOperationException e) {
      throw new LinkageError(e.getMessage(), e);
    }
  }
406701
public static KindName kindName(Symbol sym) {
        switch (sym.getKind()) {
        case PACKAGE:
            return KindName.PACKAGE;

        case ENUM:
            return KindName.ENUM;

        case ANNOTATION_TYPE:
        case CLASS:
            return KindName.CLASS;

        case INTERFACE:
            return KindName.INTERFACE;

        case TYPE_PARAMETER:
            return KindName.TYPEVAR;

        case ENUM_CONSTANT:
        case FIELD:
        case PARAMETER:
        case LOCAL_VARIABLE:
        case EXCEPTION_PARAMETER:
        case RESOURCE_VARIABLE:
            return KindName.VAR;

        case CONSTRUCTOR:
            return KindName.CONSTRUCTOR;

        case METHOD:
            return KindName.METHOD;
        case STATIC_INIT:
            return KindName.STATIC_INIT;
        case INSTANCE_INIT:
            return KindName.INSTANCE_INIT;

        default:
                throw new AssertionError("Unexpected kind: "+sym.getKind());
        }
    }
480002
public static EnvironmentType newInstance(String name)
    {
    	EnvironmentType env = new EnvironmentType();
    	env.setName(name);
        return env;
    }
1219289
public static void init(ProcessingEnvironment env) {
		processingEnv = env;
		typeUtils = processingEnv.getTypeUtils();
		elementUtils = processingEnv.getElementUtils();
	}
460106
public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) {
		if (this.sarlEnumeration == null) {
			this.container = container;
			this.sarlEnumeration = SarlFactory.eINSTANCE.createSarlEnumeration();
			container.getMembers().add(this.sarlEnumeration);
			if (!Strings.isEmpty(name)) {
				this.sarlEnumeration.setName(name);
			}
		}
	}
1220138
@GwtIncompatible
    public static <T> Key<T> create( Class<? extends T> kindClass, String name ) {
        throw new UnsupportedOperationException();
    }
548432
function Kind(name, regex) {

    if (!Kind.checkRegExp(regex)) {
        throw new TypeError(f('Invalid %j type regexp %j', name, regex));
    }

    /**
     * @public
     * @memberOf {Kind}
     * @property
     * @type {String}
     * */
    this.name = name;

    /**
     * @public
     * @memberOf {Kind}
     * @property
     * @type {String}
     * */
    this.regex = regex;

    /**
     * @public
     * @memberOf {Kind}
     * @property
     * @type {RegExp}
     * */
    this._compiledRegExp = new RegExp(f('^(?:%s)$', this.regex));
}
778922
public void listAlternatives(ILexNameToken name)
	{
		for (PDefinition possible : findMatches(name))
		{
			if (af.createPDefinitionAssistant().isFunctionOrOperation(possible))
			{
				TypeChecker.detail("Possible", possible.getName());
			}
		}
	}