Lines 475-487
Link Here
|
475 |
case Binding.PACKAGE : |
475 |
case Binding.PACKAGE : |
476 |
PackageBinding packageBinding = (PackageBinding) recipient; |
476 |
PackageBinding packageBinding = (PackageBinding) recipient; |
477 |
if ((packageBinding.tagBits & TagBits.AnnotationResolved) != 0) return; |
477 |
if ((packageBinding.tagBits & TagBits.AnnotationResolved) != 0) return; |
478 |
packageBinding.tagBits |= TagBits.AnnotationResolved; |
478 |
packageBinding.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); |
479 |
break; |
479 |
break; |
480 |
case Binding.TYPE : |
480 |
case Binding.TYPE : |
481 |
case Binding.GENERIC_TYPE : |
481 |
case Binding.GENERIC_TYPE : |
482 |
ReferenceBinding type = (ReferenceBinding) recipient; |
482 |
ReferenceBinding type = (ReferenceBinding) recipient; |
483 |
if ((type.tagBits & TagBits.AnnotationResolved) != 0) return; |
483 |
if ((type.tagBits & TagBits.AnnotationResolved) != 0) return; |
484 |
type.tagBits |= TagBits.AnnotationResolved; |
484 |
type.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); |
485 |
if (length > 0) { |
485 |
if (length > 0) { |
486 |
instances = new AnnotationBinding[length]; |
486 |
instances = new AnnotationBinding[length]; |
487 |
type.setAnnotations(instances); |
487 |
type.setAnnotations(instances); |
Lines 490-496
Link Here
|
490 |
case Binding.METHOD : |
490 |
case Binding.METHOD : |
491 |
MethodBinding method = (MethodBinding) recipient; |
491 |
MethodBinding method = (MethodBinding) recipient; |
492 |
if ((method.tagBits & TagBits.AnnotationResolved) != 0) return; |
492 |
if ((method.tagBits & TagBits.AnnotationResolved) != 0) return; |
493 |
method.tagBits |= TagBits.AnnotationResolved; |
493 |
method.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); |
494 |
if (length > 0) { |
494 |
if (length > 0) { |
495 |
instances = new AnnotationBinding[length]; |
495 |
instances = new AnnotationBinding[length]; |
496 |
method.setAnnotations(instances); |
496 |
method.setAnnotations(instances); |
Lines 499-505
Link Here
|
499 |
case Binding.FIELD : |
499 |
case Binding.FIELD : |
500 |
FieldBinding field = (FieldBinding) recipient; |
500 |
FieldBinding field = (FieldBinding) recipient; |
501 |
if ((field.tagBits & TagBits.AnnotationResolved) != 0) return; |
501 |
if ((field.tagBits & TagBits.AnnotationResolved) != 0) return; |
502 |
field.tagBits |= TagBits.AnnotationResolved; |
502 |
field.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); |
503 |
if (length > 0) { |
503 |
if (length > 0) { |
504 |
instances = new AnnotationBinding[length]; |
504 |
instances = new AnnotationBinding[length]; |
505 |
field.setAnnotations(instances); |
505 |
field.setAnnotations(instances); |
Lines 508-514
Link Here
|
508 |
case Binding.LOCAL : |
508 |
case Binding.LOCAL : |
509 |
LocalVariableBinding local = (LocalVariableBinding) recipient; |
509 |
LocalVariableBinding local = (LocalVariableBinding) recipient; |
510 |
if ((local.tagBits & TagBits.AnnotationResolved) != 0) return; |
510 |
if ((local.tagBits & TagBits.AnnotationResolved) != 0) return; |
511 |
local.tagBits |= TagBits.AnnotationResolved; |
511 |
local.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); |
512 |
if (length > 0) { |
512 |
if (length > 0) { |
513 |
instances = new AnnotationBinding[length]; |
513 |
instances = new AnnotationBinding[length]; |
514 |
local.setAnnotations(instances); |
514 |
local.setAnnotations(instances); |
Lines 548-624
Link Here
|
548 |
} |
548 |
} |
549 |
} |
549 |
} |
550 |
|
550 |
|
551 |
/** |
551 |
/** |
552 |
* Figures if @Deprecated annotation is specified, do not resolve entire annotations. |
552 |
* Figures if @Deprecated annotation is specified, do not resolve entire annotations. |
553 |
*/ |
553 |
*/ |
554 |
public static void resolveDeprecatedAnnotations(BlockScope scope, Annotation[] annotations, Binding recipient) { |
554 |
public static void resolveDeprecatedAnnotations(BlockScope scope, Annotation[] annotations, Binding recipient) { |
555 |
if (annotations == null) |
555 |
if (recipient != null) { |
556 |
return; |
556 |
int kind = recipient.kind(); |
557 |
int length = annotations.length; |
557 |
if (annotations != null) { |
558 |
if (length == 0) |
558 |
int length; |
559 |
return; |
559 |
if ((length = annotations.length) >= 0) { |
560 |
if (recipient != null) { |
560 |
switch (kind) { |
561 |
switch (recipient.kind()) { |
561 |
case Binding.PACKAGE : |
562 |
case Binding.PACKAGE : |
562 |
PackageBinding packageBinding = (PackageBinding) recipient; |
563 |
PackageBinding packageBinding = (PackageBinding) recipient; |
563 |
if ((packageBinding.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return; |
564 |
if ((packageBinding.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return; |
564 |
break; |
565 |
break; |
565 |
case Binding.TYPE : |
566 |
case Binding.TYPE : |
566 |
case Binding.GENERIC_TYPE : |
567 |
case Binding.GENERIC_TYPE : |
567 |
ReferenceBinding type = (ReferenceBinding) recipient; |
568 |
ReferenceBinding type = (ReferenceBinding) recipient; |
568 |
if ((type.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return; |
569 |
if ((type.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return; |
569 |
break; |
570 |
break; |
570 |
case Binding.METHOD : |
571 |
case Binding.METHOD : |
571 |
MethodBinding method = (MethodBinding) recipient; |
572 |
MethodBinding method = (MethodBinding) recipient; |
572 |
if ((method.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return; |
573 |
if ((method.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return; |
573 |
break; |
574 |
break; |
574 |
case Binding.FIELD : |
575 |
case Binding.FIELD : |
575 |
FieldBinding field = (FieldBinding) recipient; |
576 |
FieldBinding field = (FieldBinding) recipient; |
576 |
if ((field.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return; |
577 |
if ((field.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return; |
577 |
break; |
578 |
break; |
578 |
case Binding.LOCAL : |
579 |
case Binding.LOCAL : |
579 |
LocalVariableBinding local = (LocalVariableBinding) recipient; |
580 |
LocalVariableBinding local = (LocalVariableBinding) recipient; |
580 |
if ((local.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return; |
581 |
if ((local.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return; |
581 |
break; |
582 |
break; |
582 |
default : |
583 |
default : |
583 |
return; |
584 |
return; |
584 |
} |
585 |
} |
585 |
for (int i = 0; i < length; i++) { |
586 |
} |
586 |
TypeReference annotationTypeRef = annotations[i].type; |
587 |
for (int i = 0; i < length; i++) { |
587 |
// only resolve type name if 'Deprecated' last token |
588 |
TypeReference annotationTypeRef = annotations[i].type; |
588 |
if (!CharOperation.equals(TypeConstants.JAVA_LANG_DEPRECATED[2], annotationTypeRef.getLastToken())) return; |
589 |
// only resolve type name if 'Deprecated' last token |
589 |
TypeBinding annotationType = annotations[i].type.resolveType(scope); |
590 |
if (!CharOperation.equals(TypeConstants.JAVA_LANG_DEPRECATED[2], annotationTypeRef.getLastToken())) return; |
590 |
if(annotationType != null && annotationType.isValidBinding() && annotationType.id == TypeIds.T_JavaLangDeprecated) { |
591 |
TypeBinding annotationType = annotations[i].type.resolveType(scope); |
591 |
switch (kind) { |
592 |
if(annotationType != null && annotationType.isValidBinding() && annotationType.id == TypeIds.T_JavaLangDeprecated) { |
592 |
case Binding.PACKAGE : |
593 |
if (recipient != null) { |
593 |
PackageBinding packageBinding = (PackageBinding) recipient; |
594 |
switch (recipient.kind()) { |
594 |
packageBinding.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved); |
595 |
case Binding.PACKAGE : |
595 |
return; |
596 |
PackageBinding packageBinding = (PackageBinding) recipient; |
596 |
case Binding.TYPE : |
597 |
packageBinding.tagBits |= TagBits.AnnotationDeprecated; |
597 |
case Binding.GENERIC_TYPE : |
598 |
break; |
598 |
case Binding.TYPE_PARAMETER : |
599 |
case Binding.TYPE : |
599 |
ReferenceBinding type = (ReferenceBinding) recipient; |
600 |
case Binding.GENERIC_TYPE : |
600 |
type.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved); |
601 |
case Binding.TYPE_PARAMETER : |
601 |
return; |
602 |
ReferenceBinding type = (ReferenceBinding) recipient; |
602 |
case Binding.METHOD : |
603 |
type.tagBits |= TagBits.AnnotationDeprecated; |
603 |
MethodBinding method = (MethodBinding) recipient; |
604 |
break; |
604 |
method.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved); |
605 |
case Binding.METHOD : |
605 |
return; |
606 |
MethodBinding method = (MethodBinding) recipient; |
606 |
case Binding.FIELD : |
607 |
method.tagBits |= TagBits.AnnotationDeprecated; |
607 |
FieldBinding field = (FieldBinding) recipient; |
608 |
break; |
608 |
field.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved); |
609 |
case Binding.FIELD : |
609 |
return; |
610 |
FieldBinding field = (FieldBinding) recipient; |
610 |
case Binding.LOCAL : |
611 |
field.tagBits |= TagBits.AnnotationDeprecated; |
611 |
LocalVariableBinding local = (LocalVariableBinding) recipient; |
612 |
break; |
612 |
local.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved); |
613 |
case Binding.LOCAL : |
613 |
return; |
614 |
LocalVariableBinding local = (LocalVariableBinding) recipient; |
614 |
default: |
615 |
local.tagBits |= TagBits.AnnotationDeprecated; |
615 |
return; |
616 |
break; |
616 |
} |
617 |
} |
617 |
} |
618 |
} |
618 |
} |
619 |
} |
619 |
} |
620 |
} |
620 |
} |
|
|
621 |
switch (kind) { |
622 |
case Binding.PACKAGE : |
623 |
PackageBinding packageBinding = (PackageBinding) recipient; |
624 |
packageBinding.tagBits |= TagBits.DeprecatedAnnotationResolved; |
625 |
return; |
626 |
case Binding.TYPE : |
627 |
case Binding.GENERIC_TYPE : |
628 |
case Binding.TYPE_PARAMETER : |
629 |
ReferenceBinding type = (ReferenceBinding) recipient; |
630 |
type.tagBits |= TagBits.DeprecatedAnnotationResolved; |
631 |
return; |
632 |
case Binding.METHOD : |
633 |
MethodBinding method = (MethodBinding) recipient; |
634 |
method.tagBits |= TagBits.DeprecatedAnnotationResolved; |
635 |
return; |
636 |
case Binding.FIELD : |
637 |
FieldBinding field = (FieldBinding) recipient; |
638 |
field.tagBits |= TagBits.DeprecatedAnnotationResolved; |
639 |
return; |
640 |
case Binding.LOCAL : |
641 |
LocalVariableBinding local = (LocalVariableBinding) recipient; |
642 |
local.tagBits |= TagBits.DeprecatedAnnotationResolved; |
643 |
return; |
644 |
default: |
645 |
return; |
646 |
} |
621 |
} |
647 |
} |
|
|
648 |
} |
622 |
|
649 |
|
623 |
public int sourceStart() { |
650 |
public int sourceStart() { |
624 |
return this.sourceStart; |
651 |
return this.sourceStart; |