Bug 220940 - Get unexpected NaN value from IMemberValuePair
Summary: Get unexpected NaN value from IMemberValuePair
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: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-29 09:40 EST by Leho Nigul CLA
Modified: 2008-03-26 05:49 EDT (History)
3 users (show)

See Also:


Attachments
Proposed fix and regression test (4.42 KB, patch)
2008-03-01 13:08 EST, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Leho Nigul CLA 2008-02-29 09:40:23 EST
Build ID: I20080207-1530

Steps To Reproduce:
I have the following Java annotation definition

package qq;

public @interface TestA {

	public abstract java.lang.Class[] value();
}

If the following snippet is present in the Java code
@TestA(value={null})

When I try to get value from IMemberValuePair that corresponds to "value" argument of the annotation I get
Double.NaN back. This is definitely unexpected since there is no mention of Double type anywhere in the annotation definition. 
  I would much rather get "null" as a string value or something like that.

More information:
Comment 1 Olivier Thomann CLA 2008-02-29 11:36:58 EST
This is an error case. Could you please describe how you retrieve the IMemberValuePair.

Thanks.
Comment 2 Leho Nigul CLA 2008-02-29 16:21:15 EST
Well, in my code I get IAnnotation from IType, by calling getAnnotations, after that I call 
IMemberValuePair[] members = ann.getMemberValuePairs();

and then call getValue for each IMemberValuePair object.

Nothing fancy

Comment 3 Philipe Mulet CLA 2008-02-29 17:32:11 EST
Jerome - would you be answering back Constant.NotAConstant ? (by mistake)
Comment 4 Jerome Lanneluc CLA 2008-03-01 13:08:53 EST
Created attachment 91278 [details]
Proposed fix and regression test

Indeed the constant of the NullLiteral (Constant.NotAConstant) was returned by mistake. With the fix a K_UNKNOWN member value pair is returned with a null value (as specified by IMemberValuePair#K_UNKNOWN).
Comment 5 Jerome Lanneluc CLA 2008-03-01 13:41:52 EST
Fix and test released for 3.4M6
Comment 6 David Audel CLA 2008-03-26 05:49:19 EDT
Verified for 3.4M6 using build I20080324-1300.