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

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


    }
  }

  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, this.fromJavaProject);
      AnnotationBinding annotationBinding = keyResolver.getAnnotationBinding();
      IBinding binding;
      if (annotationBinding != null) {
View Full Code Here


    }
  }

  private void reportBinding(Object key, FileASTRequestor astRequestor, CompilationUnitDeclaration unit) {
    BindingKeyResolver keyResolver = (BindingKeyResolver) key;
    Binding compilerBinding = keyResolver.getCompilerBinding();
    if (compilerBinding != null) {
      DefaultBindingResolver resolver = new DefaultBindingResolver(unit.scope, null, this.bindingTables, false, this.fromJavaProject);
      AnnotationBinding annotationBinding = keyResolver.getAnnotationBinding();
      IBinding binding;
      if (annotationBinding != null) {
View Full Code Here

    private JExpression resolveNameReference(NameReference x, BlockScope scope) {
      SourceInfo info = makeSourceInfo(x);
      if (x.constant != Constant.NotAConstant) {
        return getConstant(info, x.constant);
      }
      Binding binding = x.binding;
      JExpression result = null;
      if (binding instanceof LocalVariableBinding) {
        LocalVariableBinding b = (LocalVariableBinding) binding;
        if ((x.bits & ASTNode.DepthMASK) != 0) {
          VariableBinding[] path = scope.getEmulationPath(b);
View Full Code Here

      public void endVisit(JsNameRef x, JsContext ctx) {
        if (!x.isJsniReference()) {
          return;
        }
        String ident = x.getIdent();
        Binding binding = jsniRefs.get(ident);
        SourceInfo info = x.getSourceInfo();
        assert binding != null;
        if (binding instanceof TypeBinding) {
          JType type = typeMap.get((TypeBinding) binding);
          processClassLiteral(x, info, type, ctx);
View Full Code Here

      return call;
    }

    JExpression processExpression(QualifiedNameReference x) {
      SourceInfo info = makeSourceInfo(x);
      Binding binding = x.binding;
      JNode node = typeMap.get(binding);
      if (!(node instanceof JVariable)) {
        return null;
      }
      JVariable variable = (JVariable) node;
View Full Code Here

      return processQualifiedThisOrSuperRef(x, qualType);
    }

    JExpression processExpression(SingleNameReference x) {
      SourceInfo info = makeSourceInfo(x);
      Binding binding = x.binding;
      Object target = typeMap.get(binding);
      if (!(target instanceof JVariable)) {
        return null;
      }
      JVariable variable = (JVariable) target;
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

              Expression currentExpression = expressions[i];
              if (currentExpression instanceof NullLiteral) {
                scope.problemReporter().annotationValueMustBeConstant(this.binding.declaringClass, this.name, currentExpression, true);
              } else if (currentExpression instanceof NameReference) {
                NameReference nameReference = (NameReference) currentExpression;
                final Binding nameReferenceBinding = nameReference.binding;
                if (nameReferenceBinding.kind() == Binding.FIELD) {
                  FieldBinding fieldBinding = (FieldBinding) nameReferenceBinding;
                  if (!fieldBinding.declaringClass.isEnum()) {
                    scope.problemReporter().annotationValueMustBeConstant(this.binding.declaringClass, this.name, currentExpression, true);
                  }
                }
              }
            }
          }
        } else if (this.value instanceof NameReference) {
          NameReference nameReference = (NameReference) this.value;
          final Binding nameReferenceBinding = nameReference.binding;
          if (nameReferenceBinding.kind() == Binding.FIELD) {
            FieldBinding fieldBinding = (FieldBinding) nameReferenceBinding;
            if (!fieldBinding.declaringClass.isEnum()) {
              if (!fieldBinding.type.isArrayType()) {
                scope.problemReporter().annotationValueMustBeConstant(this.binding.declaringClass, this.name, this.value, true);
              } else {
View Full Code Here

        case ANNOTATION_TYPE :
        case INTERFACE :
        case CLASS :
        case ENUM :
          TypeElementImpl typeElementImpl = (TypeElementImpl) e;
          Binding typeBinding = typeElementImpl._binding;
          if (typeBinding instanceof SourceTypeBinding) {
            SourceTypeBinding sourceTypeBinding = (SourceTypeBinding) typeBinding;
            TypeDeclaration typeDeclaration = (TypeDeclaration) sourceTypeBinding.scope.referenceContext();
            referenceContext = typeDeclaration;
            elementAnnotations = typeDeclaration.annotations;
            startPosition = typeDeclaration.sourceStart;
            endPosition = typeDeclaration.sourceEnd;
          }
          break;
        case PACKAGE :
          // nothing to do: there is no reference context for a package
          break;
        case CONSTRUCTOR :
        case METHOD :
          ExecutableElementImpl executableElementImpl = (ExecutableElementImpl) e;
          Binding binding = executableElementImpl._binding;
          if (binding instanceof MethodBinding) {
            MethodBinding methodBinding = (MethodBinding) binding;
            AbstractMethodDeclaration sourceMethod = methodBinding.sourceMethod();
            if (sourceMethod != null) {
              referenceContext = sourceMethod;
View Full Code Here

  public Set<? extends Element> getElementsAnnotatedWith(TypeElement a)
  {
    if (a.getKind() != ElementKind.ANNOTATION_TYPE) {
      throw new IllegalArgumentException("Argument must represent an annotation type"); //$NON-NLS-1$
    }
    Binding annoBinding = ((TypeElementImpl)a)._binding;
    if (0 != (annoBinding.getAnnotationTagBits() & TagBits.AnnotationInherited)) {
      Set<Element> annotatedElements = new HashSet<Element>(_annoToUnit.getValues(a));
      // For all other root elements that are TypeElements, and for their recursively enclosed
      // types, add each element if it has a superclass are annotated with 'a'
      ReferenceBinding annoTypeBinding = (ReferenceBinding)((TypeElementImpl)a)._binding;
      for (TypeElement element : ElementFilter.typesIn(getRootElements())) {
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.