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

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


            return false;
        }
        if (t1 == t2) {
            return true;
        }
        Binding b1 = ((TypeMirrorImpl)t1).binding();
        Binding b2 = ((TypeMirrorImpl)t2).binding();
        if (b1 == b2) {
            return true;
        }
        if (!(b1 instanceof TypeBinding) || !(b2 instanceof TypeBinding)) {
            // package, method, import, etc.
            return false;
        }
        if (b1.kind() == Binding.BASE_TYPE || b2.kind() == Binding.BASE_TYPE) {
            if (b1.kind() != b2.kind()) {
                return false;
            }
            else {
                // for primitives, compatibility implies subtype
                return ((TypeBinding)b1).isCompatibleWith((TypeBinding)b2);
View Full Code Here


  /* (non-Javadoc)
   * @see org.eclipse.jdt.internal.core.SourceMethod#getKey()
   */
  public String getKey() {
    if (this.uniqueKey == null) {
      Binding binding = (Binding) this.bindingCache.get(this);
      if (binding != null) {
        this.isResolved = true;
        this.uniqueKey = new String(binding.computeUniqueKey());
      } else {
        this.isResolved = false;
        try {
          this.uniqueKey = getKey(this, false/*don't open*/);
        } catch (JavaModelException e) {
View Full Code Here

    }
  }
  private void internalResolve(Scope scope, boolean staticContext) {
      // detect variable/type name collisions
    if (this.binding != null) {
      Binding existingType = scope.parent.getBinding(this.name, Binding.TYPE, this, false/*do not resolve hidden field*/);
      if (existingType != null
          && this.binding != existingType
          && existingType.isValidBinding()
          && (existingType.kind() != Binding.TYPE_PARAMETER || !staticContext)) {
        scope.problemReporter().typeHiding(this, existingType);
      }
    }
    if (this.annotations != null) {
      resolveAnnotations(scope);
View Full Code Here

    // variable (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=204749)
    if (this.resolvedType == null) return null;

    if (!this.resolvedType.isValidBinding()) {
      char[][] tokens = { this.token };
      Binding binding = scope.getTypeOrPackage(tokens);
      if (binding instanceof PackageBinding) {
        this.packageBinding = (PackageBinding) binding;
        // Valid package references are allowed in Javadoc (https://bugs.eclipse.org/bugs/show_bug.cgi?id=281609)
      } else {
        if (this.resolvedType.problemId() == ProblemReasons.NonStaticReferenceInStaticContext) {
View Full Code Here

  }

  public void consumeAnnotation() {
    int size = this.types.size();
    if (size == 0) return;
    Binding annotationType = ((BindingKeyResolver) this.types.get(size-1)).compilerBinding;
    AnnotationBinding[] annotationBindings;
    if (this.compilerBinding == null && this.typeBinding instanceof ReferenceBinding) {
      annotationBindings = ((ReferenceBinding) this.typeBinding).getAnnotations();
    } else if (this.compilerBinding instanceof MethodBinding) {
      annotationBindings = ((MethodBinding) this.compilerBinding).getAnnotations();
View Full Code Here

    consumeAnyCapture(-1, position);
  }
  public void consumeAnyCapture(final int capture18id, final int position) {
    CompilationUnitDeclaration outerParsedUnit = this.outerMostParsedUnit == null ? this.parsedUnit : this.outerMostParsedUnit;
    if (outerParsedUnit == null) return;
    final Binding wildcardBinding = this.types.size() > // 0 may happen for CaptureBinding18
        ? ((BindingKeyResolver) this.types.get(0)).compilerBinding : null;
    class CaptureFinder extends ASTVisitor {
      CaptureBinding capture;
      boolean checkType(TypeBinding binding) {
        if (binding == null)
View Full Code Here

      case Wildcard.EXTENDS:
      case Wildcard.SUPER:
        BindingKeyResolver boundResolver = (BindingKeyResolver) this.types.get(0);
        // https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847, do not allow creation of
        // internally inconsistent wildcards of the form '? super <null>' or '? extends <null>'
        final Binding boundBinding = boundResolver.compilerBinding;
        if (boundBinding instanceof TypeBinding) {
          this.typeBinding = this.environment.createWildcard((ReferenceBinding) this.typeBinding, this.wildcardRank, (TypeBinding) boundBinding, null /*no extra bound*/, kind);
        } else {
          this.typeBinding = null;
        }
View Full Code Here

* by a super type or because it *is* raw and the current type has no control over it (i.e the rawness
* originates from some other file.)
*/
public boolean forcedToBeRaw(ReferenceContext referenceContext) {
  if (this instanceof NameReference) {
    final Binding receiverBinding = ((NameReference) this).binding;
    if (receiverBinding.isParameter() && (((LocalVariableBinding) receiverBinding).tagBits & TagBits.ForcedToBeRawType) != 0) {
      return true// parameter is forced to be raw since super method uses raw types.
    } else if (receiverBinding instanceof FieldBinding) {
      FieldBinding field = (FieldBinding) receiverBinding;
      if (field.type.isRawType()) {
        if (referenceContext instanceof AbstractMethodDeclaration) {
View Full Code Here

    // End resolution when getTypeBinding(scope) returns null. This may happen in
    // certain circumstances, typically when an illegal access is done on a type
    // variable (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=204749)
    if (type == null) return null;
    if (!type.isValidBinding()) {
      Binding binding = scope.getTypeOrPackage(this.tokens);
      if (binding instanceof PackageBinding) {
        this.packageBinding = (PackageBinding) binding;
        // Valid package references are allowed in Javadoc (https://bugs.eclipse.org/bugs/show_bug.cgi?id=281609)
      } else {
        reportInvalidType(scope);
View Full Code Here

  /* (non-Javadoc)
   * @see org.eclipse.jdt.internal.core.SourceType#getKey()
   */
  public String getKey() {
    if (this.uniqueKey == null) {
      Binding binding = (Binding) this.bindingCache.get(this);
      if (binding != null) {
        this.isResolved = true;
        this.uniqueKey = new String(binding.computeUniqueKey());
      } else {
        this.isResolved = false;
        try {
          this.uniqueKey = getKey(this, false/*don't open*/);
        } catch (JavaModelException e) {
View Full Code Here

TOP

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

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.