com.sun.tools.javac.code.Scope.NamedImportScope Java Examples

The following examples show how to use com.sun.tools.javac.code.Scope.NamedImportScope. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Enter.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Create a fresh environment for toplevels.
 *  @param tree     The toplevel tree.
 */
Env<AttrContext> topLevelEnv(JCCompilationUnit tree) {
    Env<AttrContext> localEnv = new Env<>(tree, new AttrContext());
    localEnv.toplevel = tree;
    localEnv.enclClass = predefClassDef;
    tree.toplevelScope = WriteableScope.create(tree.packge);
    tree.namedImportScope = new NamedImportScope(tree.packge, tree.toplevelScope);
    tree.starImportScope = new StarImportScope(tree.packge);
    localEnv.info.scope = tree.toplevelScope;
    localEnv.info.lint = lint;
    return localEnv;
}
 
Example #2
Source File: TypeEnter.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Import statics types of a given name.  Non-types are handled in Attr.
 *  @param imp           The import that is being handled.
 *  @param tsym          The class from which the name is imported.
 *  @param name          The (simple) name being imported.
 *  @param env           The environment containing the named import
 *                  scope to add to.
 */
private void importNamedStatic(final JCImport imp,
                               final TypeSymbol tsym,
                               final Name name,
                               final Env<AttrContext> env) {
    if (tsym.kind != TYP) {
        log.error(DiagnosticFlag.RECOVERABLE, imp.pos(), Errors.StaticImpOnlyClassesAndInterfaces);
        return;
    }

    final NamedImportScope toScope = env.toplevel.namedImportScope;
    final Scope originMembers = tsym.members();

    imp.importScope = toScope.importByName(types, originMembers, name, staticImportFilter, imp, cfHandler);
}
 
Example #3
Source File: TypeEnter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/** Import statics types of a given name.  Non-types are handled in Attr.
 *  @param imp           The import that is being handled.
 *  @param tsym          The class from which the name is imported.
 *  @param name          The (simple) name being imported.
 *  @param env           The environment containing the named import
 *                  scope to add to.
 */
private void importNamedStatic(final JCImport imp,
                               final TypeSymbol tsym,
                               final Name name,
                               final Env<AttrContext> env) {
    if (tsym.kind != TYP) {
        log.error(DiagnosticFlag.RECOVERABLE, imp.pos(), "static.imp.only.classes.and.interfaces");
        return;
    }

    final NamedImportScope toScope = env.toplevel.namedImportScope;
    final Scope originMembers = tsym.members();

    imp.importScope = toScope.importByName(types, originMembers, name, staticImportFilter, imp, cfHandler);
}