com.sun.tools.javac.comp.DeferredAttr.DeferredType Java Examples

The following examples show how to use com.sun.tools.javac.comp.DeferredAttr.DeferredType. 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
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 #2
Source File: Resolve.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean compatible(Type found, Type req, Warner warn) {
    if (!allowStructuralMostSpecific || actual == null) {
        return super.compatible(found, req, warn);
    } else {
        switch (actual.getTag()) {
            case DEFERRED:
                DeferredType dt = (DeferredType) actual;
                DeferredType.SpeculativeCache.Entry e = dt.speculativeCache.get(deferredAttrContext.msym, deferredAttrContext.phase);
                return (e == null || e.speculativeTree == deferredAttr.stuckTree)
                        ? super.compatible(found, req, warn) :
                          mostSpecific(found, req, e.speculativeTree, warn);
            default:
                return standaloneMostSpecific(found, req, actual, warn);
        }
    }
}
 
Example #3
Source File: Resolve.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public boolean compatible(Type found, Type req, Warner warn) {
    if (!allowStructuralMostSpecific || actual == null) {
        return super.compatible(found, req, warn);
    } else {
        switch (actual.getTag()) {
            case DEFERRED:
                DeferredType dt = (DeferredType) actual;
                DeferredType.SpeculativeCache.Entry e = dt.speculativeCache.get(deferredAttrContext.msym, deferredAttrContext.phase);
                return (e == null || e.speculativeTree == deferredAttr.stuckTree)
                        ? super.compatible(found, req, warn) :
                          mostSpecific(found, req, e.speculativeTree, warn);
            default:
                return standaloneMostSpecific(found, req, actual, warn);
        }
    }
}
 
Example #4
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 #5
Source File: Resolve.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Type typeOf(DeferredType dt) {
    Type res = super.typeOf(dt);
    if (!res.isErroneous()) {
        switch (TreeInfo.skipParens(dt.tree).getTag()) {
            case LAMBDA:
            case REFERENCE:
                return dt;
            case CONDEXPR:
                return res == Type.recoveryType ?
                        dt : res;
        }
    }
    return res;
}
 
Example #6
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Type check(DiagnosticPosition pos, Type found) {
    if (found.hasTag(DEFERRED)) {
        DeferredType dt = (DeferredType)found;
        return dt.check(this);
    } else {
        Type uResult = U(found);
        Type capturedType = pos == null || pos.getTree() == null ?
                types.capture(uResult) :
                checkContext.inferenceContext()
                    .cachedCapture(pos.getTree(), uResult, true);
        return super.check(pos, chk.checkNonVoid(pos, capturedType));
    }
}
 
Example #7
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public boolean compatible(Type found, Type req, Warner warn) {
    if (allowFunctionalInterfaceMostSpecific &&
            unrelatedFunctionalInterfaces(found, req) &&
            (actual != null && actual.getTag() == DEFERRED)) {
        DeferredType dt = (DeferredType) actual;
        JCTree speculativeTree = dt.speculativeTree(deferredAttrContext);
        if (speculativeTree != deferredAttr.stuckTree) {
            return functionalInterfaceMostSpecific(found, req, speculativeTree);
        }
    }
    return compatibleBySubtyping(found, req);
}
 
Example #8
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private JCExpression asExpr(JCExpression expr) {
    if (expr.type.hasTag(DEFERRED)) {
        JCTree speculativeTree = ((DeferredType)expr.type).speculativeTree(deferredAttrContext);
        if (speculativeTree != deferredAttr.stuckTree) {
            expr = (JCExpression)speculativeTree;
        }
    }
    return expr;
}
 
Example #9
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Type typeOf(DeferredType dt) {
    Type res = super.typeOf(dt);
    if (!res.isErroneous()) {
        switch (TreeInfo.skipParens(dt.tree).getTag()) {
            case LAMBDA:
            case REFERENCE:
                return dt;
            case CONDEXPR:
                return res == Type.recoveryType ?
                        dt : res;
        }
    }
    return res;
}
 
Example #10
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Object methodArguments(List<Type> argtypes) {
    if (argtypes == null || argtypes.isEmpty()) {
        return noArgs;
    } else {
        ListBuffer<Object> diagArgs = new ListBuffer<>();
        for (Type t : argtypes) {
            if (t.hasTag(DEFERRED)) {
                diagArgs.append(((DeferredAttr.DeferredType)t).tree);
            } else {
                diagArgs.append(t);
            }
        }
        return diagArgs;
    }
}
 
Example #11
Source File: Resolve.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Type check(DiagnosticPosition pos, Type found) {
    if (found.hasTag(DEFERRED)) {
        DeferredType dt = (DeferredType)found;
        return dt.check(this);
    } else {
        Type uResult = U(found);
        Type capturedType = pos == null || pos.getTree() == null ?
                types.capture(uResult) :
                checkContext.inferenceContext()
                    .cachedCapture(pos.getTree(), uResult, true);
        return super.check(pos, chk.checkNonVoid(pos, capturedType));
    }
}
 
