com.sun.tools.javac.comp.Check.CheckContext Java Examples

The following examples show how to use com.sun.tools.javac.comp.Check.CheckContext. 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 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 #2
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 #3
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 #4
Source File: Resolve.java    From openjdk-jdk8u-backup 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 #5
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 #6
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 #7
Source File: Resolve.java    From openjdk-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.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 #8
Source File: Resolve.java    From jdk8u60 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 #9
Source File: ArgumentAttr.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Check lambda against given target result */
private void checkLambdaCompatible(Type descriptor, ResultInfo resultInfo) {
    CheckContext checkContext = resultInfo.checkContext;
    ResultInfo bodyResultInfo = attr.lambdaBodyResult(speculativeTree, descriptor, resultInfo);
    for (JCReturn ret : returnExpressions()) {
        Type t = getReturnType(ret);
        if (speculativeTree.getBodyKind() == BodyKind.EXPRESSION || !t.hasTag(VOID)) {
            checkSpeculative(ret.expr, t, bodyResultInfo);
        }
    }

    attr.checkLambdaCompatible(speculativeTree, descriptor, checkContext);
}
 
Example #10
Source File: ArgumentAttr.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/** Check lambda against given target result */
private void checkLambdaCompatible(Type descriptor, ResultInfo resultInfo) {
    CheckContext checkContext = resultInfo.checkContext;
    ResultInfo bodyResultInfo = attr.lambdaBodyResult(speculativeTree, descriptor, resultInfo);
    for (JCReturn ret : returnExpressions()) {
        Type t = getReturnType(ret);
        if (speculativeTree.getBodyKind() == BodyKind.EXPRESSION || !t.hasTag(VOID)) {
            checkSpeculative(ret.expr, t, bodyResultInfo);
        }
    }

    attr.checkLambdaCompatible(speculativeTree, descriptor, checkContext);
}
 
Example #11
Source File: Resolve.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected ResultInfo dup(CheckContext newContext) {
    return new MethodResultInfo(pt, newContext);
}
 
Example #12
Source File: Resolve.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public MethodResultInfo(Type pt, CheckContext checkContext) {
    attr.super(VAL, pt, checkContext);
}
 
Example #13
Source File: Resolve.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected ResultInfo dup(CheckContext newContext) {
    return new MethodResultInfo(pt, newContext);
}
 
Example #14
Source File: Resolve.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public MethodResultInfo(Type pt, CheckContext checkContext) {
    attr.super(VAL, pt, checkContext);
}
 
Example #15
Source File: Resolve.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public MethodResultInfo(Type pt, CheckContext checkContext) {
    attr.super(VAL, pt, checkContext);
}
 
Example #16
Source File: Resolve.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected ResultInfo dup(CheckContext newContext) {
    return new MethodResultInfo(pt, newContext);
}
 
Example #17
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected ResultInfo dup(Type newPt, CheckContext newContext) {
    return new MethodResultInfo(newPt, newContext);
}
 
Example #18
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected ResultInfo dup(CheckContext newContext) {
    return new MethodResultInfo(pt, newContext);
}
 
Example #19
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public MethodResultInfo(Type pt, CheckContext checkContext) {
    attr.super(KindSelector.VAL, pt, checkContext);
}
 
Example #20
Source File: Resolve.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected ResultInfo dup(CheckContext newContext) {
    return new MethodResultInfo(pt, newContext);
}
 
Example #21
Source File: Resolve.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public MethodResultInfo(Type pt, CheckContext checkContext) {
    attr.super(VAL, pt, checkContext);
}
 
Example #22
Source File: Annotate.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
AnnotationValueContext(CheckContext enclosingContext) {
    super(enclosingContext);
}
 
Example #23
Source File: Resolve.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected ResultInfo dup(CheckContext newContext) {
    return new MethodResultInfo(pt, newContext);
}
 
Example #24
Source File: Resolve.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public MethodResultInfo(Type pt, CheckContext checkContext) {
    attr.super(VAL, pt, checkContext);
}
 
Example #25
Source File: Resolve.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected ResultInfo dup(CheckContext newContext) {
    return new MethodResultInfo(pt, newContext);
}
 
Example #26
Source File: Resolve.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public MethodResultInfo(Type pt, CheckContext checkContext) {
    attr.super(VAL, pt, checkContext);
}
 
Example #27
Source File: Resolve.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected ResultInfo dup(CheckContext newContext) {
    return new MethodResultInfo(pt, newContext);
}
 
Example #28
Source File: Resolve.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public MethodResultInfo(Type pt, CheckContext checkContext) {
    attr.super(VAL, pt, checkContext);
}