ctx.tree.getTag() == Tag.CLASSDEF ? ((ClassSymbol) ASTHelpers.getSymbol(ctx.tree)).members().getSymbols() : ctx.info.getLocalElements()) .flatMap( symbols ->
Streams.stream(Iterables.concat(env.info.getLocalElements(), enclosingTypes)) .map(sym -> sym.getSimpleName().toString()) .collect(ImmutableSet.toImmutableSet());
public Iterable<? extends Element> getLocalElements() { return env.info.getLocalElements(); }
public Iterable<? extends Element> getLocalElements() { return env.info.getLocalElements(); }
public Iterable<? extends Element> getLocalElements() { return env.info.getLocalElements(); }
public Iterable<? extends Element> getLocalElements() { return env.info.getLocalElements(); }
/** * Returns a list of type symbols in the scope enclosing {@code env} guaranteeing that, when two * symbols share a simple name, the shadower precedes the shadow-ee */ private static Iterable<Symbol> typesInEnclosingScope( Env<AttrContext> env, PackageSymbol javaLang) { // Collect all visible type names declared in this source file by ascending lexical scopes // and excluding TypeVariableSymbols (otherwise, every type parameter spuriously shadows itself) Iterable<Symbol> localSymbolsInScope = Streams.stream(env) .map( ctx -> ctx.tree.getTag() == Tag.CLASSDEF ? ((ClassSymbol) ASTHelpers.getSymbol(ctx.tree)).members().getSymbols() : ctx.info.getLocalElements()) .flatMap( symbols -> Streams.stream(symbols).filter(sym -> !(sym instanceof TypeVariableSymbol))) .collect(ImmutableList.toImmutableList()); // Concatenate with all visible type names declared in other source files: // Ignore wildcard imports here since we don't use them and they can cause issues (b/109867096) return Iterables.concat( localSymbolsInScope, // Local symbols env.toplevel.namedImportScope.getSymbols(), // Explicitly named imports javaLang.members().getSymbols(), // implicitly imported java.lang.* symbols env.toplevel.packge.members().getSymbols()); // Siblings in class hierarchy }
Streams.stream(Iterables.concat(env.info.getLocalElements(), enclosingTypes)) .map(sym -> sym.getSimpleName().toString()) .collect(ImmutableSet.toImmutableSet());