com.sun.tools.javac.comp.Attr.ResultInfo Java Examples

The following examples show how to use com.sun.tools.javac.comp.Attr.ResultInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private ResultInfo methodCheckResult(final boolean varargsCheck, Type to,
        final DeferredAttr.DeferredAttrContext deferredAttrContext, Warner rsWarner) {
    CheckContext checkContext = new MethodCheckContext(!deferredAttrContext.phase.isBoxingRequired(), deferredAttrContext, rsWarner) {
        MethodCheckDiag methodDiag = varargsCheck ?
                         MethodCheckDiag.VARARG_MISMATCH : MethodCheckDiag.ARG_MISMATCH;

        @Override
        public boolean compatible(Type found, Type req, Warner warn) {
            found = pendingInferenceContext.asUndetVar(found);
            if (found.hasTag(UNDETVAR) && req.isPrimitive()) {
                req = types.boxedClass(req).type;
            }
            return super.compatible(found, req, warn);
        }

        @Override
        public void report(DiagnosticPosition pos, JCDiagnostic details) {
            reportMC(pos, methodDiag, deferredAttrContext.inferenceContext, details);
        }
    };
    return new MethodResultInfo(to, checkContext);
}
 
Example #2
Source File: Resolve.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/** Same but returns null instead throwing a NoInstanceException
 */
Type instantiate(Env<AttrContext> env,
                 Type site,
                 Symbol m,
                 ResultInfo resultInfo,
                 List<Type> argtypes,
                 List<Type> typeargtypes,
                 boolean allowBoxing,
                 boolean useVarargs,
                 Warner warn) {
    try {
        return rawInstantiate(env, site, m, resultInfo, argtypes, typeargtypes,
                              allowBoxing, useVarargs, warn);
    } catch (InapplicableMethodException ex) {
        return null;
    }
}
 
Example #3
Source File: Resolve.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
Type checkMethod(Env<AttrContext> env,
                 Type site,
                 Symbol m,
                 ResultInfo resultInfo,
                 List<Type> argtypes,
                 List<Type> typeargtypes,
                 Warner warn) {
    MethodResolutionContext prevContext = currentResolutionContext;
    try {
        currentResolutionContext = new MethodResolutionContext();
        currentResolutionContext.attrMode = DeferredAttr.AttrMode.CHECK;
        if (env.tree.hasTag(JCTree.Tag.REFERENCE)) {
            //method/constructor references need special check class
            //to handle inference variables in 'argtypes' (might happen
            //during an unsticking round)
            currentResolutionContext.methodCheck =
                    new MethodReferenceCheck(resultInfo.checkContext.inferenceContext());
        }
        MethodResolutionPhase step = currentResolutionContext.step = env.info.pendingResolutionPhase;
        return rawInstantiate(env, site, m, resultInfo, argtypes, typeargtypes,
                step.isBoxingRequired(), step.isVarargsRequired(), warn);
    }
    finally {
        currentResolutionContext = prevContext;
    }
}
 
Example #4
Source File: DeferredAttr.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
<Z> JCTree attribSpeculative(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo, TreeCopier<Z> deferredCopier,
                             Function<JCTree, DeferredDiagnosticHandler> diagHandlerCreator,
                             LocalCacheContext localCache) {
    final JCTree newTree = deferredCopier.copy(tree);
    Env<AttrContext> speculativeEnv = env.dup(newTree, env.info.dup(env.info.scope.dupUnshared(env.info.scope.owner)));
    speculativeEnv.info.isSpeculative = true;
    Log.DeferredDiagnosticHandler deferredDiagnosticHandler = diagHandlerCreator.apply(newTree);
    try {
        attr.attribTree(newTree, speculativeEnv, resultInfo);
        return newTree;
    } finally {
        new UnenterScanner(env.toplevel.modle).scan(newTree);
        log.popDiagnosticHandler(deferredDiagnosticHandler);
        if (localCache != null) {
            localCache.leave();
        }
    }
}
 
