本文整理匯總了Java中com.sun.tools.javac.util.List.isEmpty方法的典型用法代碼示例。如果您正苦於以下問題:Java List.isEmpty方法的具體用法?Java List.isEmpty怎麽用?Java List.isEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sun.tools.javac.util.List
的用法示例。
在下文中一共展示了List.isEmpty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: equals
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!(obj instanceof MethodType))
return false;
MethodType m = (MethodType)obj;
List<Type> args1 = argtypes;
List<Type> args2 = m.argtypes;
while (!args1.isEmpty() && !args2.isEmpty()) {
if (!args1.head.equals(args2.head))
return false;
args1 = args1.tail;
args2 = args2.tail;
}
if (!args1.isEmpty() || !args2.isEmpty())
return false;
return restype.equals(m.restype);
}
示例2: translateArgs
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/** Translate method argument list, casting each argument
* to its corresponding type in a list of target types.
* @param _args The method argument list.
* @param parameters The list of target types.
* @param varargsElement The erasure of the varargs element type,
* or null if translating a non-varargs invocation
*/
<T extends JCTree> List<T> translateArgs(List<T> _args,
List<Type> parameters,
Type varargsElement) {
if (parameters.isEmpty()) return _args;
List<T> args = _args;
while (parameters.tail.nonEmpty()) {
args.head = translate(args.head, parameters.head);
args = args.tail;
parameters = parameters.tail;
}
Type parameter = parameters.head;
Assert.check(varargsElement != null || args.length() == 1);
if (varargsElement != null) {
while (args.nonEmpty()) {
args.head = translate(args.head, varargsElement);
args = args.tail;
}
} else {
args.head = translate(args.head, parameter);
}
return _args;
}
示例3: switchBlockStatementGroup
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
protected JCCase switchBlockStatementGroup() {
int pos = token.pos;
List<JCStatement> stats;
JCCase c;
switch (token.kind) {
case CASE:
nextToken();
JCExpression pat = parseExpression();
accept(COLON);
stats = blockStatements();
c = F.at(pos).Case(pat, stats);
if (stats.isEmpty())
storeEnd(c, S.prevToken().endPos);
return c;
case DEFAULT:
nextToken();
accept(COLON);
stats = blockStatements();
c = F.at(pos).Case(null, stats);
if (stats.isEmpty())
storeEnd(c, S.prevToken().endPos);
return c;
}
throw new AssertionError("should not reach here");
}
示例4: intersect
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/**
* Intersect two closures
*/
public List<Type> intersect(List<Type> cl1, List<Type> cl2) {
if (cl1 == cl2)
return cl1;
if (cl1.isEmpty() || cl2.isEmpty())
return List.nil();
if (cl1.head.tsym.precedes(cl2.head.tsym, this))
return intersect(cl1.tail, cl2);
if (cl2.head.tsym.precedes(cl1.head.tsym, this))
return intersect(cl1, cl2.tail);
if (isSameType(cl1.head, cl2.head))
return intersect(cl1.tail, cl2.tail).prepend(cl1.head);
if (cl1.head.tsym == cl2.head.tsym &&
cl1.head.tag == CLASS && cl2.head.tag == CLASS) {
if (cl1.head.isParameterized() && cl2.head.isParameterized()) {
Type merge = merge(cl1.head,cl2.head);
return intersect(cl1.tail, cl2.tail).prepend(merge);
}
if (cl1.head.isRaw() || cl2.head.isRaw())
return intersect(cl1.tail, cl2.tail).prepend(erasure(cl1.head));
}
return intersect(cl1.tail, cl2.tail);
}
示例5: processAnnotations
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
@Override
public void processAnnotations(List<JCTree.JCCompilationUnit> roots, Collection<String> classnames) {
if (roots.isEmpty()) {
super.processAnnotations(roots, classnames);
} else {
setOrigin(roots.head.sourcefile.toUri().toString());
try {
super.processAnnotations(roots, classnames);
} finally {
setOrigin("");
}
}
}
示例6: comment
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/**
* Preserve classic semantics - if multiple javadocs are found on the token
* the last one is returned
*/
public Comment comment(Comment.CommentStyle style) {
List<Comment> comments = getComments(Comment.CommentStyle.JAVADOC);
return comments.isEmpty() ?
null :
comments.head;
}
示例7: appendInitTypeAttributes
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
public SymbolMetadata appendInitTypeAttributes(List<Attribute.TypeCompound> l) {
if (l.isEmpty()) {
; // no-op
} else if (init_type_attributes.isEmpty()) {
init_type_attributes = l;
} else {
init_type_attributes = init_type_attributes.appendList(l);
}
return this;
}
示例8: makeOuterThis
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/** Construct a tree that represents the outer instance
* <C.this>. Never pick the current `this'.
* @param pos The source code position to be used for the tree.
* @param c The qualifier class.
*/
JCExpression makeOuterThis(DiagnosticPosition pos, TypeSymbol c) {
List<VarSymbol> ots = outerThisStack;
if (ots.isEmpty()) {
log.error(pos, "no.encl.instance.of.type.in.scope", c);
Assert.error();
return makeNull();
}
VarSymbol ot = ots.head;
JCExpression tree = access(make.at(pos).Ident(ot));
TypeSymbol otc = ot.type.tsym;
while (otc != c) {
do {
ots = ots.tail;
if (ots.isEmpty()) {
log.error(pos,
"no.encl.instance.of.type.in.scope",
c);
Assert.error(); // should have been caught in Attr
return tree;
}
ot = ots.head;
} while (ot.owner != otc);
if (otc.owner.kind != PCK && !otc.hasOuterInstance()) {
chk.earlyRefError(pos, c);
Assert.error(); // should have been caught in Attr
return makeNull();
}
tree = access(make.at(pos).Select(tree, ot));
otc = ot.type.tsym;
}
return tree;
}
示例9: findTypeCompoundPosition
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
private void findTypeCompoundPosition(JCTree tree, JCTree frame, List<Attribute.TypeCompound> annotations) {
if (!annotations.isEmpty()) {
final TypeAnnotationPosition p =
resolveFrame(tree, frame, frames, currentLambda, 0, new ListBuffer<>());
for (TypeCompound tc : annotations)
tc.position = p;
}
}
示例10: appendClassInitTypeAttributes
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
public SymbolMetadata appendClassInitTypeAttributes(List<Attribute.TypeCompound> l) {
if (l.isEmpty()) {
// no-op
} else if (clinit_type_attributes.isEmpty()) {
clinit_type_attributes = l;
} else {
clinit_type_attributes = clinit_type_attributes.appendList(l);
}
return this;
}
示例11: JCLambda
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
public JCLambda(List<JCVariableDecl> params,
JCTree body) {
this.params = params;
this.body = body;
if (params.isEmpty() ||
params.head.vartype != null) {
paramKind = ParameterKind.EXPLICIT;
} else {
paramKind = ParameterKind.IMPLICIT;
}
}
示例12: hasSameBounds
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/**
* Does t have the same bounds for quantified variables as s?
*/
boolean hasSameBounds(ForAll t, ForAll s) {
List<Type> l1 = t.tvars;
List<Type> l2 = s.tvars;
while (l1.nonEmpty() && l2.nonEmpty() &&
isSameType(l1.head.getUpperBound(),
subst(l2.head.getUpperBound(),
s.tvars,
t.tvars))) {
l1 = l1.tail;
l2 = l2.tail;
}
return l1.isEmpty() && l2.isEmpty();
}
示例13: insert
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/**
* Insert a type in a closure
*/
public List<Type> insert(List<Type> cl, Type t) {
if (cl.isEmpty() || t.tsym.precedes(cl.head.tsym, this)) {
return cl.prepend(t);
} else if (cl.head.tsym.precedes(t.tsym, this)) {
return insert(cl.tail, t).prepend(cl.head);
} else {
return cl;
}
}
示例14: union
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/**
* Form the union of two closures
*/
public List<Type> union(List<Type> cl1, List<Type> cl2) {
if (cl1.isEmpty()) {
return cl2;
} else if (cl2.isEmpty()) {
return cl1;
} else if (cl1.head.tsym.precedes(cl2.head.tsym, this)) {
return union(cl1.tail, cl2).prepend(cl1.head);
} else if (cl2.head.tsym.precedes(cl1.head.tsym, this)) {
return union(cl1, cl2.tail).prepend(cl2.head);
} else {
return union(cl1.tail, cl2.tail).prepend(cl1.head);
}
}
示例15: makeOwnerThisN
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/**
* Similar to makeOwnerThis but will never pick "this".
*/
JCExpression makeOwnerThisN(DiagnosticPosition pos, Symbol sym, boolean preciseMatch) {
Symbol c = sym.owner;
List<VarSymbol> ots = outerThisStack;
if (ots.isEmpty()) {
log.error(pos, "no.encl.instance.of.type.in.scope", c);
Assert.error();
return makeNull();
}
VarSymbol ot = ots.head;
JCExpression tree = access(make.at(pos).Ident(ot));
TypeSymbol otc = ot.type.tsym;
while (!(preciseMatch ? sym.isMemberOf(otc, types) : otc.isSubClass(sym.owner, types))) {
do {
ots = ots.tail;
if (ots.isEmpty()) {
log.error(pos,
"no.encl.instance.of.type.in.scope",
c);
Assert.error();
return tree;
}
ot = ots.head;
} while (ot.owner != otc);
tree = access(make.at(pos).Select(tree, ot));
otc = ot.type.tsym;
}
return tree;
}