Bug 124469

Summary: [1.5][search] does not find references to enum type in binary annotation
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann
Version: 3.2   
Target Milestone: 3.2 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch to fix this issue
none
New patch to fix this issue
none
Jar file for model tests
none
Additional patch to index standard annotations contents none

Description Markus Keller CLA 2006-01-19 06:37:41 EST
I20060118-0800, jdk1.5.0_06

Search for references to java.lang.annotation.ElementType or one of its members in a 1.5 JRE does not find any match. But most of the annotation declarations in the JDK use an @Target with an ElementType, e.g.

...
@Target(ElementType.ANNOTATION_TYPE)
public @interface Retention ...

...
@Target(ElementType.ANNOTATION_TYPE)
public @interface Target ...

I would understand that references with RetentionPolicy.SOURCE are not found, but the others should be available.
Comment 1 Frederic Fusier CLA 2006-01-28 10:47:29 EST
Created attachment 33754 [details]
Patch to fix this issue

Additional information about annotations in class files were not used by BinaryIndexer => record in index files reference to annotation itself, type names and enum constant names of member pair values...
Comment 2 Frederic Fusier CLA 2006-01-28 10:49:01 EST
Olivier, can you review if the parse of the class file annotations information is correct?
Thx
Comment 3 Frederic Fusier CLA 2006-02-03 05:11:41 EST
Created attachment 34062 [details]
New patch to fix this issue

Olivier, may you review this new fix? I'll attach jar file for tests separately...
Thanks
Comment 4 Frederic Fusier CLA 2006-02-03 05:12:35 EST
Created attachment 34063 [details]
Jar file for model tests
Comment 5 Frederic Fusier CLA 2006-02-03 10:32:55 EST
Released in HEAD.
Comment 6 Frederic Fusier CLA 2006-02-15 07:32:54 EST
Created attachment 34763 [details]
Additional patch to index standard annotations contents

Unfortunately previous fix only index references inside non-standard annotations and so Search Engine was still not able to find correct reference to ElementType inside standard annotations as Retention...

Standard annotations are stored in tagBits field of ClassFileReader, so now BinaryIndex indexes corresponding types and fields reading bits of this field.
Comment 7 David Audel CLA 2006-02-15 11:03:28 EST
Verified for 3.2 M5 using build I20060215-0800

There is still some issue in the same area (bug 128033)