Example usage for org.eclipse.jdt.internal.compiler.lookup TypeBinding isParameterizedTypeWithActualArguments

List of usage examples for org.eclipse.jdt.internal.compiler.lookup TypeBinding isParameterizedTypeWithActualArguments

Introduction

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

Prototype

public final boolean isParameterizedTypeWithActualArguments() 

Source Link

Document

Returns true if the type is parameterized, e.g.

Usage

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

License:Open Source License

boolean isAcceptableReturnTypeOverride(MethodBinding currentMethod, MethodBinding inheritedMethod) {
    // called when currentMethod's return type is compatible with inheritedMethod's return type

    if (inheritedMethod.declaringClass.isRawType())
        return true; // since the inheritedMethod comes from a raw type, the return type is always acceptable

    MethodBinding originalInherited = inheritedMethod.original();
    TypeBinding originalInheritedReturnType = originalInherited.returnType.leafComponentType();
    if (originalInheritedReturnType.isParameterizedTypeWithActualArguments())
        return !currentMethod.returnType.leafComponentType().isRawType(); // raw types issue a warning if inherited is parameterized

    TypeBinding currentReturnType = currentMethod.returnType.leafComponentType();
    switch (currentReturnType.kind()) {
    case Binding.TYPE_PARAMETER:
        if (currentReturnType == inheritedMethod.returnType.leafComponentType())
            return true;
        //$FALL-THROUGH$
    default:/*w ww  .  jav  a2  s.  c o m*/
        if (originalInheritedReturnType.isTypeVariable())
            if (((TypeVariableBinding) originalInheritedReturnType).declaringElement == originalInherited)
                return false;
        return true;
    }
}