Example #5
Source File: Resolve.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private ResultInfo methodCheckResult(final boolean varargsCheck, Type to,
        final DeferredAttr.DeferredAttrContext deferredAttrContext, Warner rsWarner) {
    CheckContext checkContext = new MethodCheckContext(!deferredAttrContext.phase.isBoxingRequired(), deferredAttrContext, rsWarner) {
        MethodCheckDiag methodDiag = varargsCheck ?
                         MethodCheckDiag.VARARG_MISMATCH : MethodCheckDiag.ARG_MISMATCH;

        @Override
        public boolean compatible(Type found, Type req, Warner warn) {
            found = pendingInferenceContext.asUndetVar(found);
            if (found.hasTag(UNDETVAR) && req.isPrimitive()) {
                req = types.boxedClass(req).type;
            }
            return super.compatible(found, req, warn);
        }

        @Override
        public void report(DiagnosticPosition pos, JCDiagnostic details) {
            reportMC(pos, methodDiag, deferredAttrContext.inferenceContext, details);
        }
    };
    return new MethodResultInfo(to, checkContext);
}
 
Example #6
Source File: Resolve.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private ResultInfo methodCheckResult(final boolean varargsCheck, Type to,
        final DeferredAttr.DeferredAttrContext deferredAttrContext, Warner rsWarner) {
    CheckContext checkContext = new MethodCheckContext(!deferredAttrContext.phase.isBoxingRequired(), deferredAttrContext, rsWarner) {
        MethodCheckDiag methodDiag = varargsCheck ?
                         MethodCheckDiag.VARARG_MISMATCH : MethodCheckDiag.ARG_MISMATCH;

        @Override
        public boolean compatible(Type found, Type req, Warner warn) {
            found = pendingInferenceContext.asFree(found);
            req = infer.returnConstraintTarget(found, req);
            return super.compatible(found, req, warn);
        }

        @Override
        public void report(DiagnosticPosition pos, JCDiagnostic details) {
            reportMC(pos, methodDiag, deferredAttrContext.inferenceContext, details);
        }
    };
    return new MethodResultInfo(to, checkContext);
}
 
Example #7
Source File: DeferredAttr.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private Type check(ResultInfo resultInfo, DeferredStuckPolicy deferredStuckPolicy,
        DeferredTypeCompleter deferredTypeCompleter) {
    DeferredAttrContext deferredAttrContext =
            resultInfo.checkContext.deferredAttrContext();
    Assert.check(deferredAttrContext != emptyDeferredAttrContext);
    if (deferredStuckPolicy.isStuck()) {
        deferredAttrContext.addDeferredAttrNode(this, resultInfo, deferredStuckPolicy);
        return Type.noType;
    } else {
        try {
            return deferredTypeCompleter.complete(this, resultInfo, deferredAttrContext);
        } finally {
            mode = deferredAttrContext.mode;
        }
    }
}
 
Example #8
Source File: ArgumentAttr.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
final public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
    Assert.check(dt == this);
    if (deferredAttrContext.mode == AttrMode.SPECULATIVE) {
        Type t = (resultInfo.pt == Type.recoveryType) ?
                deferredAttr.basicCompleter.complete(dt, resultInfo, deferredAttrContext) :
                overloadCheck(resultInfo, deferredAttrContext);
        speculativeTypes.put(resultInfo, t);
        return t;
    } else {
        if (!env.info.isSpeculative) {
            argumentTypeCache.remove(new UniquePos(dt.tree));
        }
        return deferredAttr.basicCompleter.complete(dt, resultInfo, deferredAttrContext);
    }
}
 
Example #9
Source File: Resolve.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/** Same but returns null instead throwing a NoInstanceException
 */
Type instantiate(Env<AttrContext> env,
                 Type site,
                 Symbol m,
                 ResultInfo resultInfo,
                 List<Type> argtypes,
                 List<Type> typeargtypes,
                 boolean allowBoxing,
                 boolean useVarargs,
                 Warner warn) {
    try {
        return rawInstantiate(env, site, m, resultInfo, argtypes, typeargtypes,
                              allowBoxing, useVarargs, warn);
    } catch (InapplicableMethodException ex) {
        return null;
    }
}
 
