Example usage for org.eclipse.jdt.internal.compiler.lookup LookupEnvironment computeBoxingType

List of usage examples for org.eclipse.jdt.internal.compiler.lookup LookupEnvironment computeBoxingType

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup LookupEnvironment computeBoxingType.

Prototype

public TypeBinding computeBoxingType(TypeBinding type) 

Source Link

Usage

From source file:org.eclipse.jdt.internal.compiler.lookup.Scope.java

License:Open Source License

public boolean isBoxingCompatibleWith(TypeBinding expressionType, TypeBinding targetType) {
    LookupEnvironment environment = environment();
    if (environment.globalOptions.sourceLevel < ClassFileConstants.JDK1_5
            || expressionType.isBaseType() == targetType.isBaseType())
        return false;

    // check if autoboxed type is compatible
    TypeBinding convertedType = environment.computeBoxingType(expressionType);
    return convertedType == targetType || convertedType.isCompatibleWith(targetType);
}

From source file:org.eclipse.jdt.internal.compiler.lookup.Scope.java

License:Open Source License

private int parameterCompatibilityLevel(TypeBinding arg, TypeBinding param, LookupEnvironment env) {
    // only called if env.options.sourceLevel >= ClassFileConstants.JDK1_5
    if (arg.isCompatibleWith(param))
        return COMPATIBLE;
    if (arg.isBaseType() != param.isBaseType()) {
        TypeBinding convertedType = env.computeBoxingType(arg);
        if (convertedType == param || convertedType.isCompatibleWith(param))
            return AUTOBOX_COMPATIBLE;
    }// w  ww  .  j a  v a 2  s  . co  m
    return NOT_COMPATIBLE;
}