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

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


      DefaultBindingResolver resolver = new DefaultBindingResolver(this.lookupEnvironment, owner, this.bindingTables, (flags & ICompilationUnit.ENABLE_BINDINGS_RECOVERY) != 0);
      Object[] keys = this.requestedKeys.valueTable;
      for (int j = 0, keysLength = keys.length; j < keysLength; j++) {
        BindingKeyResolver keyResolver = (BindingKeyResolver) keys[j];
        if (keyResolver == null) continue;
        Binding compilerBinding = keyResolver.getCompilerBinding();
        IBinding binding = compilerBinding == null ? null : resolver.getBinding(compilerBinding);
        // pass it to requestor
        astRequestor.acceptBinding(((BindingKeyResolver) this.requestedKeys.valueTable[j]).getKey(), binding);
        worked(1);
      }
View Full Code Here


    }
  }

  private void reportBinding(Object key, ASTRequestor astRequestor, WorkingCopyOwner owner, CompilationUnitDeclaration unit) {
    BindingKeyResolver keyResolver = (BindingKeyResolver) key;
    Binding compilerBinding = keyResolver.getCompilerBinding();
    if (compilerBinding != null) {
      DefaultBindingResolver resolver = new DefaultBindingResolver(unit.scope, owner, this.bindingTables, false);
      IBinding binding = resolver.getBinding(compilerBinding);
      if (binding != null)
        astRequestor.acceptBinding(keyResolver.getKey(), binding);
View Full Code Here

      org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode node = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode) this.newAstToOldAst.get(importDeclaration);
      if (node instanceof ImportReference) {
        ImportReference importReference = (ImportReference) node;
        final boolean isStatic = importReference.isStatic();
        if ((importReference.bits & org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode.OnDemand) != 0) {
          Binding binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, importReference.tokens.length), true, isStatic);
          if (binding != null) {
            if (isStatic) {
              if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
                ITypeBinding typeBinding = this.getTypeBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding) binding);
                return typeBinding == null ? null : typeBinding;
              }
            } else {
              if ((binding.kind() & Binding.PACKAGE) != 0) {
                IPackageBinding packageBinding = this.getPackageBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding) binding);
                if (packageBinding == null) {
                  return null;
                }
                return packageBinding;
              } else {
                // if it is not a package, it has to be a type
                ITypeBinding typeBinding = this.getTypeBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding) binding);
                if (typeBinding == null) {
                  return null;
                }
                return typeBinding;
              }
            }
          }
        } else {
          Binding binding = this.scope.getImport(importReference.tokens, false, isStatic);
          if (binding != null) {
            if (isStatic) {
              if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
                ITypeBinding typeBinding = this.getTypeBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding) binding);
                return typeBinding == null ? null : typeBinding;
View Full Code Here

      }
      int indexOfFirstFieldBinding = qualifiedNameReference.indexOfFirstFieldBinding; // one-based
      if (index < indexOfFirstFieldBinding) {
        // an extra lookup is required
        BlockScope internalScope = (BlockScope) this.astNodesToBlockScope.get(name);
        Binding binding = null;
        try {
          if (internalScope == null) {
            if (this.scope == null) return null;
            binding = this.scope.getTypeOrPackage(CharOperation.subarray(tokens, 0, index));
          } else {
            binding = internalScope.getTypeOrPackage(CharOperation.subarray(tokens, 0, index));
          }
        } catch (AbortCompilation e) {
          // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=63550
          // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=64299
        }
        if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding) {
          return null;
        } else if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
          // it is a type
          return this.getTypeBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding)binding);
        }
      } else if (index == indexOfFirstFieldBinding) {
        if (qualifiedNameReference.isTypeReference()) {
          return this.getTypeBinding(qualifiedNameReference.resolvedType);
        } else {
          // in this case we want to get the next field declaring's class
          if (qualifiedNameReference.otherBindings == null) {
            return null;
          }
          FieldBinding fieldBinding = qualifiedNameReference.otherBindings[0];
          if (fieldBinding == null) return null;
          org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding type = fieldBinding.declaringClass;
          if (type == null) { // array length scenario
            // use type from first binding (no capture needed for array type)
            switch (qualifiedNameReference.bits & org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode.RestrictiveFlagMASK) {
              case Binding.FIELD:
                type = ((FieldBinding) qualifiedNameReference.binding).type;
                break;
              case Binding.LOCAL:
                type = ((LocalVariableBinding) qualifiedNameReference.binding).type;
                break;
            }
          }
          return this.getTypeBinding(type);
        }
      } else {
        /* This is the case for a name which is part of a qualified name that
         * cannot be resolved. See PR 13063.
         */
        if (qualifiedNameReference.otherBindings == null) return null;
        final int otherBindingsLength = qualifiedNameReference.otherBindings.length;
        if (otherBindingsLength == (index - indexOfFirstFieldBinding)) {
          return this.getTypeBinding(qualifiedNameReference.resolvedType);
        }
        FieldBinding fieldBinding = qualifiedNameReference.otherBindings[index - indexOfFirstFieldBinding];
        if (fieldBinding == null) return null;
        org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding type = fieldBinding.declaringClass;
        if (type == null) { // array length scenario
          // use type from previous binding (no capture needed for array type)
          fieldBinding = qualifiedNameReference.otherBindings[index - indexOfFirstFieldBinding - 1];
          if (fieldBinding == null) return null;
          type = fieldBinding.type;
        }
        return this.getTypeBinding(type);
      }
    } else if (node instanceof QualifiedTypeReference) {
      QualifiedTypeReference qualifiedTypeReference = (QualifiedTypeReference) node;
      if (qualifiedTypeReference.resolvedType == null) {
        return null;
      }
      if (index == qualifiedTypeReference.tokens.length) {
        if (!qualifiedTypeReference.resolvedType.isValidBinding() && qualifiedTypeReference instanceof JavadocQualifiedTypeReference) {
          JavadocQualifiedTypeReference typeRef = (JavadocQualifiedTypeReference) node;
          if (typeRef.packageBinding != null) {
            return null;
          }
        }
        return this.getTypeBinding(qualifiedTypeReference.resolvedType.leafComponentType());
      } else {
        if (index >= 0) {
          BlockScope internalScope = (BlockScope) this.astNodesToBlockScope.get(name);
          Binding binding = null;
          try {
            if (internalScope == null) {
              if (this.scope == null) return null;
              binding = this.scope.getTypeOrPackage(CharOperation.subarray(qualifiedTypeReference.tokens, 0, index));
            } else {
              binding = internalScope.getTypeOrPackage(CharOperation.subarray(qualifiedTypeReference.tokens, 0, index));
            }
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
          if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding) {
            return null;
          } else if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
            // it is a type
            return this.getTypeBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding)binding);
          } else {
            return null;
          }
        }
      }
    } else if (node instanceof ImportReference) {
      ImportReference importReference = (ImportReference) node;
      int importReferenceLength = importReference.tokens.length;
      if (index >= 0) {
        Binding binding = null;
        if (this.scope == null) return null;
        if (importReferenceLength == index) {
          try {
            binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, index), (importReference.bits & org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode.OnDemand) != 0, importReference.isStatic());
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
        } else {
          try {
            binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, index), true, importReference.isStatic());
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
        }
        if (binding != null) {
          if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
            // it is a type
            return this.getTypeBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding)binding);
          }
          return null;
        }
      }
    } else if (node instanceof AbstractMethodDeclaration) {
      AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) node;
      IMethodBinding method = this.getMethodBinding(methodDeclaration.binding);
      if (method == null) return null;
      return method.getReturnType();
    } else if (node instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) {
      org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) node;
      ITypeBinding typeBinding = this.getTypeBinding(typeDeclaration.binding);
      if (typeBinding != null) {
        return typeBinding;
      }
    } if (node instanceof JavadocSingleNameReference) {
      JavadocSingleNameReference singleNameReference = (JavadocSingleNameReference) node;
      LocalVariableBinding localVariable = (LocalVariableBinding)singleNameReference.binding;
      if (localVariable != null) {
        return this.getTypeBinding(localVariable.type);
      }
    } if (node instanceof SingleNameReference) {
      SingleNameReference singleNameReference = (SingleNameReference) node;
      return this.getTypeBinding(singleNameReference.resolvedType);
    } else if (node instanceof QualifiedSuperReference) {
      QualifiedSuperReference qualifiedSuperReference = (QualifiedSuperReference) node;
      return this.getTypeBinding(qualifiedSuperReference.qualification.resolvedType);
    } else if (node instanceof LocalDeclaration) {
      IVariableBinding variable = this.getVariableBinding(((LocalDeclaration)node).binding);
      if (variable == null) return null;
      return variable.getType();
    } else if (node instanceof JavadocFieldReference) {
      JavadocFieldReference fieldRef = (JavadocFieldReference) node;
      if (fieldRef.methodBinding != null) {
        return getMethodBinding(fieldRef.methodBinding).getReturnType();
      }
      return getTypeBinding(fieldRef.resolvedType);
    } else if (node instanceof FieldReference) {
      return getTypeBinding(((FieldReference) node).resolvedType);
    } else if (node instanceof SingleTypeReference) {
      SingleTypeReference singleTypeReference = (SingleTypeReference) node;
      org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding = singleTypeReference.resolvedType;
      if (binding != null) {
        return this.getTypeBinding(binding.leafComponentType());
      }
    } else if (node instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) {
      org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDeclaration = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) node;
      IVariableBinding field = this.getVariableBinding(fieldDeclaration.binding);
      if (field == null) return null;