Example #10
Source File: DeferredAttr.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private Type check(ResultInfo resultInfo, DeferredStuckPolicy deferredStuckPolicy,
        DeferredTypeCompleter deferredTypeCompleter) {
    DeferredAttrContext deferredAttrContext =
            resultInfo.checkContext.deferredAttrContext();
    Assert.check(deferredAttrContext != emptyDeferredAttrContext);
    if (deferredStuckPolicy.isStuck()) {
        deferredAttrContext.addDeferredAttrNode(this, resultInfo, deferredStuckPolicy);
        return Type.noType;
    } else {
        try {
            return deferredTypeCompleter.complete(this, resultInfo, deferredAttrContext);
        } finally {
            mode = deferredAttrContext.mode;
        }
    }
}
 
Example #11
Source File: Resolve.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private ResultInfo methodCheckResult(final boolean varargsCheck, Type to,
        final DeferredAttr.DeferredAttrContext deferredAttrContext, Warner rsWarner) {
    CheckContext checkContext = new MethodCheckContext(!deferredAttrContext.phase.isBoxingRequired(), deferredAttrContext, rsWarner) {
        MethodCheckDiag methodDiag = varargsCheck ?
                         MethodCheckDiag.VARARG_MISMATCH : MethodCheckDiag.ARG_MISMATCH;

        @Override
        public boolean compatible(Type found, Type req, Warner warn) {
            found = pendingInferenceContext.asUndetVar(found);
            if (found.hasTag(UNDETVAR) && req.isPrimitive()) {
                req = types.boxedClass(req).type;
            }
            return super.compatible(found, req, warn);
        }

        @Override
        public void report(DiagnosticPosition pos, JCDiagnostic details) {
            reportMC(pos, methodDiag, deferredAttrContext.inferenceContext, details);
        }
    };
    return new MethodResultInfo(to, checkContext);
}
 
Example #12
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/** Same but returns null instead throwing a NoInstanceException
 */
Type instantiate(Env<AttrContext> env,
                 Type site,
                 Symbol m,
                 ResultInfo resultInfo,
                 List<Type> argtypes,
                 List<Type> typeargtypes,
                 boolean allowBoxing,
                 boolean useVarargs,
                 Warner warn) {
    try {
        return rawInstantiate(env, site, m, resultInfo, argtypes, typeargtypes,
                              allowBoxing, useVarargs, warn);
    } catch (InapplicableMethodException ex) {
        return null;
    }
}
 
Example #13
Source File: DeferredAttr.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private Type check(ResultInfo resultInfo, DeferredStuckPolicy deferredStuckPolicy,
        DeferredTypeCompleter deferredTypeCompleter) {
    DeferredAttrContext deferredAttrContext =
            resultInfo.checkContext.deferredAttrContext();
    Assert.check(deferredAttrContext != emptyDeferredAttrContext);
    if (deferredStuckPolicy.isStuck()) {
        deferredAttrContext.addDeferredAttrNode(this, resultInfo, deferredStuckPolicy);
        return Type.noType;
    } else {
        try {
            return deferredTypeCompleter.complete(this, resultInfo, deferredAttrContext);
        } finally {
            mode = deferredAttrContext.mode;
        }
    }
}
 
