本文整理匯總了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();
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
}
示例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();
}
示例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);
}
}
示例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;
}
}