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

Examples of org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding


  this.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits
  this.bits |= Binding.FIELD;
  MethodScope methodScope = scope.methodScope();
  if (fieldBinding.isStatic()) {
    // check if accessing enum static field in initializer
    ReferenceBinding declaringClass = fieldBinding.declaringClass;
    if (declaringClass.isEnum()) {
      SourceTypeBinding sourceType = scope.enclosingSourceType();
      if (this.constant == Constant.NotAConstant
          && !methodScope.isStatic
          && (sourceType == declaringClass || sourceType.superclass == declaringClass) // enum constant body
          && methodScope.isInsideInitializerOrConstructor()) {
View Full Code Here


        TypeBinding targetType = (!compileTimeType.isBaseType() && runtimeTimeType.isBaseType())
          ? compileTimeType  // unboxing: checkcast before conversion
          : runtimeTimeType;
          this.genericCast = originalType.genericCast(scope.boxing(targetType));
          if (this.genericCast instanceof ReferenceBinding) {
        ReferenceBinding referenceCast = (ReferenceBinding) this.genericCast;
        if (!referenceCast.canBeSeenBy(scope)) {
              scope.problemReporter().invalidType(this,
                  new ProblemReferenceBinding(
                CharOperation.splitOn('.', referenceCast.shortReadableName()),
                referenceCast,
                ProblemReasons.NotVisible));
        }
          }
    }
View Full Code Here

    case Binding.FIELD : // assigning to a field
      int pc = codeStream.position;
      FieldBinding codegenBinding = ((FieldBinding) this.binding).original();
      if (!codegenBinding.isStatic()) { // need a receiver?
        if ((this.bits & ASTNode.DepthMASK) != 0) {
          ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT);
          Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
          codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
        } else {
          generateReceiver(codeStream);
        }
View Full Code Here

            codeStream.recordPositionsFrom(pc, this.sourceStart);
            return;
          }
          // managing enclosing instance access
          if ((this.bits & ASTNode.DepthMASK) != 0) {
            ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT);
            Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
            codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
          } else {
            generateReceiver(codeStream);
          }
View Full Code Here

        } else {
          codeStream.invoke(Opcodes.OPC_invokestatic, this.syntheticAccessors[SingleNameReference.READ], null /* default declaringClass */);
        }
      } else {
        if ((this.bits & ASTNode.DepthMASK) != 0) {
          ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT);
          Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
          codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
        } else {
          codeStream.aload_0();
        }
View Full Code Here

        } else {
          codeStream.invoke(Opcodes.OPC_invokestatic, this.syntheticAccessors[SingleNameReference.READ], null /* default declaringClass */);
        }
      } else {
        if ((this.bits & ASTNode.DepthMASK) != 0) {
          ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT);
          Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
          codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
        } else {
          codeStream.aload_0();
        }
View Full Code Here

      char[] typeName = currentName.toCharArray();
      compoundName = CharOperation.splitOn('.', typeName);
    } else {
      compoundName = new char[][] { currentName.toCharArray() };
    }
    ReferenceBinding type = environment.getType(compoundName);
    if (type != null && type.isValidBinding()) {
      if (type.isBinaryBinding()) {
        referenceBindings[i] = type;
      }
    } else {
      throw new IllegalArgumentException(
          this.bind("configure.invalidClassName", currentName));//$NON-NLS-1$
View Full Code Here

        TypeBinding targetType = (!compileTimeType.isBaseType() && runtimeTimeType.isBaseType())
          ? compileTimeType  // unboxing: checkcast before conversion
          : runtimeTimeType;
          this.genericCast = originalBinding.type.genericCast(targetType);
          if (this.genericCast instanceof ReferenceBinding) {
        ReferenceBinding referenceCast = (ReferenceBinding) this.genericCast;
        if (!referenceCast.canBeSeenBy(scope)) {
              scope.problemReporter().invalidType(this,
                  new ProblemReferenceBinding(
                CharOperation.splitOn('.', referenceCast.shortReadableName()),
                referenceCast,
                ProblemReasons.NotVisible));
        }
          }
    }
View Full Code Here

      // problem already got signaled on receiver, do not report secondary problem
      return null;
    }
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=245007 avoid secondary errors in case of
    // missing super type for anonymous classes ...
    ReferenceBinding declaringClass = fieldBinding.declaringClass;
    boolean avoidSecondary = declaringClass != null &&
                 declaringClass.isAnonymousType() &&
                 declaringClass.superclass() instanceof MissingTypeBinding;
    if (!avoidSecondary) {
      scope.problemReporter().invalidField(this, this.actualReceiverType);
    }
    if (fieldBinding instanceof ProblemFieldBinding) {
      ProblemFieldBinding problemFieldBinding = (ProblemFieldBinding) fieldBinding;
      FieldBinding closestMatch = problemFieldBinding.closestMatch;
      switch(problemFieldBinding.problemId()) {
        case ProblemReasons.InheritedNameHidesEnclosingName :
        case ProblemReasons.NotVisible :
        case ProblemReasons.NonStaticReferenceInConstructorInvocation :
        case ProblemReasons.NonStaticReferenceInStaticContext :
          if (closestMatch != null) {
            fieldBinding = closestMatch;
          }
      }
    }
    if (!fieldBinding.isValidBinding()) {
      return null;
    }
  }
  // handle indirect inheritance thru variable secondary bound
  // receiver may receive generic cast, as part of implicit conversion
  TypeBinding oldReceiverType = this.actualReceiverType;
  this.actualReceiverType = this.actualReceiverType.getErasureCompatibleType(fieldBinding.declaringClass);
  this.receiver.computeConversion(scope, this.actualReceiverType, this.actualReceiverType);
  if (this.actualReceiverType != oldReceiverType && this.receiver.postConversionType(scope) != this.actualReceiverType) { // record need for explicit cast at codegen since receiver could not handle it
    this.bits |= NeedReceiverGenericCast;
  }
  if (isFieldUseDeprecated(fieldBinding, scope, this.bits)) {
    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))) {
      scope.problemReporter().nonStaticAccessToStaticField(this, fieldBinding);
    }
    ReferenceBinding declaringClass = this.binding.declaringClass;
    if (!isImplicitThisRcv
        && declaringClass != this.actualReceiverType
        && declaringClass.canBeSeenBy(scope)) {
      scope.problemReporter().indirectAccessToStaticField(this, fieldBinding);
    }
    // check if accessing enum static field in initializer
    if (declaringClass.isEnum()) {
      MethodScope methodScope = scope.methodScope();
      SourceTypeBinding sourceType = scope.enclosingSourceType();
      if (this.constant == Constant.NotAConstant
          && !methodScope.isStatic
          && (sourceType == declaringClass || sourceType.superclass == declaringClass) // enum constant body
View Full Code Here

        // user args
        mapParameters(newMethod, ctorDecl);
        // original params are now frozen

        int syntheticParamCount = 0;
        ReferenceBinding declaringClass = b.declaringClass;
        if (declaringClass.isNestedType() && !declaringClass.isStatic()) {
          // add synthetic args for outer this and locals
          NestedTypeBinding nestedBinding = (NestedTypeBinding) declaringClass;
          Set alreadyNamedVariables = new HashSet();
          if (nestedBinding.enclosingInstances != null) {
            for (int i = 0; i < nestedBinding.enclosingInstances.length; ++i) {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding

Copyright © 2018 www.massapicom. 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.