Example #14
Source File: Resolve.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
Type checkMethod(Env<AttrContext> env,
                 Type site,
                 Symbol m,
                 ResultInfo resultInfo,
                 List<Type> argtypes,
                 List<Type> typeargtypes,
                 Warner warn) {
    MethodResolutionContext prevContext = currentResolutionContext;
    try {
        currentResolutionContext = new MethodResolutionContext();
        currentResolutionContext.attrMode = DeferredAttr.AttrMode.CHECK;
        if (env.tree.hasTag(JCTree.Tag.REFERENCE)) {
            //method/constructor references need special check class
            //to handle inference variables in 'argtypes' (might happen
            //during an unsticking round)
            currentResolutionContext.methodCheck =
                    new MethodReferenceCheck(resultInfo.checkContext.inferenceContext());
        }
        MethodResolutionPhase step = currentResolutionContext.step = env.info.pendingResolutionPhase;
        return rawInstantiate(env, site, m, resultInfo, argtypes, typeargtypes,
                step.isBoxingRequired(), step.isVarargsRequired(), warn);
    }
    finally {
        currentResolutionContext = prevContext;
    }
}
 
Example #15
Source File: Resolve.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private ResultInfo methodCheckResult(final boolean varargsCheck, Type to,
        final DeferredAttr.DeferredAttrContext deferredAttrContext, Warner rsWarner) {
    CheckContext checkContext = new MethodCheckContext(!deferredAttrContext.phase.isBoxingRequired(), deferredAttrContext, rsWarner) {
        MethodCheckDiag methodDiag = varargsCheck ?
                         MethodCheckDiag.VARARG_MISMATCH : MethodCheckDiag.ARG_MISMATCH;

        @Override
        public boolean compatible(Type found, Type req, Warner warn) {
            found = pendingInferenceContext.asUndetVar(found);
            if (found.hasTag(UNDETVAR) && req.isPrimitive()) {
                req = types.boxedClass(req).type;
            }
            return super.compatible(found, req, warn);
        }

        @Override
        public void report(DiagnosticPosition pos, JCDiagnostic details) {
            reportMC(pos, methodDiag, deferredAttrContext.inferenceContext, details);
        }
    };
    return new MethodResultInfo(to, checkContext);
}
 
Example #16
Source File: DeferredAttr.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private Type check(ResultInfo resultInfo, DeferredStuckPolicy deferredStuckPolicy,
        DeferredTypeCompleter deferredTypeCompleter) {
    DeferredAttrContext deferredAttrContext =
            resultInfo.checkContext.deferredAttrContext();
    Assert.check(deferredAttrContext != emptyDeferredAttrContext);
    if (deferredStuckPolicy.isStuck()) {
        deferredAttrContext.addDeferredAttrNode(this, resultInfo, deferredStuckPolicy);
        return Type.noType;
    } else {
        try {
            return deferredTypeCompleter.complete(this, resultInfo, deferredAttrContext);
        } finally {
            mode = deferredAttrContext.mode;
        }
    }
}
 
Example #17
Source File: DeferredAttr.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected DeferredAttr(Context context) {
    context.put(deferredAttrKey, this);
    attr = Attr.instance(context);
    chk = Check.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    enter = Enter.instance(context);
    infer = Infer.instance(context);
    rs = Resolve.instance(context);
    log = Log.instance(context);
    syms = Symtab.instance(context);
    make = TreeMaker.instance(context);
    types = Types.instance(context);
    flow = Flow.instance(context);
    names = Names.instance(context);
    stuckTree = make.Ident(names.empty).setType(Type.stuckType);
    typeEnvs = TypeEnvs.instance(context);
    emptyDeferredAttrContext =
        new DeferredAttrContext(AttrMode.CHECK, null, MethodResolutionPhase.BOX, infer.emptyContext, null, null) {
            @Override
            void addDeferredAttrNode(DeferredType dt, ResultInfo ri, DeferredStuckPolicy deferredStuckPolicy) {
                Assert.error("Empty deferred context!");
            }
            @Override
            void complete() {
                Assert.error("Empty deferred context!");
            }

            @Override
            public String toString() {
                return "Empty deferred context!";
            }
        };
}
 
