当前位置: 首页>>代码示例>>Java>>正文


Java Scope.Entry方法代码示例

本文整理汇总了Java中com.sun.tools.javac.code.Scope.Entry方法的典型用法代码示例。如果您正苦于以下问题:Java Scope.Entry方法的具体用法?Java Scope.Entry怎么用?Java Scope.Entry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.javac.code.Scope的用法示例。


在下文中一共展示了Scope.Entry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: iterator

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
public Iterator<Symbol> iterator() {
    return new Iterator<Symbol>() {

        /** The next entry to examine, or null if none. */
        private Scope.Entry nextEntry = scope.elems;

        private boolean hasNextForSure = false;

        public boolean hasNext() {
            if (hasNextForSure) {
                return true;
            }
            while (nextEntry != null && unwanted(nextEntry.sym)) {
                nextEntry = nextEntry.sibling;
            }
            hasNextForSure = (nextEntry != null);
            return hasNextForSure;
        }

        public Symbol next() {
            if (hasNext()) {
                Symbol result = nextEntry.sym;
                nextEntry = nextEntry.sibling;
                hasNextForSure = false;
                return result;
            } else {
                throw new NoSuchElementException();
            }
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:36,代码来源:FilteredMemberList.java

示例2: getAllValues

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
/**
 * Returns a map from element symbols to their values.
 * Includes all elements, whether explicit or defaulted.
 */
private Map<MethodSymbol, Attribute> getAllValues() {
    Map<MethodSymbol, Attribute> res =
        new LinkedHashMap<MethodSymbol, Attribute>();

    // First find the default values.
    ClassSymbol sym = (ClassSymbol) anno.type.tsym;
    for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) {
        if (e.sym.kind == Kinds.MTH) {
            MethodSymbol m = (MethodSymbol) e.sym;
            Attribute def = m.getDefaultValue();
            if (def != null)
                res.put(m, def);
        }
    }
    // Next find the explicit values, possibly overriding defaults.
    for (Pair<MethodSymbol, Attribute> p : anno.values)
        res.put(p.fst, p.snd);
    return res;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:24,代码来源:AnnotationProxyMaker.java

示例3: findConstructor

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
/**
 * Find constructor in this class.
 *
 * @param constrName the unqualified name to search for.
 * @param paramTypes the array of Strings for constructor parameters.
 * @return the first ConstructorDocImpl which matches, null if not found.
 */
public ConstructorDoc findConstructor(String constrName,
                                      String[] paramTypes) {
    Names names = tsym.name.table.names;
    for (Scope.Entry e = tsym.members().lookup(names.fromString("<init>")); e.scope != null; e = e.next()) {
        if (e.sym.kind == Kinds.MTH) {
            if (hasParameterTypes((MethodSymbol)e.sym, paramTypes)) {
                return env.getConstructorDoc((MethodSymbol)e.sym);
            }
        }
    }

    //###(gj) As a temporary measure until type variables are better
    //### handled, try again without the parameter types.
    //### This will often find the right constructor, and occassionally
    //### find the wrong one.
    //if (paramTypes != null) {
    //    return findConstructor(constrName, null);
    //}

    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:ClassDocImpl.java

示例4: getClasses

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
/**
 * Return a list of all classes contained in this package, including
 * member classes of those classes, and their member classes, etc.
 */
private List<ClassDocImpl> getClasses(boolean filtered) {
    if (allClasses != null && !filtered) {
        return allClasses;
    }
    if (allClassesFiltered != null && filtered) {
        return allClassesFiltered;
    }
    ListBuffer<ClassDocImpl> classes = new ListBuffer<ClassDocImpl>();
    for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) {
        if (e.sym != null) {
            ClassSymbol s = (ClassSymbol)e.sym;
            ClassDocImpl c = env.getClassDoc(s);
            if (c != null && !c.isSynthetic())
                c.addAllClasses(classes, filtered);
        }
    }
    if (filtered)
        return allClassesFiltered = classes.toList();
    else
        return allClasses = classes.toList();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:PackageDocImpl.java

示例5: getDefinedSerializableFields

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
private VarSymbol getDefinedSerializableFields(ClassSymbol def) {
    Names names = def.name.table.names;

    /* SERIALIZABLE_FIELDS can be private,
     * so must lookup by ClassSymbol, not by ClassDocImpl.
     */
    for (Scope.Entry e = def.members().lookup(names.fromString(SERIALIZABLE_FIELDS)); e.scope != null; e = e.next()) {
        if (e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol)e.sym;
            if ((f.flags() & Flags.STATIC) != 0 &&
                (f.flags() & Flags.PRIVATE) != 0) {
                return f;
            }
        }
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:SerializedForm.java

示例6: computeDefaultSerializableFields

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
private void computeDefaultSerializableFields(DocEnv env,
                                              ClassSymbol def,
                                              ClassDocImpl cd) {
    for (Scope.Entry e = def.members().elems; e != null; e = e.sibling) {
        if (e.sym != null && e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol)e.sym;
            if ((f.flags() & Flags.STATIC) == 0 &&
                (f.flags() & Flags.TRANSIENT) == 0) {
                //### No modifier filtering applied here.
                FieldDocImpl fd = env.getFieldDoc(f);
                //### Add to beginning.
                //### Preserve order used by old 'javadoc'.
                fields.prepend(fd);
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:SerializedForm.java

示例7: addMethodIfExist

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
private void addMethodIfExist(DocEnv env, ClassSymbol def, String methodName) {
    Names names = def.name.table.names;

    for (Scope.Entry e = def.members().lookup(names.fromString(methodName)); e.scope != null; e = e.next()) {
        if (e.sym.kind == Kinds.MTH) {
            MethodSymbol md = (MethodSymbol)e.sym;
            if ((md.flags() & Flags.STATIC) == 0) {
                /*
                 * WARNING: not robust if unqualifiedMethodName is overloaded
                 *          method. Signature checking could make more robust.
                 * READOBJECT takes a single parameter, java.io.ObjectInputStream.
                 * WRITEOBJECT takes a single parameter, java.io.ObjectOutputStream.
                 */
                methods.append(env.getMethodDoc(md));
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:SerializedForm.java

示例8: needsHeader

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
private boolean needsHeader(ClassSymbol c, boolean checkNestedClasses) {
    if (c.isLocal() || (c.flags() & Flags.SYNTHETIC) != 0)
        return false;

    for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
        if (i.sym.kind == Kinds.MTH && (i.sym.flags() & Flags.NATIVE) != 0)
            return true;
        for (Attribute.Compound a: i.sym.getDeclarationAttributes()) {
            if (a.type.tsym == syms.nativeHeaderType.tsym)
                return true;
        }
    }
    if (checkNestedClasses) {
        for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
            if ((i.sym.kind == Kinds.TYP) && needsHeader(((ClassSymbol) i.sym), true))
                return true;
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:JNIWriter.java

示例9: findConstructor

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
/**
 * Find constructor in this class.
 *
 * @param constrName the unqualified name to search for.
 * @param paramTypeArray the array of Strings for constructor parameters.
 * @return the first ConstructorDocImpl which matches, null if not found.
 */
public ConstructorDoc findConstructor(String constrName,
                                      String[] paramTypes) {
    Name.Table names = tsym.name.table;
    for (Scope.Entry e = tsym.members().lookup(names.fromString("<init>")); e.scope != null; e = e.next()) {
        if (e.sym.kind == Kinds.MTH) {
            if (hasParameterTypes((MethodSymbol)e.sym, paramTypes)) {
                return env.getConstructorDoc((MethodSymbol)e.sym);
            }
        }
    }

    //###(gj) As a temporary measure until type variables are better
    //### handled, try again without the parameter types.
    //### This will often find the right constructor, and occassionally
    //### find the wrong one.
    //if (paramTypes != null) {
    //    return findConstructor(constrName, null);
    //}

    return null;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:29,代码来源:ClassDocImpl.java

示例10: addMethodIfExist

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
private void addMethodIfExist(DocEnv env, ClassSymbol def, String methodName) {
    Name.Table names = def.name.table;

    for (Scope.Entry e = def.members().lookup(names.fromString(methodName)); e.scope != null; e = e.next()) {
        if (e.sym.kind == Kinds.MTH) {
            MethodSymbol md = (MethodSymbol)e.sym;
            if ((md.flags() & Flags.STATIC) == 0) {
                /*
                 * WARNING: not robust if unqualifiedMethodName is overloaded
                 *          method. Signature checking could make more robust.
                 * READOBJECT takes a single parameter, java.io.ObjectInputStream.
                 * WRITEOBJECT takes a single parameter, java.io.ObjectOutputStream.
                 */
                methods.append(env.getMethodDoc(md));
            }
        }
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:19,代码来源:SerializedForm.java

示例11: mapSerialFieldTagImplsToFieldDocImpls

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
private void mapSerialFieldTagImplsToFieldDocImpls(FieldDocImpl spfDoc,
                                                   DocEnv env,
                                                   ClassSymbol def) {
    Name.Table names = def.name.table;

    SerialFieldTag[] sfTag = spfDoc.serialFieldTags();
    for (int i = 0; i < sfTag.length; i++) {
        Name fieldName = names.fromString(sfTag[i].fieldName());

        // Look for a FieldDocImpl that is documented by serialFieldTagImpl.
        for (Scope.Entry e = def.members().lookup(fieldName); e.scope != null; e = e.next()) {
            if (e.sym.kind == Kinds.VAR) {
                VarSymbol f = (VarSymbol)e.sym;
                FieldDocImpl fdi = env.getFieldDoc(f);
                ((SerialFieldTagImpl)(sfTag[i])).mapToFieldDocImpl(fdi);
                break;
            }
        }
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:21,代码来源:SerializedForm.java

示例12: mapSerialFieldTagImplsToFieldDocImpls

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
private void mapSerialFieldTagImplsToFieldDocImpls(FieldDocImpl spfDoc,
                                                   DocEnv env,
                                                   ClassSymbol def) {
    Names names = def.name.table.names;

    SerialFieldTag[] sfTag = spfDoc.serialFieldTags();
    for (int i = 0; i < sfTag.length; i++) {
        Name fieldName = names.fromString(sfTag[i].fieldName());

        // Look for a FieldDocImpl that is documented by serialFieldTagImpl.
        for (Scope.Entry e = def.members().lookup(fieldName); e.scope != null; e = e.next()) {
            if (e.sym.kind == Kinds.VAR) {
                VarSymbol f = (VarSymbol)e.sym;
                FieldDocImpl fdi = env.getFieldDoc(f);
                ((SerialFieldTagImpl)(sfTag[i])).mapToFieldDocImpl(fdi);
                break;
            }
        }
    }
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:21,代码来源:SerializedForm.java

示例13: enumConstant

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
/** Return the selected enumeration constant symbol, or null. */
private Symbol enumConstant(JCTree tree, Type enumType) {
    if (tree.getTag() != JCTree.IDENT) {
        log.error(tree.pos(), "enum.label.must.be.unqualified.enum");
        return syms.errSymbol;
    }
    JCIdent ident = (JCIdent)tree;
    Name name = ident.name;
    for (Scope.Entry e = enumType.tsym.members().lookup(name);
         e.scope != null; e = e.next()) {
        if (e.sym.kind == VAR) {
            Symbol s = ident.sym = e.sym;
            ((VarSymbol)s).getConstValue(); // ensure initializer is evaluated
            ident.type = s.type;
            return ((s.flags_field & Flags.ENUM) == 0)
                ? null : s;
        }
    }
    return null;
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:21,代码来源:Attr.java

示例14: findConstructor

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
/**
 * Find constructor in this class.
 *
 * @param constrName the unqualified name to search for.
 * @param paramTypeArray the array of Strings for constructor parameters.
 * @return the first ConstructorDocImpl which matches, null if not found.
 */
public ConstructorDoc findConstructor(String constrName,
                                      String[] paramTypes) {
    Names names = tsym.name.table.names;
    for (Scope.Entry e = tsym.members().lookup(names.fromString("<init>")); e.scope != null; e = e.next()) {
        if (e.sym.kind == Kinds.MTH) {
            if (hasParameterTypes((MethodSymbol)e.sym, paramTypes)) {
                return env.getConstructorDoc((MethodSymbol)e.sym);
            }
        }
    }

    //###(gj) As a temporary measure until type variables are better
    //### handled, try again without the parameter types.
    //### This will often find the right constructor, and occassionally
    //### find the wrong one.
    //if (paramTypes != null) {
    //    return findConstructor(constrName, null);
    //}

    return null;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:29,代码来源:ClassDocImpl.java

示例15: size

import com.sun.tools.javac.code.Scope; //导入方法依赖的package包/类
public int size() {
    int cnt = 0;
    for (Scope.Entry e = scope.elems; e != null; e = e.sibling) {
        if (!unwanted(e.sym))
            cnt++;
    }
    return cnt;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:9,代码来源:FilteredMemberList.java


注:本文中的com.sun.tools.javac.code.Scope.Entry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。