Java Code Examples for com.sun.tools.javac.comp.Attr.ResultInfo#check()

The following examples show how to use com.sun.tools.javac.comp.Attr.ResultInfo#check() . 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: ArgumentAttr.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
Type overloadCheck(ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
    ResultInfo localInfo = resultInfo.dup(attr.conditionalContext(resultInfo.checkContext));
    if (speculativeTree.isStandalone()) {
        return localInfo.check(speculativeTree, speculativeTree.type);
    } else if (resultInfo.pt.hasTag(VOID)) {
        //this means we are returning a poly conditional from void-compatible lambda expression
        resultInfo.checkContext.report(tree, attr.diags.fragment("conditional.target.cant.be.void"));
        return attr.types.createErrorType(resultInfo.pt);
    } else {
        //poly
        checkSpeculative(speculativeTree.truepart, localInfo);
        checkSpeculative(speculativeTree.falsepart, localInfo);
        return localInfo.pt;
    }
}
 
Example 2
Source File: ArgumentAttr.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
Type overloadCheck(ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
    ResultInfo localInfo = resultInfo.dup(attr.conditionalContext(resultInfo.checkContext));
    if (speculativeTree.isStandalone()) {
        return localInfo.check(speculativeTree, speculativeTree.type);
    } else if (resultInfo.pt.hasTag(VOID)) {
        //this means we are returning a poly conditional from void-compatible lambda expression
        resultInfo.checkContext.report(tree, attr.diags.fragment(Fragments.ConditionalTargetCantBeVoid));
        return attr.types.createErrorType(resultInfo.pt);
    } else {
        //poly
        checkSpeculative(speculativeTree.truepart, localInfo);
        checkSpeculative(speculativeTree.falsepart, localInfo);
        return localInfo.pt;
    }
}
 
Example 3
Source File: Resolve.java    From TencentKona-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 4
Source File: Resolve.java    From openjdk-8-source 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 5
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 6
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;
    }
}
 
Example 7
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 8
Source File: Resolve.java    From openjdk-jdk8u-backup 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 9
Source File: ArgumentAttr.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
Type overloadCheck(ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
    Type mtype = methodType();
    ResultInfo localInfo = resultInfo(resultInfo);
    Type t;
    if (mtype != null && mtype.hasTag(METHOD) && mtype.isPartial()) {
        //poly invocation
        t = ((PartiallyInferredMethodType)mtype).check(localInfo);
    } else {
        //standalone invocation
        t = localInfo.check(tree.pos(), speculativeTree.type);
    }
    speculativeTypes.put(localInfo, t);
    return t;
}
 
Example 10
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 11
Source File: Resolve.java    From openjdk-jdk8u 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 12
Source File: Resolve.java    From jdk8u60 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 13
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 14
Source File: Resolve.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
void checkArg(DiagnosticPosition pos, boolean varargs, Type actual, Type formal, DeferredAttrContext deferredAttrContext, Warner warn) {
    ResultInfo mresult = methodCheckResult(varargs, formal, deferredAttrContext, warn);
    mresult.check(pos, actual);
}
 
Example 15
Source File: Resolve.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
void checkArg(DiagnosticPosition pos, boolean varargs, Type actual, Type formal, DeferredAttrContext deferredAttrContext, Warner warn) {
    ResultInfo mresult = methodCheckResult(varargs, formal, deferredAttrContext, warn);
    mresult.check(pos, actual);
}
 
Example 16
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
void checkArg(DiagnosticPosition pos, boolean varargs, Type actual, Type formal, DeferredAttrContext deferredAttrContext, Warner warn) {
    ResultInfo mresult = methodCheckResult(varargs, formal, deferredAttrContext, warn);
    mresult.check(pos, actual);
}
 
Example 17
Source File: Resolve.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
void checkArg(DiagnosticPosition pos, boolean varargs, Type actual, Type formal, DeferredAttrContext deferredAttrContext, Warner warn) {
    ResultInfo mresult = methodCheckResult(varargs, formal, deferredAttrContext, warn);
    mresult.check(pos, actual);
}
 
Example 18
Source File: Resolve.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
void checkArg(DiagnosticPosition pos, boolean varargs, Type actual, Type formal, DeferredAttrContext deferredAttrContext, Warner warn) {
    ResultInfo mresult = methodCheckResult(varargs, formal, deferredAttrContext, warn);
    mresult.check(pos, actual);
}
 
Example 19
Source File: Resolve.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
void checkArg(DiagnosticPosition pos, boolean varargs, Type actual, Type formal, DeferredAttrContext deferredAttrContext, Warner warn) {
    ResultInfo mresult = methodCheckResult(varargs, formal, deferredAttrContext, warn);
    mresult.check(pos, actual);
}
 
Example 20
Source File: Resolve.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
void checkArg(DiagnosticPosition pos, boolean varargs, Type actual, Type formal, DeferredAttrContext deferredAttrContext, Warner warn) {
    ResultInfo mresult = methodCheckResult(varargs, formal, deferredAttrContext, warn);
    mresult.check(pos, actual);
}