Examples of FieldBinding


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

          this.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits
          this.bits |= Binding.LOCAL;
          return this.resolvedType = getOtherFieldBindings(scope);
        }
        if (this.binding instanceof FieldBinding) {
          FieldBinding fieldBinding = (FieldBinding) this.binding;
          MethodScope methodScope = scope.methodScope();
          // check for forward references
          if (this.indexOfFirstFieldBinding == 1
              && methodScope.enclosingSourceType() == fieldBinding.original().declaringClass
              && methodScope.lastVisibleFieldID >= 0
              && fieldBinding.id >= methodScope.lastVisibleFieldID
              && (!fieldBinding.isStatic() || methodScope.isStatic)) {
            scope.problemReporter().forwardReference(this, 0, methodScope.enclosingSourceType());
          }
          if (!fieldBinding.isStatic()
              && this.indexOfFirstFieldBinding == 1
              && scope.compilerOptions().getSeverity(CompilerOptions.UnqualifiedFieldAccess) != ProblemSeverities.Ignore) {
            scope.problemReporter().unqualifiedFieldAccess(this, fieldBinding);
          }
          this.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits
View Full Code Here

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

        // TODO does not cope with many cases...
        if (e instanceof QualifiedNameReference) {

          QualifiedNameReference qnr = (QualifiedNameReference) e;
          if (qnr.binding instanceof FieldBinding) {
            FieldBinding fb = (FieldBinding) qnr.binding;
            StringBuffer sb = new StringBuffer();
            sb.append(fb.declaringClass.signature());
            sb.append(fb.name);
            return sb.toString();
          }
View Full Code Here

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

            return cScope.referenceContext;
          }
        }
      }
    } else if (realBinding instanceof FieldBinding) {
      FieldBinding fb = (FieldBinding) realBinding;
      if (fb != null) {
        SourceTypeBinding stb = (SourceTypeBinding) fb.declaringClass;
        if (stb != null) {
          ClassScope cScope = stb.scope;
          if (cScope != null) {
View Full Code Here

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

public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {

  switch (this.bits & RestrictiveFlagMASK) {
    case Binding.FIELD : // reading a field
      // check if reading a final blank field
      FieldBinding fieldBinding;
      if ((fieldBinding = (FieldBinding) this.binding).isBlankFinal()
          && currentScope.needBlankFinalFieldInitializationCheck(fieldBinding)) {
        if (!flowInfo.isDefinitelyAssigned(fieldBinding)) {
          currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
        }
View Full Code Here

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

public TypeBinding checkFieldAccess(BlockScope scope) {

  if (this.delegateThis == null) {
    return super.checkFieldAccess(scope);
  }
  FieldBinding fieldBinding = (FieldBinding) this.binding;
  this.bits &= ~RestrictiveFlagMASK; // clear bits
  this.bits |= Binding.FIELD;
  if (!fieldBinding.isStatic()) {
    // must check for the static status....
    if (this.evaluationContext.isStatic) {
      scope.problemReporter().staticFieldAccessToNonStaticVariable(
        this,
        fieldBinding);
      this.constant = Constant.NotAConstant;
      return null;
    }
  }
  this.constant = fieldBinding.constant();

  if (isFieldUseDeprecated(fieldBinding, scope, (this.bits & IsStrictlyAssigned) !=0)) {
    scope.problemReporter().deprecatedField(fieldBinding, this);
  }
  return fieldBinding.type;
View Full Code Here

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

      return;
    }
  }
  switch (this.bits & RestrictiveFlagMASK) {
    case Binding.FIELD : // assigning to a field
      FieldBinding fieldBinding = (FieldBinding) this.codegenBinding;
      if (fieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
        if (!fieldBinding.isStatic()) { // need a receiver?
          if ((this.bits & DepthMASK) != 0) {
            ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & DepthMASK) >> DepthSHIFT);
            Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
            codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
          } else {
            this.generateReceiver(codeStream);
          }
        }
        assignment.expression.generateCode(currentScope, codeStream, true);
        fieldStore(codeStream, fieldBinding, null, valueRequired);
        if (valueRequired) {
          codeStream.generateImplicitConversion(assignment.implicitConversion);
        }
      } else {
        codeStream.generateEmulationForField(fieldBinding);
        if (!fieldBinding.isStatic()) { // need a receiver?
          if ((this.bits & DepthMASK) != 0) {
            // internal error, per construction we should have found it
            // not yet supported
            currentScope.problemReporter().needImplementation();
          } else {
View Full Code Here

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

  } else {
    switch (this.bits & RestrictiveFlagMASK) {
      case Binding.FIELD : // reading a field
        if (!valueRequired)
          break;
        FieldBinding fieldBinding = (FieldBinding) this.codegenBinding;
        Constant fieldConstant = fieldBinding.constant();
        if (fieldConstant == Constant.NotAConstant) { // directly use inlined value for constant fields
          if (fieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
             // directly use inlined value for constant fields
            boolean isStatic;
            if (!(isStatic = fieldBinding.isStatic())) {
              if ((this.bits & DepthMASK) != 0) {
                ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & DepthMASK) >> DepthSHIFT);
                Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
                codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
              } else {
                generateReceiver(codeStream);
              }
            }
            // managing private access             
            if (isStatic) {
              codeStream.getstatic(fieldBinding);
            } else {
              codeStream.getfield(fieldBinding);
            }
          } else {
            // managing private access
            if (!fieldBinding.isStatic()) {
              if ((this.bits & DepthMASK) != 0) {
                // internal error, per construction we should have found it
                // not yet supported
                currentScope.problemReporter().needImplementation();
              } else {
View Full Code Here

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

* are optimized in one access: e.g "a = a + 1" optimized into "a++".
*/
public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, MethodBinding writeAccessor, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
  switch (this.bits & RestrictiveFlagMASK) {
    case Binding.FIELD : // assigning to a field
      FieldBinding fieldBinding = (FieldBinding) this.codegenBinding;
      if (fieldBinding.isStatic()) {
        if (fieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
          codeStream.getstatic(fieldBinding);
        } else {
          // used to store the value
          codeStream.generateEmulationForField(fieldBinding);
          codeStream.aconst_null();

          // used to retrieve the actual value
          codeStream.aconst_null();
          codeStream.generateEmulatedReadAccessForField(fieldBinding);
        }
      } else {
        if (fieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
          if ((this.bits & DepthMASK) != 0) {
            ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & DepthMASK) >> DepthSHIFT);
            Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
            codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
          } else {
            generateReceiver(codeStream);
          }
          codeStream.dup();
          codeStream.getfield(fieldBinding);
        } else {
          if ((this.bits & DepthMASK) != 0) {
            // internal error, per construction we should have found it
            // not yet supported
            currentScope.problemReporter().needImplementation();
          }
          // used to store the value
          codeStream.generateEmulationForField(fieldBinding);
          generateReceiver(codeStream);

          // used to retrieve the actual value
          codeStream.dup();
          codeStream.generateEmulatedReadAccessForField(fieldBinding);
        }
      }
      break;
    case Binding.LOCAL : // assigning to a local variable (cannot assign to outer local)
      LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
      Constant assignConstant;
      int increment;
      // using incr bytecode if possible
      switch (localBinding.type.id) {
        case T_JavaLangString :
          codeStream.generateStringConcatenationAppend(currentScope, this, expression);
          if (valueRequired) {
            codeStream.dup();
          }
          codeStream.store(localBinding, false);
          return;
        case T_int :
          if (((assignConstant = expression.constant) != Constant.NotAConstant)
            && (assignConstant.typeID() != T_float) // only for integral types
            && (assignConstant.typeID() != T_double)   
            && ((increment = assignConstant.intValue()) == (short) increment)) { // 16 bits value
            switch (operator) {
              case PLUS :
                codeStream.iinc(localBinding.resolvedPosition, increment);
                if (valueRequired) {
                  codeStream.load(localBinding);
                }
                return;
              case MINUS :
                codeStream.iinc(localBinding.resolvedPosition, -increment);
                if (valueRequired) {
                  codeStream.load(localBinding);
                }
                return;
            }
          }
        default :
          codeStream.load(localBinding);
      }
  }
  // perform the actual compound operation
  int operationTypeID;
  switch(operationTypeID = (this.implicitConversion & IMPLICIT_CONVERSION_MASK) >> 4) {
    case T_JavaLangString :
    case T_JavaLangObject :
    case T_undefined :
      codeStream.generateStringConcatenationAppend(currentScope, null, expression);
      break;
    default :
      // promote the array reference to the suitable operation type
      codeStream.generateImplicitConversion(this.implicitConversion);
      // generate the increment value (will by itself  be promoted to the operation value)
      if (expression == IntLiteral.One){ // prefix operation
        codeStream.generateConstant(expression.constant, this.implicitConversion);     
      } else {
        expression.generateCode(currentScope, codeStream, true);
      }   
      // perform the operation
      codeStream.sendOperator(operator, operationTypeID);
      // cast the value back to the array reference type
      codeStream.generateImplicitConversion(assignmentImplicitConversion);
  }
  // store the result back into the variable
  switch (this.bits & RestrictiveFlagMASK) {
    case Binding.FIELD : // assigning to a field
      FieldBinding fieldBinding = (FieldBinding) this.codegenBinding;
      if (fieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
        fieldStore(codeStream, fieldBinding, writeAccessor, valueRequired);
      } else {
        // current stack is:
        // field receiver value
        if (valueRequired) {
View Full Code Here

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

  }
}
public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
  switch (this.bits & RestrictiveFlagMASK) {
    case Binding.FIELD : // assigning to a field
      FieldBinding fieldBinding = (FieldBinding) this.codegenBinding;
      if (fieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
        if (fieldBinding.isStatic()) {
          codeStream.getstatic(fieldBinding);
        } else {
          if ((this.bits & DepthMASK) != 0) {
            ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & DepthMASK) >> DepthSHIFT);
            Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
            codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
          } else {
            generateReceiver(codeStream);
          }
          codeStream.dup();
          codeStream.getfield(fieldBinding);
        }
        if (valueRequired) {
          if (fieldBinding.isStatic()) {
            if ((fieldBinding.type == TypeBinding.LONG) || (fieldBinding.type == TypeBinding.DOUBLE)) {
              codeStream.dup2();
            } else {
              codeStream.dup();
            }
          } else { // Stack:  [owner][old field value]  ---> [old field value][owner][old field value]
            if ((fieldBinding.type == TypeBinding.LONG) || (fieldBinding.type == TypeBinding.DOUBLE)) {
              codeStream.dup2_x1();
            } else {
              codeStream.dup_x1();
            }
          }
        }
        codeStream.generateConstant(postIncrement.expression.constant, this.implicitConversion);
        codeStream.sendOperator(postIncrement.operator, fieldBinding.type.id);
        codeStream.generateImplicitConversion(postIncrement.preAssignImplicitConversion);
        fieldStore(codeStream, fieldBinding, null, false);
      } else {
        if (fieldBinding.isStatic()) {
          codeStream.aconst_null();
        } else {
          if ((this.bits & DepthMASK) != 0) {
            // internal error, per construction we should have found it
            // not yet supported
            currentScope.problemReporter().needImplementation();
          } else {
            generateReceiver(codeStream);
          }
        }
        codeStream.generateEmulatedReadAccessForField(fieldBinding);
        if (valueRequired) {
          if ((fieldBinding.type == TypeBinding.LONG) || (fieldBinding.type == TypeBinding.DOUBLE)) {
            codeStream.dup2();
          } else {
            codeStream.dup();
          }
        }
        codeStream.generateEmulationForField(fieldBinding);
        if ((fieldBinding.type == TypeBinding.LONG) || (fieldBinding.type == TypeBinding.DOUBLE)) {
          codeStream.dup_x2();
          codeStream.pop();
          if (fieldBinding.isStatic()) {
            codeStream.aconst_null();
          } else {
            generateReceiver(codeStream);
          }
          codeStream.dup_x2();
          codeStream.pop();         
        } else {
          codeStream.dup_x1();
          codeStream.pop();
          if (fieldBinding.isStatic()) {
            codeStream.aconst_null();
          } else {
            generateReceiver(codeStream);
          }
          codeStream.dup_x1();
View Full Code Here

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

    return
  // if field from parameterized type got found, use the original field at codegen time
  if (this.binding instanceof ParameterizedFieldBinding) {
      ParameterizedFieldBinding parameterizedField = (ParameterizedFieldBinding) this.binding;
      this.codegenBinding = parameterizedField.originalField;
      FieldBinding fieldCodegenBinding = (FieldBinding)this.codegenBinding;
      // extra cast needed if field type was type variable
      if ((fieldCodegenBinding.type.tagBits & TagBits.HasTypeVariable) != 0) {
          this.genericCast = fieldCodegenBinding.type.genericCast(currentScope.boxing(parameterizedField.type)); // runtimeType could be base type in boxing case
      }       
  }   
  if ((this.bits & Binding.FIELD) != 0) {
    FieldBinding fieldBinding = (FieldBinding) this.binding;
   
    // 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
    // and not from Object or implicit static field access. 
    if (fieldBinding.declaringClass != this.delegateThis.type
        && fieldBinding.declaringClass != null // array.length
        && fieldBinding.constant() == Constant.NotAConstant) {
      CompilerOptions options = currentScope.compilerOptions();
      if ((options.targetJDK >= ClassFileConstants.JDK1_2
          && (options.complianceLevel >= ClassFileConstants.JDK1_4 || !fieldBinding.isStatic())
          && fieldBinding.declaringClass.id != T_JavaLangObject) // no change for Object fields
        || !fieldBinding.declaringClass.canBeSeenBy(currentScope)) {
 
        this.codegenBinding =
            currentScope.enclosingSourceType().getUpdatedFieldBinding(
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.