Package org.eclipse.jdt.internal.compiler.lookup

Examples of org.eclipse.jdt.internal.compiler.lookup.FieldBinding.constant()


        return Lists.<JAnnotationArgument> create(toReturn);
      } else if (value instanceof FieldBinding) {
        FieldBinding fieldBinding = (FieldBinding) value;
        assert fieldBinding.constant() != null : "Expecting constant-valued field";
        return Lists.create((JAnnotationArgument) dispatch("processConstant",
            fieldBinding.constant()));
      }

      throw new InternalCompilerException("Unable to process value "
          + value.getClass().getName());
    }
View Full Code Here


           * We must replace any compile-time constants with the constant
           * value of the field.
           */
          if (isCompileTimeConstant(fieldBinding)) {
            assert !ctx.isLvalue();
            JExpression constant = getConstant(info, fieldBinding.constant());
            generator.accept(constant);
            JsExpression result = generator.pop();
            assert (result != null);
            ctx.replaceMe(result);
          } else {
View Full Code Here

  }
  if (isFieldUseDeprecated(fieldBinding, scope, (this.bits & ASTNode.IsStrictlyAssigned) !=0)) {
    scope.problemReporter().deprecatedField(fieldBinding, this);
  }
  boolean isImplicitThisRcv = this.receiver.isImplicitThis();
  this.constant = isImplicitThisRcv ? fieldBinding.constant() : Constant.NotAConstant;
  if (fieldBinding.isStatic()) {
    // static field accessed through receiver? legal but unoptimal (optional warning)
    if (!(isImplicitThisRcv
        || (this.receiver instanceof NameReference
          && (((NameReference) this.receiver).bits & Binding.TYPE) != 0))) {
View Full Code Here

  return flowInfo;
}

public TypeBinding checkFieldAccess(BlockScope scope) {
  FieldBinding fieldBinding = (FieldBinding) this.binding;
  this.constant = fieldBinding.constant();

  this.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits
  this.bits |= Binding.FIELD;
  MethodScope methodScope = scope.methodScope();
  if (fieldBinding.isStatic()) {
View Full Code Here

    return;
  }
  FieldBinding codegenBinding = this.binding.original();
  boolean isStatic = codegenBinding.isStatic();
  boolean isThisReceiver = this.receiver instanceof ThisReference;
  Constant fieldConstant = codegenBinding.constant();
  if (fieldConstant != Constant.NotAConstant) {
    if (!isThisReceiver) {
      this.receiver.generateCode(currentScope, codeStream, !isStatic);
      if (!isStatic){
        codeStream.invokeObjectGetClass();
View Full Code Here

    return;
  } else {
    switch (this.bits & ASTNode.RestrictiveFlagMASK) {
      case Binding.FIELD : // reading a field
        FieldBinding codegenField = ((FieldBinding) this.binding).original();
        Constant fieldConstant = codegenField.constant();
        if (fieldConstant != Constant.NotAConstant) {
          // directly use inlined value for constant fields
          if (valueRequired) {
            codeStream.generateConstant(fieldConstant, this.implicitConversion);
          }
View Full Code Here

    }
  } else {
    FieldBinding lastFieldBinding = generateReadSequence(currentScope, codeStream);
    if (lastFieldBinding != null) {
      boolean isStatic = lastFieldBinding.isStatic();
      Constant fieldConstant = lastFieldBinding.constant();
      if (fieldConstant != Constant.NotAConstant) {
        if (!isStatic){
          codeStream.invokeObjectGetClass();
          codeStream.pop();
        }
View Full Code Here

    case Binding.FIELD :
      lastFieldBinding = ((FieldBinding) this.binding).original();
      lastGenericCast = this.genericCast;
      lastReceiverType = this.actualReceiverType;
      // if first field is actually constant, we can inline it
      if (lastFieldBinding.constant() != Constant.NotAConstant) {
        break;
      }
      if ((needValue && !lastFieldBinding.isStatic()) || lastGenericCast != null) {
        int pc = codeStream.position;
        if ((this.bits & ASTNode.DepthMASK) != 0) {
View Full Code Here

          if (fieldBinding.isStatic()) {
            // only last field is actually a write access if any
            // check if accessing enum static field in initializer
            if (declaringClass.isEnum()) {
              if ((sourceType == declaringClass || sourceType.superclass == declaringClass) // enum constant body
                  && fieldBinding.constant() == Constant.NotAConstant
                  && !methodScope.isStatic
                  && methodScope.isInsideInitializerOrConstructor()) {
                scope.problemReporter().enumStaticFieldUsedDuringInitialization(fieldBinding, this);
              }
            }
View Full Code Here

        fieldBinding);
      this.constant = Constant.NotAConstant;
      return null;
    }
  }
  this.constant = fieldBinding.constant();

  if (isFieldUseDeprecated(fieldBinding, scope, this.bits)) {
    scope.problemReporter().deprecatedField(fieldBinding, this);
  }
  return fieldBinding.type;
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.