Example #12
Source File: Resolve.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public boolean compatible(Type found, Type req, Warner warn) {
    if (allowFunctionalInterfaceMostSpecific &&
            unrelatedFunctionalInterfaces(found, req) &&
            (actual != null && actual.getTag() == DEFERRED)) {
        DeferredType dt = (DeferredType) actual;
        DeferredType.SpeculativeCache.Entry e =
                dt.speculativeCache.get(deferredAttrContext.msym, deferredAttrContext.phase);
        if (e != null && e.speculativeTree != deferredAttr.stuckTree) {
            return functionalInterfaceMostSpecific(found, req, e.speculativeTree, warn);
        }
    }
    return super.compatible(found, req, warn);
}
 
Example #13
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 #14
Source File: Resolve.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public Object methodArguments(List<Type> argtypes) {
    if (argtypes == null || argtypes.isEmpty()) {
        return noArgs;
    } else {
        ListBuffer<Object> diagArgs = new ListBuffer<>();
        for (Type t : argtypes) {
            if (t.hasTag(DEFERRED)) {
                diagArgs.append(((DeferredAttr.DeferredType)t).tree);
            } else {
                diagArgs.append(t);
            }
        }
        return diagArgs;
    }
}
 
Example #15
Source File: Resolve.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Type check(DiagnosticPosition pos, Type found) {
    if (found.hasTag(DEFERRED)) {
        DeferredType dt = (DeferredType)found;
        return dt.check(this);
    } else {
        return super.check(pos, chk.checkNonVoid(pos, types.capture(U(found.baseType()))));
    }
}
 
Example #16
Source File: Resolve.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Type typeOf(DeferredType dt) {
    Type res = super.typeOf(dt);
    if (!res.isErroneous()) {
        switch (TreeInfo.skipParens(dt.tree).getTag()) {
            case LAMBDA:
            case REFERENCE:
                return dt;
            case CONDEXPR:
                return res == Type.recoveryType ?
                        dt : res;
        }
    }
    return res;
}
 
Example #17
Source File: Resolve.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Object methodArguments(List<Type> argtypes) {
    if (argtypes == null || argtypes.isEmpty()) {
        return noArgs;
    } else {
        ListBuffer<Object> diagArgs = new ListBuffer<>();
        for (Type t : argtypes) {
            if (t.hasTag(DEFERRED)) {
                diagArgs.append(((DeferredAttr.DeferredType)t).tree);
            } else {
                diagArgs.append(t);
            }
        }
        return diagArgs;
    }
}
 
Example #18
Source File: Resolve.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Type check(DiagnosticPosition pos, Type found) {
    if (found.hasTag(DEFERRED)) {
        DeferredType dt = (DeferredType)found;
        return dt.check(this);
    } else {
        return super.check(pos, chk.checkNonVoid(pos, types.capture(U(found.baseType()))));
    }
}
 
Example #19
Source File: Resolve.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Type typeOf(DeferredType dt) {
    Type res = super.typeOf(dt);
    if (!res.isErroneous()) {
        switch (TreeInfo.skipParens(dt.tree).getTag()) {
            case LAMBDA:
            case REFERENCE:
                return dt;
            case CONDEXPR:
                return res == Type.recoveryType ?
                        dt : res;
        }
    }
    return res;
}
 
Example #20
Source File: Resolve.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Object methodArguments(List<Type> argtypes) {
    if (argtypes == null || argtypes.isEmpty()) {
        return noArgs;
    } else {
        ListBuffer<Object> diagArgs = new ListBuffer<>();
        for (Type t : argtypes) {
            if (t.hasTag(DEFERRED)) {
                diagArgs.append(((DeferredAttr.DeferredType)t).tree);
            } else {
                diagArgs.append(t);
            }
        }
        return diagArgs;
    }
}
 
Example #21
Source File: Resolve.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Type typeOf(DeferredType dt) {
    Type res = super.typeOf(dt);
    if (!res.isErroneous()) {
        switch (TreeInfo.skipParens(dt.tree).getTag()) {
            case LAMBDA:
            case REFERENCE:
                return dt;
            case CONDEXPR:
                return res == Type.recoveryType ?
                        dt : res;
        }
    }
    return res;
}
 
