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