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

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


    StringBuilder builder = new StringBuilder();
    if (msg != null) {
      builder.append(msg);
    }
    if (a != null && elementAnnotations != null) {
      AnnotationBinding annotationBinding = ((AnnotationMirrorImpl) a)._binding;
      Annotation annotation = null;
      for (int i = 0; annotation == null && i < elementAnnotations.length; i++) {
        if (annotationBinding == elementAnnotations[i].getCompilerAnnotation()) {
          annotation = elementAnnotations[i];
        }
View Full Code Here


      Annotation[] annotations,
      Binding currentBinding) {
    ASTNode.resolveAnnotations(scope, annotations, currentBinding);
   
    for (Annotation annotation : annotations) {
      AnnotationBinding binding = annotation.getCompilerAnnotation();
      if (binding != null) { // binding should be resolved, but in case it's not, ignore it
        TypeElement anno = (TypeElement)_factory.newElement(binding.getAnnotationType());
        Element element = _factory.newElement(currentBinding);
        _annoToElement.put(anno, element);
      }
    }
  }
View Full Code Here

      annotationBindings = ((VariableBinding) this.compilerBinding).getAnnotations();
    } else {
      return;
    }
    for (int i = 0, length = annotationBindings.length; i < length; i++) {
      AnnotationBinding binding = annotationBindings[i];
      if (binding.getAnnotationType() == annotationType) {
        this.annotationBinding = binding;
        break;
      }
    }
  }
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, this.fromJavaProject);
      AnnotationBinding annotationBinding = keyResolver.getAnnotationBinding();
      IBinding binding;
      if (annotationBinding != null) {
        binding = resolver.getAnnotationInstance(annotationBinding);
      } else {
        binding = resolver.getBinding(compilerBinding);
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) {
        binding = resolver.getAnnotationInstance(annotationBinding);
      } else {
        binding = resolver.getBinding(compilerBinding);
View Full Code Here

      Annotation[] annotations,
      Binding currentBinding) {
    ASTNode.resolveAnnotations(scope, annotations, currentBinding);
   
    for (Annotation annotation : annotations) {
      AnnotationBinding binding = annotation.getCompilerAnnotation();
      if (binding != null) { // binding should be resolved, but in case it's not, ignore it
        TypeElement anno = (TypeElement)_factory.newElement(binding.getAnnotationType());
        Element element = _factory.newElement(currentBinding);
        _annoToElement.put(anno, element);
      }
    }
  }
View Full Code Here

    StringBuilder builder = new StringBuilder();
    if (msg != null) {
      builder.append(msg);
    }
    if (a != null && elementAnnotations != null) {
      AnnotationBinding annotationBinding = ((AnnotationMirrorImpl) a)._binding;
      Annotation annotation = null;
      for (int i = 0; annotation == null && i < elementAnnotations.length; i++) {
        if (annotationBinding == elementAnnotations[i].getCompilerAnnotation()) {
          annotation = elementAnnotations[i];
        }
View Full Code Here

      long descTagBits = descParameters[i].tagBits & TagBits.AnnotationNullMASK;
      if (ourTagBits == 0L) {
        if (descTagBits != 0L && !ourParameters[i].isBaseType()) {
          AnnotationBinding [] annotations = descParameters[i].getTypeAnnotations();
          for (int j = 0, length = annotations.length; j < length; j++) {
            AnnotationBinding annotation = annotations[j];
            if (annotation != null) {
              switch (annotation.getAnnotationType().id) {
                case TypeIds.T_ConfiguredAnnotationNullable :
                case TypeIds.T_ConfiguredAnnotationNonNull :
                  ourParameters[i] = env.createAnnotatedType(ourParameters[i], new AnnotationBinding [] { annotation });
                  break;
              }
View Full Code Here

      annotationBindings = ((VariableBinding) this.compilerBinding).getAnnotations();
    } else {
      return;
    }
    for (int i = 0, length = annotationBindings.length; i < length; i++) {
      AnnotationBinding binding = annotationBindings[i];
      if (binding.getAnnotationType() == annotationType) {
        this.annotationBinding = binding;
        break;
      }
    }
  }
View Full Code Here

                Annotation annot = sourceAnnotations[j];
                /*
                 * Annotations are shared between two locals, but we still need to record
                 * the suppress annotation range for the second local
                 */
                AnnotationBinding annotationBinding = annot.getCompilerAnnotation();
                annotations[j] = annotationBinding;
                if (annotationBinding != null) {
                  final ReferenceBinding annotationType = annotationBinding.getAnnotationType();
                  if (annotationType != null && annotationType.id == TypeIds.T_JavaLangSuppressWarnings) {
                    annot.recordSuppressWarnings(scope, declarationSourceStart, declarationSourceEnd, scope.compilerOptions().suppressWarnings);
                  }
                }
              }
            }
            break;
        }
        return annotations;
      } else {
        annotation.recipient = recipient;
        annotation.resolveType(scope);
        // null if receiver is a package binding
        if (annotations != null) {
          annotations[i] = annotation.getCompilerAnnotation();
        }
      }
    }

    /* See if the recipient is meta-annotated with @Repeatable and if so validate constraints. We can't do this during resolution of @Repeatable itself as @Target and
       @Retention etc could come later
    */  
    if (recipient != null && recipient.isTaggedRepeatable()) {
      for (int i = 0; i < length; i++) {
        Annotation annotation = sourceAnnotations[i];
        ReferenceBinding annotationType = annotations[i] != null ? annotations[i].getAnnotationType() : null;
        if (annotationType != null && annotationType.id == TypeIds.T_JavaLangAnnotationRepeatable)
          annotation.checkRepeatableMetaAnnotation(scope);
      }
    }
   
    // check duplicate annotations
    if (annotations != null && length > 1) {
      AnnotationBinding[] distinctAnnotations = annotations; // only copy after 1st duplicate is detected
      Map implicitContainerAnnotations = null;
      for (int i = 0; i < length; i++) {
        AnnotationBinding annotation = distinctAnnotations[i];
        if (annotation == null) continue;
        ReferenceBinding annotationType = annotation.getAnnotationType();
        boolean foundDuplicate = false;
        ContainerAnnotation container = null;
        for (int j = i+1; j < length; j++) {
          AnnotationBinding otherAnnotation = distinctAnnotations[j];
          if (otherAnnotation == null) continue;
          if (TypeBinding.equalsEquals(otherAnnotation.getAnnotationType(), annotationType)) {
            if (distinctAnnotations == annotations) {
              System.arraycopy(distinctAnnotations, 0, distinctAnnotations = new AnnotationBinding[length], 0, length);
            }
            distinctAnnotations[j] = null; // report/process it only once
            if (annotationType.isRepeatableAnnotationType()) {
View Full Code Here

TOP

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

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.