Example #22
Source File: Resolve.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean compatible(Type found, Type req, Warner warn) {
    if (allowFunctionalInterfaceMostSpecific &&
            unrelatedFunctionalInterfaces(found, req) &&
            (actual != null && actual.getTag() == DEFERRED)) {
        DeferredType dt = (DeferredType) actual;
        DeferredType.SpeculativeCache.Entry e =
                dt.speculativeCache.get(deferredAttrContext.msym, deferredAttrContext.phase);
        if (e != null && e.speculativeTree != deferredAttr.stuckTree) {
            return functionalInterfaceMostSpecific(found, req, e.speculativeTree, warn);
        }
    }
    return super.compatible(found, req, warn);
}
 
Example #23
Source File: Resolve.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Type typeOf(DeferredType dt) {
    Type res = super.typeOf(dt);
    if (!res.isErroneous()) {
        switch (TreeInfo.skipParens(dt.tree).getTag()) {
            case LAMBDA:
            case REFERENCE:
                return dt;
            case CONDEXPR:
                return res == Type.recoveryType ?
                        dt : res;
        }
    }
    return res;
}
 
Example #24
Source File: Resolve.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Object methodArguments(List<Type> argtypes) {
    if (argtypes == null || argtypes.isEmpty()) {
        return noArgs;
    } else {
        ListBuffer<Object> diagArgs = new ListBuffer<>();
        for (Type t : argtypes) {
            if (t.hasTag(DEFERRED)) {
                diagArgs.append(((DeferredAttr.DeferredType)t).tree);
            } else {
                diagArgs.append(t);
            }
        }
        return diagArgs;
    }
}
 
Example #25
Source File: Resolve.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Type check(DiagnosticPosition pos, Type found) {
    if (found.hasTag(DEFERRED)) {
        DeferredType dt = (DeferredType)found;
        return dt.check(this);
    } else {
        Type uResult = U(found.baseType());
        Type capturedType = pos == null || pos.getTree() == null ?
                types.capture(uResult) :
                checkContext.inferenceContext()
                    .cachedCapture(pos.getTree(), uResult, true);
        return super.check(pos, chk.checkNonVoid(pos, capturedType));
    }
}
 
Example #26
Source File: Resolve.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public boolean compatible(Type found, Type req, Warner warn) {
    if (allowFunctionalInterfaceMostSpecific &&
            unrelatedFunctionalInterfaces(found, req) &&
            (actual != null && actual.getTag() == DEFERRED)) {
        DeferredType dt = (DeferredType) actual;
        DeferredType.SpeculativeCache.Entry e =
                dt.speculativeCache.get(deferredAttrContext.msym, deferredAttrContext.phase);
        if (e != null && e.speculativeTree != deferredAttr.stuckTree) {
            return functionalInterfaceMostSpecific(found, req, e.speculativeTree, warn);
        }
    }
    return super.compatible(found, req, warn);
}
 
Example #27
Source File: Resolve.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Type typeOf(DeferredType dt) {
    Type res = super.typeOf(dt);
    if (!res.isErroneous()) {
        switch (TreeInfo.skipParens(dt.tree).getTag()) {
            case LAMBDA:
            case REFERENCE:
                return dt;
            case CONDEXPR:
                return res == Type.recoveryType ?
                        dt : res;
        }
    }
    return res;
}
 
Example #28
Source File: Resolve.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Object methodArguments(List<Type> argtypes) {
    if (argtypes == null || argtypes.isEmpty()) {
        return noArgs;
    } else {
        ListBuffer<Object> diagArgs = new ListBuffer<>();
        for (Type t : argtypes) {
            if (t.hasTag(DEFERRED)) {
                diagArgs.append(((DeferredAttr.DeferredType)t).tree);
            } else {
                diagArgs.append(t);
            }
        }
        return diagArgs;
    }
}
 
Example #29
Source File: Resolve.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Type check(DiagnosticPosition pos, Type found) {
    if (found.hasTag(DEFERRED)) {
        DeferredType dt = (DeferredType)found;
        return dt.check(this);
    } else {
        Type uResult = U(found);
        Type capturedType = pos == null || pos.getTree() == null ?
                types.capture(uResult) :
                checkContext.inferenceContext()
                    .cachedCapture(pos.getTree(), uResult, true);
        return super.check(pos, chk.checkNonVoid(pos, capturedType));
    }
}
 
Example #30
Source File: Resolve.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public boolean compatible(Type found, Type req, Warner warn) {
    if (allowFunctionalInterfaceMostSpecific &&
            unrelatedFunctionalInterfaces(found, req) &&
            (actual != null && actual.getTag() == DEFERRED)) {
        DeferredType dt = (DeferredType) actual;
        DeferredType.SpeculativeCache.Entry e =
                dt.speculativeCache.get(deferredAttrContext.msym, deferredAttrContext.phase);
        if (e != null && e.speculativeTree != deferredAttr.stuckTree) {
            return functionalInterfaceMostSpecific(found, req, e.speculativeTree, warn);
        }
    }
    return super.compatible(found, req, warn);
}