本文整理汇总了Java中com.sun.tools.javac.code.Type.noType方法的典型用法代码示例。如果您正苦于以下问题:Java Type.noType方法的具体用法?Java Type.noType怎么用?Java Type.noType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.code.Type
的用法示例。
在下文中一共展示了Type.noType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: speculativeType
import com.sun.tools.javac.code.Type; //导入方法依赖的package包/类
@Override
Type speculativeType(Symbol msym, MethodResolutionPhase phase) {
if (pertinentToApplicability) {
for (Map.Entry<ResultInfo, Type> _entry : speculativeTypes.entrySet()) {
DeferredAttrContext deferredAttrContext = _entry.getKey().checkContext.deferredAttrContext();
if (deferredAttrContext.phase == phase && deferredAttrContext.msym == msym) {
return _entry.getValue();
}
}
return Type.noType;
} else {
return super.speculativeType(msym, phase);
}
}
示例2: Operators
import com.sun.tools.javac.code.Type; //导入方法依赖的package包/类
protected Operators(Context context) {
context.put(operatorsKey, this);
syms = Symtab.instance(context);
names = Names.instance(context);
log = Log.instance(context);
types = Types.instance(context);
noOpSymbol = new OperatorSymbol(names.empty, Type.noType, -1, syms.noSymbol);
initOperatorNames();
initUnaryOperators();
initBinaryOperators();
}
示例3: makeTwrBlock
import com.sun.tools.javac.code.Type; //导入方法依赖的package包/类
private JCBlock makeTwrBlock(
List<JCTree> resources, JCBlock block,
boolean finallyCanCompleteNormally, int depth) {
if (resources.isEmpty())
return block;
// Add resource declaration or expression to block statements
ListBuffer<JCStatement> stats = new ListBuffer<>();
JCTree resource = resources.head;
JCExpression expr;
if (resource instanceof JCVariableDecl) {
JCVariableDecl var = (JCVariableDecl) resource;
if (var.sym == null) var.sym = new VarSymbol(0, var.name, var.type == null ? Type.noType : var.type,
var.type == null ? symtab.noSymbol : var.type.tsym);
expr = make.Ident(var.sym);
expr.setType(resource.type);
stats.add(var);
} else {
Assert.check(resource instanceof JCExpression);
VarSymbol syntheticTwrVar =
new VarSymbol(SYNTHETIC | FINAL,
makeSyntheticName(names.fromString("twrVar" + depth), twrVars),
(resource.type.hasTag(BOT)) ?
symtab.autoCloseableType : resource.type,
currentMethodSym);
twrVars.enter(syntheticTwrVar);
JCVariableDecl syntheticTwrVarDecl =
make.VarDef(syntheticTwrVar, (JCExpression) resource);
expr = make.Ident(syntheticTwrVar);
stats.add(syntheticTwrVarDecl);
}
// Add primaryException declaration
VarSymbol primaryException =
new VarSymbol(SYNTHETIC,
makeSyntheticName(names.fromString("primaryException" +
depth), twrVars),
symtab.throwableType,
currentMethodSym);
twrVars.enter(primaryException);
JCVariableDecl primaryExceptionTreeDecl = make.VarDef(primaryException, makeNull());
stats.add(primaryExceptionTreeDecl);
// Create catch clause that saves exception and then rethrows it
VarSymbol param =
new VarSymbol(FINAL | SYNTHETIC,
names.fromString("t" + target.syntheticNameChar()),
symtab.throwableType,
currentMethodSym);
JCVariableDecl paramTree = make.VarDef(param, null);
JCStatement assign = make.Assignment(primaryException, make.Ident(param));
JCStatement rethrowStat = make.Throw(make.Ident(param));
JCBlock catchBlock = make.Block(0L, List.of(assign, rethrowStat));
JCCatch catchClause = make.Catch(paramTree, catchBlock);
int oldPos = make.pos;
make.at(TreeInfo.endPos(block));
JCBlock finallyClause = makeFinClause(primaryException, expr);
make.at(oldPos);
JCTry outerTry = make.Try(makeTwrBlock(resources.tail, block,
finallyCanCompleteNormally, depth + 1),
List.of(catchClause),
finallyClause);
outerTry.finallyCanCompleteNormally = finallyCanCompleteNormally;
stats.add(outerTry);
return make.Block(0L, stats.toList());
}
示例4: getTypeByName
import com.sun.tools.javac.code.Type; //导入方法依赖的package包/类
Type getTypeByName(String typeName, List<Type> tparams) {
return new Type.ClassType(
Type.noType,
tparams,
new Symbol.ClassSymbol(0, names.fromString(typeName), null));
}
示例5: Class
import com.sun.tools.javac.code.Type; //导入方法依赖的package包/类
public ClassType Class(long flags, Type... typeArgs) {
ClassSymbol csym = new ClassSymbol(flags, syntheticName(), predef.noSymbol);
csym.type = new ClassType(Type.noType, List.from(typeArgs), csym);
((ClassType)csym.type).supertype_field = predef.objectType;
return (ClassType)csym.type;
}