code: 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;
      }
docs: 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).