Examples of ProblemBinding


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

      invocationSite.setFieldIndex(currentIndex);
       if (binding == null) {
         if (currentIndex == length) // must be a type if its the last name, otherwise we have no idea if its a package or type
          return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), null, ProblemReasons.NotFound);
        else
          return new ProblemBinding(CharOperation.subarray(compoundName, 0, currentIndex), ProblemReasons.NotFound);
       }
       if (binding instanceof ReferenceBinding) {
         if (!binding.isValidBinding())
          return new ProblemReferenceBinding(
                  CharOperation.subarray(compoundName, 0, currentIndex),
                  ((ReferenceBinding)binding).closestMatch(),
                  binding.problemId());
         if (!this.canBeSeenByForCodeSnippet((ReferenceBinding) binding, receiverType))
          return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), (ReferenceBinding) binding, ProblemReasons.NotVisible);
         break foundType;
       }
       packageBinding = (PackageBinding) binding;
    }

    // It is illegal to request a PACKAGE from this method.
    return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), null, ProblemReasons.NotFound);
  }

  // know binding is now a ReferenceBinding
  while (currentIndex < length) {
    ReferenceBinding typeBinding = (ReferenceBinding) binding;
    char[] nextName = compoundName[currentIndex++];
    invocationSite.setFieldIndex(currentIndex);
    if ((binding = findFieldForCodeSnippet(typeBinding, nextName, invocationSite)) != null) {
      if (!binding.isValidBinding()) {
        return new ProblemFieldBinding(
            (FieldBinding)binding,
            ((FieldBinding)binding).declaringClass,
            CharOperation.concatWith(CharOperation.subarray(compoundName, 0, currentIndex), '.'),
            binding.problemId());
      }
      break; // binding is now a field
    }
    if ((binding = findMemberType(nextName, typeBinding)) == null)
      return new ProblemBinding(CharOperation.subarray(compoundName, 0, currentIndex), typeBinding, ProblemReasons.NotFound);
     if (!binding.isValidBinding())
      return new ProblemReferenceBinding(
                CharOperation.subarray(compoundName, 0, currentIndex),
                ((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);
    }
    return binding;
  }
  if ((mask & Binding.TYPE) != 0 && (binding instanceof ReferenceBinding)) { // was looking for a type and found a type
    return binding;
  }

  // handle the case when a field or type was asked for but we resolved the compoundName to a type or field
  return new ProblemBinding(CharOperation.subarray(compoundName, 0, currentIndex), ProblemReasons.NotFound);
}
View Full Code Here

