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

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


    if (valueRequired) {
      if (lastFieldBinding.declaringClass == null) { // array length
        codeStream.arraylength();
        codeStream.generateImplicitConversion(this.implicitConversion);
      } else {
        Constant fieldConstant = lastFieldBinding.constant();
        if (fieldConstant != Constant.NotAConstant) {
          if (!lastFieldBinding.isStatic()){
            codeStream.invokeObjectGetClass();
            codeStream.pop();
          }
View Full Code Here


  switch (this.bits & RestrictiveFlagMASK) {
    case Binding.FIELD :
      lastFieldBinding = (FieldBinding) this.codegenBinding;
      lastGenericCast = this.genericCast;
      // if first field is actually constant, we can inline it
      if (lastFieldBinding.constant() != Constant.NotAConstant) {
        break;
      }
      if (needValue) {
        if (lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
          if (!lastFieldBinding.isStatic()) {
View Full Code Here

      if (isFieldUseDeprecated(field, scope, (this.bits & IsStrictlyAssigned) !=0 && index+1 == length)) {
        scope.problemReporter().deprecatedField(field, this);
      }
      // constant propagation can only be performed as long as the previous one is a constant too.
      if (this.constant != Constant.NotAConstant){
        this.constant = field.constant();
      }
      type = field.type;
      index++;
    } else {
      this.constant = Constant.NotAConstant; //don't fill other constants slots...
View Full Code Here

        if (declaringClass.isEnum()) {
          MethodScope methodScope = currentScope.methodScope();
          SourceTypeBinding sourceType = methodScope.enclosingSourceType();
          if (lastFieldBinding.isStatic()
              && (sourceType == declaringClass || sourceType.superclass == declaringClass) // enum constant body
              && lastFieldBinding.constant() == Constant.NotAConstant
              && !methodScope.isStatic
              && methodScope.isInsideInitializerOrConstructor()) {
            currentScope.problemReporter().enumStaticFieldUsedDuringInitialization(lastFieldBinding, this);
          }
        }       
View Full Code Here

        if (declaringClass.isEnum()) {
          MethodScope methodScope = currentScope.methodScope();
          SourceTypeBinding sourceType = methodScope.enclosingSourceType();
          if (fieldBinding.isStatic()
              && (sourceType == declaringClass || sourceType.superclass == declaringClass) // enum constant body
              && fieldBinding.constant() == Constant.NotAConstant
              && !methodScope.isStatic
              && methodScope.isInsideInitializerOrConstructor()) {
            currentScope.problemReporter().enumStaticFieldUsedDuringInitialization(fieldBinding, this);
          }
        }       
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

  switch (this.bits & ASTNode.RestrictiveFlagMASK) {
    case Binding.FIELD :
      lastFieldBinding = (FieldBinding) this.codegenBinding;
      lastGenericCast = this.genericCast;
      // 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

        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

    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())) {
View Full Code Here

    // 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)) {
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.