Bug 80699 - Code Select does not work for annotations inside class file
Summary: Code Select does not work for annotations inside class file
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-10 10:57 EST by David Audel CLA
Modified: 2004-12-15 12:28 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2004-12-10 10:57:36 EST
build I20041201 + jdtcore head

1)Open java.lang.annonation.Retention.class 
The attached source is 

@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface Retention {
    RetentionPolicy value();
}

2) select "Target"
3) do F3
nothing


the problem is inside
org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader#getKind().

The code is 
public int getKind() {
	int modifiers = getModifiers();
	if ((modifiers & AccInterface) != 0) return IGenericType.INTERFACE_DECL;
	if ((modifiers & AccEnum) != 0) return IGenericType.ENUM_DECL;
	return IGenericType.CLASS_DECL;
}

and must be

public int getKind() {
   int modifiers = getModifiers();
   if ((modifiers & AccAnnotation) != 0) return IGenericType.ANNOTATION_TYPE_DECL;
   if ((modifiers & AccInterface) != 0) return IGenericType.INTERFACE_DECL;
   if ((modifiers & AccEnum) != 0) return IGenericType.ENUM_DECL;
   return IGenericType.CLASS_DECL;
}
Comment 1 Olivier Thomann CLA 2004-12-10 11:02:06 EST
Fixed and released in HEAD.
Thanks for the patch.
Regression test added in AnnotationTest.test047.
Comment 2 Frederic Fusier CLA 2004-12-15 12:28:39 EST
Verified for 3.1 M4 using build I200412142000.