本文整理汇总了Java中com.sun.tools.javac.comp.Infer.InferenceContext类的典型用法代码示例。如果您正苦于以下问题:Java InferenceContext类的具体用法?Java InferenceContext怎么用?Java InferenceContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InferenceContext类属于com.sun.tools.javac.comp.Infer包,在下文中一共展示了InferenceContext类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reportMC
import com.sun.tools.javac.comp.Infer.InferenceContext; //导入依赖的package包/类
protected void reportMC(DiagnosticPosition pos, MethodCheckDiag diag, InferenceContext inferenceContext, Object... args) {
boolean inferDiag = inferenceContext != infer.emptyContext;
InapplicableMethodException ex = inferDiag ?
infer.inferenceException : inapplicableMethodException;
if (inferDiag && (!diag.inferKey.equals(diag.basicKey))) {
Object[] args2 = new Object[args.length + 1];
System.arraycopy(args, 0, args2, 1, args.length);
args2[0] = inferenceContext.inferenceVars();
args = args2;
}
String key = inferDiag ? diag.inferKey : diag.basicKey;
throw ex.setMessage(diags.create(DiagnosticType.FRAGMENT, log.currentSource(), pos, key, args));
}
示例2: unboundLookup
import com.sun.tools.javac.comp.Infer.InferenceContext; //导入依赖的package包/类
@Override
ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
if (TreeInfo.isStaticSelector(referenceTree.expr, names) &&
argtypes.nonEmpty() &&
(argtypes.head.hasTag(NONE) ||
types.isSubtypeUnchecked(inferenceContext.asUndetVar(argtypes.head), site))) {
return new UnboundMethodReferenceLookupHelper(referenceTree, name,
site, argtypes, typeargtypes, maxPhase);
} else {
return super.unboundLookup(inferenceContext);
}
}
示例3: deferredAttrContext
import com.sun.tools.javac.comp.Infer.InferenceContext; //导入依赖的package包/类
DeferredAttrContext deferredAttrContext(Symbol sym, InferenceContext inferenceContext, ResultInfo pendingResult, Warner warn) {
DeferredAttrContext parent = (pendingResult == null)
? deferredAttr.emptyDeferredAttrContext
: pendingResult.checkContext.deferredAttrContext();
return deferredAttr.new DeferredAttrContext(attrMode, sym, step,
inferenceContext, parent, warn);
}
示例4: DeferredAttrContext
import com.sun.tools.javac.comp.Infer.InferenceContext; //导入依赖的package包/类
DeferredAttrContext(AttrMode mode, Symbol msym, MethodResolutionPhase phase,
InferenceContext inferenceContext, DeferredAttrContext parent, Warner warn) {
this.mode = mode;
this.msym = msym;
this.phase = phase;
this.parent = parent;
this.warn = warn;
this.inferenceContext = inferenceContext;
}
示例5: unboundLookup
import com.sun.tools.javac.comp.Infer.InferenceContext; //导入依赖的package包/类
@Override
ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
if (TreeInfo.isStaticSelector(referenceTree.expr, names) &&
argtypes.nonEmpty() &&
(argtypes.head.hasTag(NONE) ||
types.isSubtypeUnchecked(inferenceContext.asFree(argtypes.head), site))) {
return new UnboundMethodReferenceLookupHelper(referenceTree, name,
site, argtypes, typeargtypes, maxPhase);
} else {
return super.unboundLookup(inferenceContext);
}
}
示例6: checkAccessibleTypes
import com.sun.tools.javac.comp.Infer.InferenceContext; //导入依赖的package包/类
private void checkAccessibleTypes(final DiagnosticPosition pos, final Env<AttrContext> env,
final InferenceContext inferenceContext, final Type... ts) {
checkAccessibleTypes(pos, env, inferenceContext, List.from(ts));
}
示例7: MethodReferenceCheck
import com.sun.tools.javac.comp.Infer.InferenceContext; //导入依赖的package包/类
MethodReferenceCheck(InferenceContext pendingInferenceContext) {
this.pendingInferenceContext = pendingInferenceContext;
}
示例8: compatible
import com.sun.tools.javac.comp.Infer.InferenceContext; //导入依赖的package包/类
public boolean compatible(Type found, Type req, Warner warn) {
InferenceContext inferenceContext = deferredAttrContext.inferenceContext;
return strict ?
types.isSubtypeUnchecked(inferenceContext.asUndetVar(found), inferenceContext.asUndetVar(req), warn) :
types.isConvertible(inferenceContext.asUndetVar(found), inferenceContext.asUndetVar(req), warn);
}
示例9: inferenceContext
import com.sun.tools.javac.comp.Infer.InferenceContext; //导入依赖的package包/类
public InferenceContext inferenceContext() {
return deferredAttrContext.inferenceContext;
}
示例10: resolveMemberReferenceByArity
import com.sun.tools.javac.comp.Infer.InferenceContext; //导入依赖的package包/类
Symbol resolveMemberReferenceByArity(Env<AttrContext> env,
JCMemberReference referenceTree,
Type site,
Name name,
List<Type> argtypes,
InferenceContext inferenceContext) {
boolean isStaticSelector = TreeInfo.isStaticSelector(referenceTree.expr, names);
site = types.capture(site);
ReferenceLookupHelper boundLookupHelper = makeReferenceLookupHelper(
referenceTree, site, name, argtypes, null, VARARITY);
//step 1 - bound lookup
Env<AttrContext> boundEnv = env.dup(env.tree, env.info.dup());
Symbol boundSym = lookupMethod(boundEnv, env.tree.pos(), site.tsym,
arityMethodCheck, boundLookupHelper);
if (isStaticSelector &&
!name.equals(names.init) &&
!boundSym.isStatic() &&
boundSym.kind < ERRONEOUS) {
boundSym = methodNotFound;
}
//step 2 - unbound lookup
Symbol unboundSym = methodNotFound;
ReferenceLookupHelper unboundLookupHelper = null;
Env<AttrContext> unboundEnv = env.dup(env.tree, env.info.dup());
if (isStaticSelector) {
unboundLookupHelper = boundLookupHelper.unboundLookup(inferenceContext);
unboundSym = lookupMethod(unboundEnv, env.tree.pos(), site.tsym,
arityMethodCheck, unboundLookupHelper);
if (unboundSym.isStatic() &&
unboundSym.kind < ERRONEOUS) {
unboundSym = methodNotFound;
}
}
//merge results
Symbol bestSym = choose(boundSym, unboundSym);
env.info.pendingResolutionPhase = bestSym == unboundSym ?
unboundEnv.info.pendingResolutionPhase :
boundEnv.info.pendingResolutionPhase;
return bestSym;
}
示例11: inferenceContext
import com.sun.tools.javac.comp.Infer.InferenceContext; //导入依赖的package包/类
public Infer.InferenceContext inferenceContext() {
return enclosingContext.inferenceContext();
}
示例12: process
import com.sun.tools.javac.comp.Infer.InferenceContext; //导入依赖的package包/类
/**
* Process a deferred attribution node.
* Invariant: a stuck node cannot be processed.
*/
@SuppressWarnings("fallthrough")
boolean process(final DeferredAttrContext deferredAttrContext) {
switch (deferredAttrContext.mode) {
case SPECULATIVE:
if (deferredStuckPolicy.isStuck()) {
dt.check(resultInfo, dummyStuckPolicy, new StructuralStuckChecker());
return true;
} else {
Assert.error("Cannot get here");
}
case CHECK:
if (deferredStuckPolicy.isStuck()) {
//stuck expression - see if we can propagate
if (deferredAttrContext.parent != emptyDeferredAttrContext &&
Type.containsAny(deferredAttrContext.parent.inferenceContext.inferencevars,
List.from(deferredStuckPolicy.stuckVars()))) {
deferredAttrContext.parent.addDeferredAttrNode(dt,
resultInfo.dup(new Check.NestedCheckContext(resultInfo.checkContext) {
@Override
public InferenceContext inferenceContext() {
return deferredAttrContext.parent.inferenceContext;
}
@Override
public DeferredAttrContext deferredAttrContext() {
return deferredAttrContext.parent;
}
}), deferredStuckPolicy);
dt.tree.type = Type.stuckType;
return true;
} else {
return false;
}
} else {
Assert.check(!deferredAttrContext.insideOverloadPhase(),
"attribution shouldn't be happening here");
ResultInfo instResultInfo =
resultInfo.dup(deferredAttrContext.inferenceContext.asInstType(resultInfo.pt));
dt.check(instResultInfo, dummyStuckPolicy, basicCompleter);
return true;
}
default:
throw new AssertionError("Bad mode");
}
}
示例13: typesInferred
import com.sun.tools.javac.comp.Infer.InferenceContext; //导入依赖的package包/类
@Override
public void typesInferred(InferenceContext inferenceContext) {
stuckVars.clear();
}