Example #18
Source File: Resolve.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void argumentsAcceptable(final Env<AttrContext> env,
                            DeferredAttrContext deferredAttrContext,
                            List<Type> formals1,
                            List<Type> formals2,
                            Warner warn) {
    formals2 = adjustArgs(formals2, deferredAttrContext.msym, formals1.length(), deferredAttrContext.phase.isVarargsRequired());
    while (formals2.nonEmpty()) {
        ResultInfo mresult = methodCheckResult(formals2.head, deferredAttrContext, warn, actuals.head);
        mresult.check(null, formals1.head);
        formals1 = formals1.tail;
        formals2 = formals2.tail;
        actuals = actuals.isEmpty() ? actuals : actuals.tail;
    }
}
 
Example #19
Source File: DeferredAttr.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check a deferred type against a potential target-type. Depending on
 * the current attribution mode, a normal vs. speculative attribution
 * round is performed on the underlying AST node. There can be only one
 * speculative round for a given target method symbol; moreover, a normal
 * attribution round must follow one or more speculative rounds.
 */
Type check(ResultInfo resultInfo) {
    DeferredStuckPolicy deferredStuckPolicy;
    if (resultInfo.pt.hasTag(NONE) || resultInfo.pt.isErroneous()) {
        deferredStuckPolicy = dummyStuckPolicy;
    } else if (resultInfo.checkContext.deferredAttrContext().mode == AttrMode.SPECULATIVE ||
            resultInfo.checkContext.deferredAttrContext().insideOverloadPhase()) {
        deferredStuckPolicy = new OverloadStuckPolicy(resultInfo, this);
    } else {
        deferredStuckPolicy = new CheckStuckPolicy(resultInfo, this);
    }
    return check(resultInfo, deferredStuckPolicy, basicCompleter);
}
 
Example #20
Source File: DeferredAttr.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
    this.resultInfo = resultInfo;
    this.inferenceContext = deferredAttrContext.inferenceContext;
    this.env = dt.env;
    dt.tree.accept(this);
    dt.speculativeCache.put(stuckTree, resultInfo);
    return Type.noType;
}
 
Example #21
Source File: DeferredAttr.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
    this.resultInfo = resultInfo;
    this.inferenceContext = deferredAttrContext.inferenceContext;
    this.env = dt.env;
    dt.tree.accept(this);
    dt.speculativeCache.put(stuckTree, resultInfo);
    return Type.noType;
}
 
Example #22
Source File: Resolve.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void argumentsAcceptable(final Env<AttrContext> env,
                            DeferredAttrContext deferredAttrContext,
                            List<Type> formals1,
                            List<Type> formals2,
                            Warner warn) {
    formals2 = adjustArgs(formals2, deferredAttrContext.msym, formals1.length(), deferredAttrContext.phase.isVarargsRequired());
    while (formals2.nonEmpty()) {
        ResultInfo mresult = methodCheckResult(formals2.head, deferredAttrContext, warn, actuals.head);
        mresult.check(null, formals1.head);
        formals1 = formals1.tail;
        formals2 = formals2.tail;
        actuals = actuals.isEmpty() ? actuals : actuals.tail;
    }
}
 
Example #23
Source File: DeferredAttr.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public CheckStuckPolicy(ResultInfo resultInfo, DeferredType dt) {
    this.pt = resultInfo.pt;
    this.inferenceContext = resultInfo.checkContext.inferenceContext();
    scan(dt.tree);
    if (!stuckVars.isEmpty()) {
        resultInfo.checkContext.inferenceContext()
                .addFreeTypeListener(List.from(stuckVars), this);
    }
}
 
Example #24
Source File: ArgumentAttr.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Checks a type in the speculative tree against a given result; the type can be either a plain
 * type or an argument type,in which case a more complex check is required.
 */
Type checkSpeculative(DiagnosticPosition pos, Type t, ResultInfo resultInfo) {
    if (t.hasTag(DEFERRED)) {
        return ((DeferredType)t).check(resultInfo);
    } else {
        return resultInfo.check(pos, t);
    }
}
 
Example #25
Source File: ArgumentAttr.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Checks a type in the speculative tree against a given result; the type can be either a plain
 * type or an argument type,in which case a more complex check is required.
 */
