Examples of TypeBinding


Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding

public FieldBinding findFieldForCodeSnippet(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite) {
  if (receiverType.isBaseType())
    return null;
  if (receiverType.isArrayType()) {
    TypeBinding leafType = receiverType.leafComponentType();
    if (leafType instanceof ReferenceBinding)
    if (!((ReferenceBinding)leafType).canBeSeenBy(this)) {
      return new ProblemFieldBinding((ReferenceBinding)leafType, fieldName, ProblemReasons.ReceiverTypeNotVisible);
    }
    if (CharOperation.equals(fieldName, LENGTH))
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding

  if (runtimeTimeType == null || compileTimeType == null)
    return;
  // set the generic cast after the fact, once the type expectation is fully known (no need for strict cast)
  if (this.binding != null && this.binding.isValidBinding()) {
    MethodBinding originalBinding = this.binding.original();
    TypeBinding originalType = originalBinding.returnType;
      // extra cast needed if method return type is type variable
    if (originalBinding != this.binding
        && originalType != this.binding.returnType
        && runtimeTimeType.id != TypeIds.T_JavaLangObject
        && (originalType.tagBits & TagBits.HasTypeVariable) != 0) {
        TypeBinding targetType = (!compileTimeType.isBaseType() && runtimeTimeType.isBaseType())
          ? compileTimeType  // unboxing: checkcast before conversion
          : runtimeTimeType;
          this.valueCast = originalType.genericCast(targetType);
    }   else if (this.actualReceiverType.isArrayType()
            && runtimeTimeType.id != TypeIds.T_JavaLangObject
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding

/**
* @see org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression#postConversionType(Scope)
*/
public TypeBinding postConversionType(Scope scope) {
  TypeBinding convertedType = this.resolvedType;
  if (this.valueCast != null)
    convertedType = this.valueCast;
  int runtimeType = (this.implicitConversion & TypeIds.IMPLICIT_CONVERSION_MASK) >> 4;
  switch (runtimeType) {
    case T_boolean :
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding

        scope.problemReporter().rawTypeReference(this.receiver, this.actualReceiverType);
      }
    } else {
      this.receiver.computeConversion(scope, this.actualReceiverType, this.actualReceiverType);
      // compute generic cast if necessary
      TypeBinding receiverErasure = this.actualReceiverType.erasure();
      if (receiverErasure instanceof ReferenceBinding) {
        if (receiverErasure.findSuperTypeWithSameErasure(this.binding.declaringClass) == null) {
          this.receiverGenericCast = this.binding.declaringClass; // handle indirect inheritance thru variable secondary bound
        }
      }
    }
  } else {
    // static message invoked through receiver? legal but unoptimal (optional warning).
    if (!(this.receiver.isImplicitThis() || this.receiver.isSuper() || receiverIsType)) {
      scope.problemReporter().nonStaticAccessToStaticMethod(this, this.binding);
    }
    if (!this.receiver.isImplicitThis() && this.binding.declaringClass != this.actualReceiverType) {
      scope.problemReporter().indirectAccessToStaticMethod(this, this.binding);
    }   
  }
  checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this);

  //-------message send that are known to fail at compile time-----------
  if (this.binding.isAbstract()) {
    if (this.receiver.isSuper()) {
      scope.problemReporter().cannotDireclyInvokeAbstractMethod(this, this.binding);
    }
    // abstract private methods cannot occur nor abstract static............
  }
  if (isMethodUseDeprecated(this.binding, scope, true))
    scope.problemReporter().deprecatedMethod(this.binding, this);

  // from 1.5 compliance on, array#clone() returns the array type (but binding still shows Object)
  if (this.actualReceiverType.isArrayType()
      && this.binding.parameters == Binding.NO_PARAMETERS
      && compilerOptions.complianceLevel >= ClassFileConstants.JDK1_5
      && CharOperation.equals(this.binding.selector, TypeConstants.CLONE)) {
    this.resolvedType = this.actualReceiverType;
  } else {
    TypeBinding returnType = this.binding.returnType;
    if (returnType != null) returnType = returnType.capture(scope, this.sourceEnd);
    this.resolvedType = returnType;
  }
  if (this.receiver.isSuper() && compilerOptions.getSeverity(CompilerOptions.OverridingMethodWithoutSuperInvocation) != ProblemSeverities.Ignore) {
    final ReferenceContext referenceContext = scope.methodScope().referenceContext;
    if (referenceContext instanceof AbstractMethodDeclaration) {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding

  }
   
  // if the binding declaring class is not visible, need special action
  // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
  // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
  TypeBinding someReceiverType = this.delegateThis != null ? this.delegateThis.type : this.receiverType;
  if (this.binding.declaringClass != someReceiverType
      && !someReceiverType.isArrayType()
      && this.binding.declaringClass != null // array.length
      && this.binding.constant() == Constant.NotAConstant) {
 
    CompilerOptions options = currentScope.compilerOptions();
    if ((options.targetJDK >= ClassFileConstants.JDK1_2
        && (options.complianceLevel >= ClassFileConstants.JDK1_4 || !receiver.isImplicitThis() || !this.codegenBinding.isStatic())
        && this.binding.declaringClass.id != T_JavaLangObject) // no change for Object fields
      || !this.binding.declaringClass.canBeSeenBy(currentScope)) {

      this.codegenBinding =
        currentScope.enclosingSourceType().getUpdatedFieldBinding(
          this.codegenBinding,
          (ReferenceBinding) someReceiverType.erasure());
    }
  } 
}
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding

  }
  public TypeBinding resolveType(BlockScope scope) {
 
    // implicit this
    this.constant = Constant.NotAConstant;
    TypeBinding snippetType = null;
    MethodScope methodScope = scope.methodScope();
    if (!this.isImplicit && !checkAccess(methodScope)) {
      return null;
    }
    snippetType = scope.enclosingSourceType();
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding

      codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
      codeStream.dup();
      for (int i = 0; i < argsLength; i++) {
        codeStream.generateInlinedValue(i);
        this.arguments[i].generateCode(currentScope, codeStream, true);
        TypeBinding parameterBinding = this.codegenBinding.parameters[i];
        if (parameterBinding.isBaseType() && parameterBinding != TypeBinding.NULL) {
          codeStream.generateBoxingConversion(this.codegenBinding.parameters[i].id);
        }
        codeStream.aastore();
        if (i < argsLength - 1) {
          codeStream.dup();
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding

  if (isMethodUseDeprecated(this.binding, scope, true)) {
    scope.problemReporter().deprecatedMethod(this.binding, this);
  }
  if (arguments != null) {
    for (int i = 0; i < arguments.length; i++) {
        TypeBinding parameterType = binding.parameters[i];
        TypeBinding argumentType = argumentTypes[i];
      arguments[i].computeConversion(scope, parameterType, argumentType);
      if (argumentType.needsUncheckedConversion(parameterType)) {
        scope.problemReporter().unsafeTypeConversion(arguments[i], argumentType, parameterType);
      }
    }
    if (argsContainCast) {
      CastExpression.checkNeedForArgumentCasts(scope, null, allocatedType, binding, this.arguments, argumentTypes, this);
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding

        return true; // identity conversion
      }
      switch (castType.kind()) {
        case Binding.ARRAY_TYPE :
          // ( ARRAY ) ARRAY
          TypeBinding castElementType = ((ArrayBinding) castType).elementsType();
          TypeBinding exprElementType = ((ArrayBinding) expressionType).elementsType();
          if (exprElementType.isBaseType() || castElementType.isBaseType()) {
            if (castElementType == exprElementType) {
              tagAsNeedCheckCast();
              return true;
            }
            return false;
          }
          // recurse on array type elements
          return checkCastTypesCompatibility(scope, castElementType, exprElementType, expression);
         
        case Binding.TYPE_PARAMETER :
          // ( TYPE_PARAMETER ) ARRAY
          TypeBinding match = expressionType.findSuperTypeWithSameErasure(castType);
          if (match == null) {
            checkUnsafeCast(scope, castType, expressionType, null /*no match*/, true);
          }
          // recurse on the type variable upper bound
          return checkCastTypesCompatibility(scope, ((TypeVariableBinding)castType).upperBound(), expressionType, expression);
         
        default:
          // ( CLASS/INTERFACE ) ARRAY
          switch (castType.id) {
            case T_JavaLangCloneable :
            case T_JavaIoSerializable :
              tagAsNeedCheckCast();
              return true;
            case T_JavaLangObject :
              tagAsUnnecessaryCast(scope, castType);
              return true;
            default :
              return false;
          }
      }
         
    case Binding.TYPE_PARAMETER :
      TypeBinding match = expressionType.findSuperTypeWithSameErasure(castType);
      if (match != null) {
        return checkUnsafeCast(scope, castType, expressionType, match, false);
      }
      // recursively on the type variable upper bound
      return checkCastTypesCompatibility(scope, castType, ((TypeVariableBinding)expressionType).upperBound(), expression);
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding

    // it is possible for a Byte to be unboxed to a byte & then converted to an int
    // but it is not possible for a byte to become Byte & then assigned to an Integer,
    // or to become an int before boxed into an Integer
    if (runtimeType != TypeBinding.NULL && runtimeType.isBaseType()) {
      if (!compileTimeType.isBaseType()) {
        TypeBinding unboxedType = scope.environment().computeBoxingType(compileTimeType);
        this.implicitConversion = TypeIds.UNBOXING;
        scope.problemReporter().autoboxing(this, compileTimeType, runtimeType);
        compileTimeType = unboxedType;
      }
    } else if (compileTimeType != TypeBinding.NULL && compileTimeType.isBaseType()) {
      TypeBinding boxedType = scope.environment().computeBoxingType(runtimeType);
      if (boxedType == runtimeType) // Object o = 12;
        boxedType = compileTimeType;
      this.implicitConversion = TypeIds.BOXING | (boxedType.id << 4) + compileTimeType.id;
      scope.problemReporter().autoboxing(this, compileTimeType, scope.environment().computeBoxingType(boxedType));
      return;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.