View Full Code Here

      final char[][] tokens = qualifiedNameReference.tokens;
      int indexOfFirstFieldBinding = qualifiedNameReference.indexOfFirstFieldBinding; // one-based
      if (index < indexOfFirstFieldBinding) {
        // an extra lookup is required
        BlockScope internalScope = (BlockScope) this.astNodesToBlockScope.get(name);
        Binding binding = null;
        try {
          if (internalScope == null) {
            if (this.scope == null) return null;
            binding = this.scope.getTypeOrPackage(CharOperation.subarray(tokens, 0, index));
          } else {
            binding = internalScope.getTypeOrPackage(CharOperation.subarray(tokens, 0, index));
          }
        } catch (AbortCompilation e) {
          // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=63550
          // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=64299
        }
        if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding) {
          return this.getPackageBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding)binding);
        } else if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
          // it is a type
          return this.getTypeBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding)binding);
        }
      } else if (index == indexOfFirstFieldBinding) {
        if (qualifiedNameReference.isTypeReference()) {
          return this.getTypeBinding(qualifiedNameReference.resolvedType);
        } else {
          Binding binding = qualifiedNameReference.binding;
          if (binding != null) {
            if (binding.isValidBinding()) {
              return this.getVariableBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.VariableBinding) binding);
            } else  if (binding instanceof ProblemFieldBinding) {
              ProblemFieldBinding problemFieldBinding = (ProblemFieldBinding) binding;
              switch(problemFieldBinding.problemId()) {
                case ProblemReasons.NotVisible :
                case ProblemReasons.NonStaticReferenceInStaticContext :
                  ReferenceBinding declaringClass = problemFieldBinding.declaringClass;
                  if (declaringClass != null) {
                    FieldBinding exactBinding = declaringClass.getField(tokens[tokens.length - 1], true /*resolve*/);
                    if (exactBinding != null) {
                      if (exactBinding.type != null) {
                        IVariableBinding variableBinding = (IVariableBinding) this.bindingTables.compilerBindingsToASTBindings.get(exactBinding);
                        if (variableBinding != null) {
                          return variableBinding;
                        }
                        variableBinding = new VariableBinding(this, exactBinding);
                        this.bindingTables.compilerBindingsToASTBindings.put(exactBinding, variableBinding);
                        return variableBinding;
                      }
                    }
                  }
                  break;
              }
            }
          }
        }
      } else {
        /* This is the case for a name which is part of a qualified name that
         * cannot be resolved. See PR 13063.
         */
        if (qualifiedNameReference.otherBindings == null || (index - indexOfFirstFieldBinding - 1) < 0) {
          return null;
        } else {
          return this.getVariableBinding(qualifiedNameReference.otherBindings[index - indexOfFirstFieldBinding - 1]);
        }
      }
    } else if (node instanceof QualifiedTypeReference) {
      QualifiedTypeReference qualifiedTypeReference = (QualifiedTypeReference) node;
      if (qualifiedTypeReference.resolvedType == null) {
        return null;
      }
      if (index == qualifiedTypeReference.tokens.length) {
        if (!qualifiedTypeReference.resolvedType.isValidBinding() && qualifiedTypeReference instanceof JavadocQualifiedTypeReference) {
          JavadocQualifiedTypeReference typeRef = (JavadocQualifiedTypeReference) node;
          if (typeRef.packageBinding != null) {
            return getPackageBinding(typeRef.packageBinding);
          }
        }
        return this.getTypeBinding(qualifiedTypeReference.resolvedType.leafComponentType());
      } else {
        if (index >= 0) {
          BlockScope internalScope = (BlockScope) this.astNodesToBlockScope.get(name);
          Binding binding = null;
          try {
            if (internalScope == null) {
              if (this.scope == null) return null;
              binding = this.scope.getTypeOrPackage(CharOperation.subarray(qualifiedTypeReference.tokens, 0, index));
            } else {
              binding = internalScope.getTypeOrPackage(CharOperation.subarray(qualifiedTypeReference.tokens, 0, index));
            }
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
          if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding) {
            return this.getPackageBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding)binding);
          } else if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
            // it is a type
            return this.getTypeBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding)binding);
          } else {
            return null;
          }
        }
      }
    } else if (node instanceof ImportReference) {
      ImportReference importReference = (ImportReference) node;
      int importReferenceLength = importReference.tokens.length;
      if (index >= 0) {
        Binding binding = null;
        if (this.scope == null) return null;
        if (importReferenceLength == index) {
          try {
            binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, index), (importReference.bits & org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode.OnDemand) != 0, importReference.isStatic());
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
        } else {
          try {
            binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, index), true, importReference.isStatic());
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
        }
        if (binding != null) {
          if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding) {
            return this.getPackageBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding)binding);
          } else if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
            // it is a type
            return this.getTypeBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding)binding);
          } else if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding) {
            // it is a type
            return this.getVariableBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding)binding);
          } else if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding) {
            // it is a type
            return this.getMethodBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding)binding);
          } else {
            return null;
          }
        }
      }
    } else if (node instanceof CompilationUnitDeclaration) {
      CompilationUnitDeclaration compilationUnitDeclaration = (CompilationUnitDeclaration) node;
      org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] types = compilationUnitDeclaration.types;
      if (types == null || types.length == 0) {
        return null;
      }
      org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration type = types[0];
      if (type != null) {
        ITypeBinding typeBinding = this.getTypeBinding(type.binding);
        if (typeBinding != null) {
          return typeBinding.getPackage();
        }
      }
    } else if (node instanceof AbstractMethodDeclaration) {
      AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) node;
      IMethodBinding methodBinding = this.getMethodBinding(methodDeclaration.binding);
      if (methodBinding != null) {
        return methodBinding;
      }
    } else if (node instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) {
      org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) node;
      ITypeBinding typeBinding = this.getTypeBinding(typeDeclaration.binding);
      if (typeBinding != null) {
        return typeBinding;
      }
    } if (node instanceof SingleNameReference) {
      SingleNameReference singleNameReference = (SingleNameReference) node;
      if (singleNameReference.isTypeReference()) {
        return this.getTypeBinding(singleNameReference.resolvedType);
      } else {
        // this is a variable or a field
        Binding binding = singleNameReference.binding;
        if (binding != null) {
          if (binding.isValidBinding()) {
            return this.getVariableBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.VariableBinding) binding);
          } else {
            /*
             * http://dev.eclipse.org/bugs/show_bug.cgi?id=24449
             */
            if (binding instanceof ProblemFieldBinding) {
              ProblemFieldBinding problemFieldBinding = (ProblemFieldBinding) binding;
              switch(problemFieldBinding.problemId()) {
                case ProblemReasons.NotVisible :
                case ProblemReasons.NonStaticReferenceInStaticContext :
                case ProblemReasons.NonStaticReferenceInConstructorInvocation :
                  ReferenceBinding declaringClass = problemFieldBinding.declaringClass;
                  FieldBinding exactBinding = declaringClass.getField(problemFieldBinding.name, true /*resolve*/);
                  if (exactBinding != null) {
                    if (exactBinding.type != null) {
                      IVariableBinding variableBinding2 = (IVariableBinding) this.bindingTables.compilerBindingsToASTBindings.get(exactBinding);
                      if (variableBinding2 != null) {
                        return variableBinding2;
                      }
                      variableBinding2 = new VariableBinding(this, exactBinding);
                      this.bindingTables.compilerBindingsToASTBindings.put(exactBinding, variableBinding2);
                      return variableBinding2;
                    }
                  }
                  break;
              }
            }
          }
         }
      }
    } else if (node instanceof QualifiedSuperReference) {
      QualifiedSuperReference qualifiedSuperReference = (QualifiedSuperReference) node;
      return this.getTypeBinding(qualifiedSuperReference.qualification.resolvedType);
    } else if (node instanceof LocalDeclaration) {
      return this.getVariableBinding(((LocalDeclaration)node).binding);
    } else if (node instanceof JavadocFieldReference) {
      JavadocFieldReference fieldRef = (JavadocFieldReference) node;
      if (fieldRef.methodBinding != null) {
        return getMethodBinding(fieldRef.methodBinding);
      }
      return getVariableBinding(fieldRef.binding);
    } else if (node instanceof FieldReference) {
      return getVariableBinding(((FieldReference) node).binding);
    } else if (node instanceof SingleTypeReference) {
      SingleTypeReference singleTypeReference = (SingleTypeReference) node;
      org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding = singleTypeReference.resolvedType;
      if (binding != null) {
        if (!binding.isValidBinding() && node instanceof JavadocSingleTypeReference) {
          JavadocSingleTypeReference typeRef = (JavadocSingleTypeReference) node;
          if (typeRef.packageBinding != null) {
            return getPackageBinding(typeRef.packageBinding);
          }
        }
        return this.getTypeBinding(binding.leafComponentType());
      }
    } else if (node instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) {
      org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDeclaration = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) node;
      return this.getVariableBinding(fieldDeclaration.binding);
    } else if (node instanceof MessageSend) {
View Full Code Here

    if (this.scope == null) return null;
    try {
      org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode node = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode) this.newAstToOldAst.get(pkg);
      if (node instanceof ImportReference) {
        ImportReference importReference = (ImportReference) node;
        Binding binding = this.scope.getTypeOrPackage(CharOperation.subarray(importReference.tokens, 0, importReference.tokens.length));
        if ((binding != null) && (binding.isValidBinding())) {
          if (binding instanceof ReferenceBinding) {
            // this only happens if a type name has the same name as its package
            ReferenceBinding referenceBinding = (ReferenceBinding) binding;
            binding = referenceBinding.fPackage;
          }
View Full Code Here

      if (tvb != null) {
        return tvb;
      }
    }
    if (tvBinding == null) {
      Binding declaringElement = null;
      // this will cause an infinite loop or NPE... not required yet luckily.
      // if (tVar.getDeclaringElement() instanceof Member) {
      // declaringElement = makeMethodBinding((ResolvedMember)tVar.getDeclaringElement());
      // } else {
      // declaringElement = makeTypeBinding((UnresolvedType)tVar.getDeclaringElement());
View Full Code Here

    if (this.resolvedType != null) // is a shared type reference which was already resolved
      return this.resolvedType.isValidBinding() ? this.resolvedType : null; // already reported error

    this.resolvedType = getTypeBinding(scope);
    if (!this.resolvedType.isValidBinding()) {
      Binding binding = scope.getTypeOrPackage(this.tokens);
      if (binding instanceof PackageBinding) {
        this.packageBinding = (PackageBinding) binding;
      } else {
        reportInvalidType(scope);
      }
View Full Code Here

          org.aspectj.org.eclipse.jdt.internal.core.util.Util.log(e, "Could not retrieve declaring method"); //$NON-NLS-1$
        }
      }
    } else if (this.binding.isTypeVariable()) {
      TypeVariableBinding typeVariableBinding = (TypeVariableBinding) this.binding;
      Binding declaringElement = typeVariableBinding.declaringElement;
      if (declaringElement instanceof MethodBinding) {
        try {
          return this.resolver.getMethodBinding((MethodBinding)declaringElement);
        } catch (RuntimeException e) {
          /* in case a method cannot be resolvable due to missing jars on the classpath
View Full Code Here

          org.aspectj.org.eclipse.jdt.internal.core.util.Util.log(e, "Could not retrieve declaring class"); //$NON-NLS-1$
        }
      }
    } else if (this.binding.isTypeVariable()) {
      TypeVariableBinding typeVariableBinding = (TypeVariableBinding) this.binding;
      Binding declaringElement = typeVariableBinding.isCapture() ? ((CaptureBinding) typeVariableBinding).sourceType : typeVariableBinding.declaringElement;
      if (declaringElement instanceof ReferenceBinding) {
        try {
          return this.resolver.getTypeBinding((ReferenceBinding)declaringElement);
        } catch (RuntimeException e) {
          /* in case a method cannot be resolvable due to missing jars on the classpath
View Full Code Here

TOP

Related Classes of org.aspectj.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.