Examples of org.eclipse.cdt.internal.core.dom.parser.ProblemBinding

   * element that can be traced back to a protocol buffer element.
   */
  public CppToProtobufMapping createMappingFrom(IBinding binding) {
    IBinding bindingToUse = binding;
    if (binding instanceof ProblemBinding) {
      ProblemBinding problemBinding = (ProblemBinding) binding;
      IBinding[] candidates = problemBinding.getCandidateBindings();
      if (candidates != null && candidates.length == 1) {
        bindingToUse = candidates[0];
      }
    }
    IBindingMappingStrategy<?> strategy = strategies.get(bindingToUse.getClass());
View Full Code Here

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

      invocationSite.setFieldIndex(currentIndex);
       if (binding == null) {
         if (currentIndex == length) // must be a type if its the last name, otherwise we have no idea if its a package or type
          return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), null, ProblemReasons.NotFound);
        else
          return new ProblemBinding(CharOperation.subarray(compoundName, 0, currentIndex), ProblemReasons.NotFound);
       }
       if (binding instanceof ReferenceBinding) {
         if (!binding.isValidBinding())
          return new ProblemReferenceBinding(
                  CharOperation.subarray(compoundName, 0, currentIndex),
                  (ReferenceBinding)((ReferenceBinding)binding).closestMatch(),
                  binding.problemId());
         if (!this.canBeSeenByForCodeSnippet((ReferenceBinding) binding, receiverType))
          return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), (ReferenceBinding) binding, ProblemReasons.NotVisible);
         break foundType;
       }
       packageBinding = (PackageBinding) binding;
    }

    // It is illegal to request a PACKAGE from this method.
    return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), null, ProblemReasons.NotFound);
  }

  // know binding is now a ReferenceBinding
  while (currentIndex < length) {
    ReferenceBinding typeBinding = (ReferenceBinding) binding;
    char[] nextName = compoundName[currentIndex++];
    invocationSite.setFieldIndex(currentIndex);
    if ((binding = findFieldForCodeSnippet(typeBinding, nextName, invocationSite)) != null) {
      if (!binding.isValidBinding()) {
        return new ProblemFieldBinding(
            (FieldBinding)binding,
            ((FieldBinding)binding).declaringClass,
            CharOperation.concatWith(CharOperation.subarray(compoundName, 0, currentIndex), '.'),
            binding.problemId());
      }
      break; // binding is now a field
    }
    if ((binding = findMemberType(nextName, typeBinding)) == null)
      return new ProblemBinding(CharOperation.subarray(compoundName, 0, currentIndex), typeBinding, ProblemReasons.NotFound);
     if (!binding.isValidBinding())
      return new ProblemReferenceBinding(
                CharOperation.subarray(compoundName, 0, currentIndex),
                (ReferenceBinding)((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);
    }
    return binding;
  }
  if ((mask & Binding.TYPE) != 0 && (binding instanceof ReferenceBinding)) { // was looking for a type and found a type
    return binding;
  }

  // handle the case when a field or type was asked for but we resolved the compoundName to a type or field
  return new ProblemBinding(CharOperation.subarray(compoundName, 0, currentIndex), ProblemReasons.NotFound);
}
View Full Code Here

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

      invocationSite.setFieldIndex(currentIndex);
       if (binding == null) {
         if (currentIndex == length) // must be a type if its the last name, otherwise we have no idea if its a package or type
          return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), null, ProblemReasons.NotFound);
        else
          return new ProblemBinding(CharOperation.subarray(compoundName, 0, currentIndex), ProblemReasons.NotFound);
       }
       if (binding instanceof ReferenceBinding) {
         if (!binding.isValidBinding())
          return new ProblemReferenceBinding(
                  CharOperation.subarray(compoundName, 0, currentIndex),
                  (ReferenceBinding)((ReferenceBinding)binding).closestMatch(),
                  binding.problemId());
         if (!this.canBeSeenByForCodeSnippet((ReferenceBinding) binding, receiverType))
          return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), (ReferenceBinding) binding, ProblemReasons.NotVisible);
         break foundType;
       }
       packageBinding = (PackageBinding) binding;
    }

    // It is illegal to request a PACKAGE from this method.
    return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), null, ProblemReasons.NotFound);
  }

  // know binding is now a ReferenceBinding
  while (currentIndex < length) {
    ReferenceBinding typeBinding = (ReferenceBinding) binding;
    char[] nextName = compoundName[currentIndex++];
    invocationSite.setFieldIndex(currentIndex);
    if ((binding = findFieldForCodeSnippet(typeBinding, nextName, invocationSite)) != null) {
      if (!binding.isValidBinding()) {
        return new ProblemFieldBinding(
            (FieldBinding)binding,
            ((FieldBinding)binding).declaringClass,
            CharOperation.concatWith(CharOperation.subarray(compoundName, 0, currentIndex), '.'),
            binding.problemId());
      }
      break; // binding is now a field
    }
    if ((binding = findMemberType(nextName, typeBinding)) == null)
      return new ProblemBinding(CharOperation.subarray(compoundName, 0, currentIndex), typeBinding, ProblemReasons.NotFound);
     if (!binding.isValidBinding())
      return new ProblemReferenceBinding(
                CharOperation.subarray(compoundName, 0, currentIndex),
                (ReferenceBinding)((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);
    }
    // Since a qualified reference must be for a static member, it won't affect static-ness of the enclosing method,
    // so we don't have to call resetEnclosingMethodStaticFlag() in this case
    return binding;
  }
  if ((mask & Binding.TYPE) != 0 && (binding instanceof ReferenceBinding)) { // was looking for a type and found a type
    return binding;
  }

  // handle the case when a field or type was asked for but we resolved the compoundName to a type or field
  return new ProblemBinding(CharOperation.subarray(compoundName, 0, currentIndex), ProblemReasons.NotFound);
}
View Full Code Here

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

      invocationSite.setFieldIndex(currentIndex);
       if (binding == null) {
         if (currentIndex == length) // must be a type if its the last name, otherwise we have no idea if its a package or type
          return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), null, ProblemReasons.NotFound);
        else
          return new ProblemBinding(CharOperation.subarray(compoundName, 0, currentIndex), ProblemReasons.NotFound);
       }
       if (binding instanceof ReferenceBinding) {
         if (!binding.isValidBinding())
          return new ProblemReferenceBinding(
                  CharOperation.subarray(compoundName, 0, currentIndex),
                  (ReferenceBinding)((ReferenceBinding)binding).closestMatch(),
                  binding.problemId());
         if (!this.canBeSeenByForCodeSnippet((ReferenceBinding) binding, receiverType))
          return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), (ReferenceBinding) binding, ProblemReasons.NotVisible);
         break foundType;
       }
       packageBinding = (PackageBinding) binding;
    }

    // It is illegal to request a PACKAGE from this method.
    return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), null, ProblemReasons.NotFound);
  }

  // know binding is now a ReferenceBinding
  while (currentIndex < length) {
    ReferenceBinding typeBinding = (ReferenceBinding) binding;
    char[] nextName = compoundName[currentIndex++];
    invocationSite.setFieldIndex(currentIndex);
    if ((binding = findFieldForCodeSnippet(typeBinding, nextName, invocationSite)) != null) {
      if (!binding.isValidBinding()) {
        return new ProblemFieldBinding(
            (FieldBinding)binding,
            ((FieldBinding)binding).declaringClass,
            CharOperation.concatWith(CharOperation.subarray(compoundName, 0, currentIndex), '.'),
            binding.problemId());
      }
      break; // binding is now a field
    }
    if ((binding = findMemberType(nextName, typeBinding)) == null)
      return new ProblemBinding(CharOperation.subarray(compoundName, 0, currentIndex), typeBinding, ProblemReasons.NotFound);
     if (!binding.isValidBinding())
      return new ProblemReferenceBinding(
                CharOperation.subarray(compoundName, 0, currentIndex),
                (ReferenceBinding)((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);
    }
    // Since a qualified reference must be for a static member, it won't affect static-ness of the enclosing method,
    // so we don't have to call resetEnclosingMethodStaticFlag() in this case
    return binding;
  }
  if ((mask & Binding.TYPE) != 0 && (binding instanceof ReferenceBinding)) { // was looking for a type and found a type
    return binding;
  }

  // handle the case when a field or type was asked for but we resolved the compoundName to a type or field
  return new ProblemBinding(CharOperation.subarray(compoundName, 0, currentIndex), ProblemReasons.NotFound);
}
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.