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


Java List.nil方法代码示例

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


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

示例1: enterClassFiles

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/** Enter a set of generated class files. */
private List<ClassSymbol> enterClassFiles(Map<String, JavaFileObject> classFiles) {
    ClassReader reader = ClassReader.instance(context);
    Names names = Names.instance(context);
    List<ClassSymbol> list = List.nil();

    for (Map.Entry<String,JavaFileObject> entry : classFiles.entrySet()) {
        Name name = names.fromString(entry.getKey());
        JavaFileObject file = entry.getValue();
        if (file.getKind() != JavaFileObject.Kind.CLASS)
            throw new AssertionError(file);
        ClassSymbol cs;
        if (isPkgInfo(file, JavaFileObject.Kind.CLASS)) {
            Name packageName = Convert.packagePart(name);
            PackageSymbol p = reader.enterPackage(packageName);
            if (p.package_info == null)
                p.package_info = reader.enterClass(Convert.shortName(name), p);
            cs = p.package_info;
            if (cs.classfile == null)
                cs.classfile = file;
        } else
            cs = reader.enterClass(name, file);
        list = list.prepend(cs);
    }
    return list.reverse();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:JavacProcessingEnvironment.java

示例2: fallbackDescriptorType

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private Type fallbackDescriptorType(JCExpression tree) {
    switch (tree.getTag()) {
        case LAMBDA:
            JCLambda lambda = (JCLambda)tree;
            List<Type> argtypes = List.nil();
            for (JCVariableDecl param : lambda.params) {
                argtypes = param.vartype != null ?
                        argtypes.append(param.vartype.type) :
                        argtypes.append(syms.errType);
            }
            return new MethodType(argtypes, Type.recoveryType,
                    List.of(syms.throwableType), syms.methodClass);
        case REFERENCE:
            return new MethodType(List.nil(), Type.recoveryType,
                    List.of(syms.throwableType), syms.methodClass);
        default:
            Assert.error("Cannot get here!");
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:Attr.java

示例3: visitClassDef

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
public void visitClassDef(JCClassDecl node) {
    super.visitClassDef(node);
    // remove generated constructor that may have been added during attribution:
    List<JCTree> beforeConstructor = List.nil();
    List<JCTree> defs = node.defs;
    while (defs.nonEmpty() && !defs.head.hasTag(Tag.METHODDEF)) {
        beforeConstructor = beforeConstructor.prepend(defs.head);
        defs = defs.tail;
    }
    if (defs.nonEmpty() &&
        (((JCMethodDecl) defs.head).mods.flags & Flags.GENERATEDCONSTR) != 0) {
        defs = defs.tail;
        while (beforeConstructor.nonEmpty()) {
            defs = defs.prepend(beforeConstructor.head);
            beforeConstructor = beforeConstructor.tail;
        }
        node.defs = defs;
    }
    if (node.sym != null) {
        node.sym.completer = new ImplicitCompleter(topLevel);
    }
    node.sym = null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:JavacProcessingEnvironment.java

示例4: list

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
public Iterable<JavaFileObject> list(Location location,
                                     String packageName,
                                     Set<JavaFileObject.Kind> kinds,
                                     boolean recurse)
    throws IOException
{
    // validatePackageName(packageName);
    nullCheck(packageName);
    nullCheck(kinds);

    Iterable<? extends File> path = getLocation(location);
    if (path == null)
        return List.nil();
    RelativeDirectory subdirectory = RelativeDirectory.forPackage(packageName);
    ListBuffer<JavaFileObject> results = new ListBuffer<JavaFileObject>();

    for (File directory : path)
        listContainer(directory, subdirectory, kinds, recurse, results);
    return results.toList();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:JavacFileManager.java

示例5: parseParams

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private List<JCTree> parseParams(String s) throws ParseException {
    if (s.trim().isEmpty())
        return List.nil();

    JavacParser p = fac.newParser(s.replace("...", "[]"), false, false, false);
    ListBuffer<JCTree> paramTypes = new ListBuffer<>();
    paramTypes.add(p.parseType());

    if (p.token().kind == TokenKind.IDENTIFIER)
        p.nextToken();

    while (p.token().kind == TokenKind.COMMA) {
        p.nextToken();
        paramTypes.add(p.parseType());

        if (p.token().kind == TokenKind.IDENTIFIER)
            p.nextToken();
    }

    if (p.token().kind != TokenKind.EOF)
        throw new ParseException("dc.ref.unexpected.input");

    return paramTypes.toList();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:ReferenceParser.java

示例6: enterUnop

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/** Enter a unary operation into symbol table.
 *  @param name     The name of the operator.
 *  @param arg      The type of the operand.
 *  @param res      The operation's result type.
 *  @param opcode   The operation's bytecode instruction.
 */
private OperatorSymbol enterUnop(String name,
                                 Type arg,
                                 Type res,
                                 int opcode) {
    OperatorSymbol sym =
        new OperatorSymbol(names.fromString(name),
                           new MethodType(List.of(arg),
                                          res,
                                          List.<Type>nil(),
                                          methodClass),
                           opcode,
                           predefClass);
    predefClass.members().enter(sym);
    return sym;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:22,代码来源:Symtab.java

示例7: enumDeclaration

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/** EnumDeclaration = ENUM Ident [IMPLEMENTS TypeList] EnumBody
 *  @param mods    The modifiers starting the enum declaration
 *  @param dc       The documentation comment for the enum, or null.
 */
protected JCClassDecl enumDeclaration(JCModifiers mods, Comment dc) {
    int pos = token.pos;
    accept(ENUM);
    Name name = ident();

    List<JCExpression> implementing = List.nil();
    if (token.kind == IMPLEMENTS) {
        nextToken();
        implementing = typeList();
    }

    List<JCTree> defs = enumBody(name);
    mods.flags |= Flags.ENUM;
    JCClassDecl result = toP(F.at(pos).
        ClassDef(mods, name, List.nil(),
                 null, implementing, defs));
    attach(result, dc);
    return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:JavacParser.java

示例8: fallbackDescriptorType

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private Type fallbackDescriptorType(JCExpression tree) {
    switch (tree.getTag()) {
        case LAMBDA:
            JCLambda lambda = (JCLambda)tree;
            List<Type> argtypes = List.nil();
            for (JCVariableDecl param : lambda.params) {
                argtypes = param.vartype != null ?
                        argtypes.append(param.vartype.type) :
                        argtypes.append(syms.errType);
            }
            return new MethodType(argtypes, Type.recoveryType,
                    List.of(syms.throwableType), syms.methodClass);
        case REFERENCE:
            return new MethodType(List.<Type>nil(), Type.recoveryType,
                    List.of(syms.throwableType), syms.methodClass);
        default:
            Assert.error("Cannot get here!");
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:Attr.java

示例9: PostFlowAnalysis

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private PostFlowAnalysis(Context ctx) {
    log = Log.instance(ctx);
    types = Types.instance(ctx);
    enter = Enter.instance(ctx);
    names = Names.instance(ctx);
    syms = Symtab.instance(ctx);
    outerThisStack = List.nil();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:PostFlowAnalysis.java

示例10: getPackageInfoFilesFromClasses

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private List<PackageSymbol> getPackageInfoFilesFromClasses(List<? extends ClassSymbol> syms) {
    List<PackageSymbol> packages = List.nil();
    for (ClassSymbol sym : syms) {
        if (isPkgInfo(sym)) {
            packages = packages.prepend((PackageSymbol) sym.owner);
        }
    }
    return packages.reverse();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:JavacProcessingEnvironment.java

示例11: getTopLevelClasses

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
private List<ClassSymbol> getTopLevelClasses(List<? extends JCCompilationUnit> units) {
    List<ClassSymbol> classes = List.nil();
    for (JCCompilationUnit unit : units) {
        for (JCTree node : unit.defs) {
            if (node.getTag() == JCTree.CLASSDEF) {
                ClassSymbol sym = ((JCClassDecl) node).sym;
                Assert.checkNonNull(sym);
                classes = classes.prepend(sym);
            }
        }
    }
    return classes.reverse();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:14,代码来源:JavacProcessingEnvironment.java

示例12: visitLambda

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
@Override
public void visitLambda(JCLambda that) {
    super.visitLambda(that);
    if (that.targets == null) {
        that.targets = List.nil();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:Attr.java

示例13: capture

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/**
 * Capture conversion as specified by the JLS.
 */

public List<Type> capture(List<Type> ts) {
    List<Type> buf = List.nil();
    for (Type t : ts) {
        buf = buf.prepend(capture(t));
    }
    return buf.reverse();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:12,代码来源:Types.java

示例14: printRoundInfo

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/** Print info about this round. */
private void printRoundInfo(boolean lastRound) {
    if (printRounds || verbose) {
        List<ClassSymbol> tlc = lastRound ? List.nil() : topLevelClasses;
        Set<TypeElement> ap = lastRound ? Collections.emptySet() : annotationsPresent;
        log.printLines("x.print.rounds",
                number,
                "{" + tlc.toString(", ") + "}",
                ap,
                lastRound);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:JavacProcessingEnvironment.java

示例15: methodDeclaratorRest

import com.sun.tools.javac.util.List; //导入方法依赖的package包/类
/** MethodDeclaratorRest =
 *      FormalParameters BracketsOpt [THROWS TypeList] ( MethodBody | [DEFAULT AnnotationValue] ";")
 *  VoidMethodDeclaratorRest =
 *      FormalParameters [THROWS TypeList] ( MethodBody | ";")
 *  ConstructorDeclaratorRest =
 *      "(" FormalParameterListOpt ")" [THROWS TypeList] MethodBody
 */
protected JCTree methodDeclaratorRest(int pos,
                          JCModifiers mods,
                          JCExpression type,
                          Name name,
                          List<JCTypeParameter> typarams,
                          boolean isInterface, boolean isVoid,
                          Comment dc) {
    if (isInterface && (mods.flags & Flags.STATIC) != 0) {
        checkStaticInterfaceMethods();
    }
    JCVariableDecl prevReceiverParam = this.receiverParam;
    try {
        this.receiverParam = null;
        // Parsing formalParameters sets the receiverParam, if present
        List<JCVariableDecl> params = formalParameters();
        if (!isVoid) type = bracketsOpt(type);
        List<JCExpression> thrown = List.nil();
        if (token.kind == THROWS) {
            nextToken();
            thrown = qualidentList();
        }
        JCBlock body = null;
        JCExpression defaultValue;
        if (token.kind == LBRACE) {
            body = block();
            defaultValue = null;
        } else {
            if (token.kind == DEFAULT) {
                accept(DEFAULT);
                defaultValue = annotationValue();
            } else {
                defaultValue = null;
            }
            accept(SEMI);
            if (token.pos <= endPosTable.errorEndPos) {
                // error recovery
                skip(false, true, false, false);
                if (token.kind == LBRACE) {
                    body = block();
                }
            }
        }

        JCMethodDecl result =
                toP(F.at(pos).MethodDef(mods, name, type, typarams,
                                        receiverParam, params, thrown,
                                        body, defaultValue));
        attach(result, dc);
        return result;
    } finally {
        this.receiverParam = prevReceiverParam;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:61,代码来源:JavacParser.java


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