Bug 223838 - [dom] AnnotationBinding.isRecovered() always return false
Summary: [dom] AnnotationBinding.isRecovered() always return false
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 198085
Blocks:
  Show dependency tree
 
Reported: 2008-03-25 10:45 EDT by Frederic Fusier CLA
Modified: 2008-04-30 12:33 EDT (History)
3 users (show)

See Also:


Attachments
Patch including Olivier's fix + regression test (6.06 KB, patch)
2008-03-25 13:56 EDT, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Fusier CLA 2008-03-25 10:45:22 EDT
This problem was found while verifying bug 198085.

Testing following snippet:
@Deprecated
@Invalid
public class NotWorking {

}

The ITypeBinding.getAnnotations() now correctly returns an array with two IAnnotationBinding but the second one is not considered as recovered (isRecovered() returns false) although it should be.

The reason is that AnnotationBinding.isRecovered() is implemented as follow:
public boolean isRecovered() {
    return false;
}
Comment 1 Olivier Thomann CLA 2008-03-25 12:21:14 EDT
It should probably be something like this:
public boolean isRecovered() {
	ReferenceBinding annotationType = binding.getAnnotationType();
	return annotationType == null || (annotationType.tagBits & TagBits.HasMissingType) != 0;
}

Seems to work with the provided test case.
Comment 2 Philipe Mulet CLA 2008-03-25 13:12:17 EDT
+1, I seem to have missed this scenario indeed.
Comment 3 Frederic Fusier CLA 2008-03-25 13:14:15 EDT
I'll release the proposed change and add a regression test...
Comment 4 Frederic Fusier CLA 2008-03-25 13:56:32 EDT
Created attachment 93455 [details]
Patch including Olivier's fix + regression test
Comment 5 Frederic Fusier CLA 2008-03-25 14:01:10 EDT
Released for 3.4M6 in HEAD stream.
Comment 6 David Audel CLA 2008-03-26 12:14:12 EDT
Verified for 3.4M6 using build I20080325-2233
Comment 7 Olivier Thomann CLA 2008-04-30 12:33:54 EDT
In fact in this case, two annotations are returned only if the binding recovery is on.