Type checkSpeculative(DiagnosticPosition pos, Type t, ResultInfo resultInfo) {
    if (t.hasTag(DEFERRED)) {
        return ((DeferredType)t).check(resultInfo);
    } else {
        return resultInfo.check(pos, t);
    }
}
 
Example #26
Source File: DeferredAttr.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check a deferred type against a potential target-type. Depending on
 * the current attribution mode, a normal vs. speculative attribution
 * round is performed on the underlying AST node. There can be only one
 * speculative round for a given target method symbol; moreover, a normal
 * attribution round must follow one or more speculative rounds.
 */
Type check(ResultInfo resultInfo) {
    DeferredStuckPolicy deferredStuckPolicy;
    if (resultInfo.pt.hasTag(NONE) || resultInfo.pt.isErroneous()) {
        deferredStuckPolicy = dummyStuckPolicy;
    } else if (resultInfo.checkContext.deferredAttrContext().mode == AttrMode.SPECULATIVE) {
        deferredStuckPolicy = new OverloadStuckPolicy(resultInfo, this);
    } else {
        deferredStuckPolicy = new CheckStuckPolicy(resultInfo, this);
    }
    return check(resultInfo, deferredStuckPolicy, basicCompleter);
}
 
Example #27
Source File: DeferredAttr.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Stores a speculative cache entry corresponding to given symbol
 * and resolution phase
 */
void put(JCTree speculativeTree, ResultInfo resultInfo) {
    Symbol msym = resultInfo.checkContext.deferredAttrContext().msym;
    List<Entry> entries = cache.get(msym);
    if (entries == null) {
        entries = List.nil();
    }
    cache.put(msym, entries.prepend(new Entry(speculativeTree, resultInfo)));
}
 
Example #28
Source File: DeferredAttr.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
    this.resultInfo = resultInfo;
    this.inferenceContext = deferredAttrContext.inferenceContext;
    this.env = dt.env;
    dt.tree.accept(this);
    dt.speculativeCache.put(stuckTree, resultInfo);
    return Type.noType;
}
 
Example #29
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
Type checkMethod(Env<AttrContext> env,
                 Type site,
                 Symbol m,
                 ResultInfo resultInfo,
                 List<Type> argtypes,
                 List<Type> typeargtypes,
                 Warner warn) {
    MethodResolutionContext prevContext = currentResolutionContext;
    try {
        currentResolutionContext = new MethodResolutionContext();
        currentResolutionContext.attrMode = (resultInfo.pt == Infer.anyPoly) ?
                AttrMode.SPECULATIVE : DeferredAttr.AttrMode.CHECK;
        if (env.tree.hasTag(JCTree.Tag.REFERENCE)) {
            //method/constructor references need special check class
            //to handle inference variables in 'argtypes' (might happen
            //during an unsticking round)
            currentResolutionContext.methodCheck =
                    new MethodReferenceCheck(resultInfo.checkContext.inferenceContext());
        }
        MethodResolutionPhase step = currentResolutionContext.step = env.info.pendingResolutionPhase;
        return rawInstantiate(env, site, m, resultInfo, argtypes, typeargtypes,
                step.isBoxingRequired(), step.isVarargsRequired(), warn);
    }
    finally {
        currentResolutionContext = prevContext;
    }
}
 
Example #30
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void argumentsAcceptable(final Env<AttrContext> env,
                            DeferredAttrContext deferredAttrContext,
                            List<Type> formals1,
                            List<Type> formals2,
                            Warner warn) {
    formals2 = adjustArgs(formals2, deferredAttrContext.msym, formals1.length(), deferredAttrContext.phase.isVarargsRequired());
    while (formals2.nonEmpty()) {
        ResultInfo mresult = methodCheckResult(formals2.head, deferredAttrContext, warn, actuals.head);
        mresult.check(null, formals1.head);
        formals1 = formals1.tail;
        formals2 = formals2.tail;
        actuals = actuals.isEmpty() ? actuals : actuals.tail;
    }
}