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

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


  ReferenceBinding currentType = (ReferenceBinding) receiverType;
  if (!currentType.canBeSeenBy(this))
    return new ProblemFieldBinding(currentType, fieldName, ProblemReasons.ReceiverTypeNotVisible);

  FieldBinding field = currentType.getField(fieldName, true /*resolve*/);
  if (field != null) {
    if (canBeSeenByForCodeSnippet(field, currentType, invocationSite, this))
      return field;
    else
      return new ProblemFieldBinding(field /* closest match*/, field.declaringClass, fieldName, ProblemReasons.NotVisible);
  }

  // collect all superinterfaces of receiverType until the field is found in a supertype
  ReferenceBinding[][] interfacesToVisit = null;
  int lastPosition = -1;
  FieldBinding visibleField = null;
  boolean keepLooking = true;
  boolean notVisible = false; // we could hold onto the not visible field for extra error reporting
  while (keepLooking) {
    ReferenceBinding[] itsInterfaces = currentType.superInterfaces();
    if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
View Full Code Here


                ((ReferenceBinding)binding).closestMatch(),
                binding.problemId());
  }

  if ((mask & Binding.FIELD) != 0 && (binding instanceof FieldBinding)) { // was looking for a field and found a field
    FieldBinding field = (FieldBinding) binding;
    if (!field.isStatic()) {
      return new ProblemFieldBinding(
          field,
          field.declaringClass,
          CharOperation.concatWith(CharOperation.subarray(compoundName, 0, currentIndex), '.'),
          ProblemReasons.NonStaticReferenceInStaticContext);
View Full Code Here

  If no visible field is discovered, an error binding is answered.
*/

public FieldBinding getFieldForCodeSnippet(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite) {
  FieldBinding field = findFieldForCodeSnippet(receiverType, fieldName, invocationSite);
  if (field == null)
    return new ProblemFieldBinding(receiverType instanceof ReferenceBinding ? (ReferenceBinding) receiverType : null, fieldName, ProblemReasons.NotFound);
  else
    return field;
}
View Full Code Here

      }
    }

    FieldBinding[] fields = binding.fields();
    for (int i = 0, len = fields.length; i < len; i++) {
      FieldBinding f = fields[i];
      declaredFields.add(factory.makeResolvedMember(f));
    }

    this.declaredPointcuts = declaredPointcuts.toArray(new ResolvedPointcutDefinition[declaredPointcuts.size()]);
    this.declaredMethods = declaredMethods.toArray(new ResolvedMember[declaredMethods.size()]);
View Full Code Here

  }

  private AnnotationValue generateElementValueForNonConstantExpression(Expression defaultValue, TypeBinding defaultValueBinding) {
    if (defaultValueBinding != null) {
      if (defaultValueBinding.isEnum()) {
        FieldBinding fieldBinding = null;
        if (defaultValue instanceof QualifiedNameReference) {
          QualifiedNameReference nameReference = (QualifiedNameReference) defaultValue;
          fieldBinding = (FieldBinding) nameReference.binding;
        } else if (defaultValue instanceof SingleNameReference) {
          SingleNameReference nameReference = (SingleNameReference) defaultValue;
View Full Code Here

        // !!! understand and fix this case later
        receiverType = ref.otherBindings[0].declaringClass;
      }
      boolean cont = true; // don't continue if we come across a problem
      for (int i = 0, len = ref.otherBindings.length; i < len && cont; i++) {
        FieldBinding binding = ref.otherBindings[i];
        ref.otherBindings[i] = getAccessibleField(binding, receiverType);
        if (!(binding instanceof ProblemFieldBinding) && binding != null)
          receiverType = binding.type; // TODO Why is this sometimes null?
        else
          cont = false;
View Full Code Here

    }

    ResolvedMember m = world.makeResolvedMember(binding, receiverType);
    if (inAspect.accessForInline.containsKey(m))
      return (FieldBinding) inAspect.accessForInline.get(m);
    FieldBinding ret = new InlineAccessFieldBinding(inAspect, binding, m);

    // System.err.println("   made accessor: " + ret);

    inAspect.accessForInline.put(m, ret);
    return ret;
View Full Code Here

    EclipseFactory factory = ((AjLookupEnvironment) method.scope.environment()).factory;
    if (depthCounter != 0 && targetClass.isInterface()) {// pr198196 - when calling MarkerInterface.super.XXX()
      if (call.isSuperAccess() && !call.binding.isStatic()) {
        MethodScope currentMethodScope = scope.methodScope();
        SourceTypeBinding sourceType = currentMethodScope.enclosingSourceType();
        FieldBinding field = sourceType.addSyntheticFieldForInnerclass(targetClass);
        call.receiver = new KnownFieldReference(field, call.receiver.sourceStart, call.receiver.sourceEnd);
      } else {
        return;
      }
    } else if (depthCounter == 0) { // Allow case testSuperItds_pr198196_2/3
View Full Code Here

  private static AnnotationValue generateElementValueForNonConstantExpression(Expression defaultValue,
      TypeBinding defaultValueBinding) {
    if (defaultValueBinding != null) {
      if (defaultValueBinding.isEnum()) {
        FieldBinding fieldBinding = null;
        if (defaultValue instanceof QualifiedNameReference) {
          QualifiedNameReference nameReference = (QualifiedNameReference) defaultValue;
          fieldBinding = (FieldBinding) nameReference.binding;
        } else if (defaultValue instanceof SingleNameReference) {
          SingleNameReference nameReference = (SingleNameReference) defaultValue;
View Full Code Here

      // check missing blank final field initializations
      flowInfo = flowInfo.mergedWith(staticInitializerFlowContext.initsOnReturn);
      FieldBinding[] fields = scope.enclosingSourceType().fields();
      for (int i = 0, count = fields.length; i < count; i++) {
        FieldBinding field;
        if ((field = fields[i]).isStatic()
          && field.isFinal()
          && (!flowInfo.isDefinitelyAssigned(fields[i]))) {
          scope.problemReporter().uninitializedBlankFinalField(
            field,
            scope.referenceType().declarationOf(field.original()));
          // can complain against the field decl, since only one <clinit>
        }
      }
      // check static initializers thrown exceptions
      staticInitializerFlowContext.checkInitializerExceptions(
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding

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.