Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 352355

Summary: Initial array values for fields in annotations ignored
Product: z_Archived Reporter: Justin Spadea <jspadea>
Component: EDTAssignee: Project Inbox <edt.mofmodel-inbox>
Status: CLOSED FIXED QA Contact:
Severity: minor    
Priority: P1 CC: pharmon
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Justin Spadea CLA 2011-07-18 11:24:59 EDT
record myannot type annotation
	i int[] = [1,2];
	s string = "foo";
end


Here's the output for myannot.eglxml:

<?xml version="1.0" encoding="iso-8859-1"?>
<AnnotationType ID="1" eClass="org.eclipse.edt.mof.egl.AnnotationType" isAbstract="false" isInterface="false" name="myannot" hasCompileErrors="false" packageName="pkg" >
	<eFields ID="2" eClass="org.eclipse.edt.mof.EField" name="i" eType="org.eclipse.edt.mof.EList&lt;org.eclipse.edt.mof.EInt32&gt;" nullable="false" isTransient="false" containment="true" >
		<declarer IDREF="1"/>
	</eFields>
	<eFields ID="3" eClass="org.eclipse.edt.mof.EField" name="s" eType="org.eclipse.edt.mof.EString" nullable="false" isTransient="false" containment="true" initialValue="foo" >
		<declarer IDREF="1"/>
	</eFields>
</AnnotationType>


As you can see the string field has an initialValue but the array field does not.
Comment 1 Paul Harmon CLA 2011-11-10 14:28:48 EST
I have fixed this. The initial values for annotation fields are now stored as literal expressions. These expressions are then converted to the appropriate java object when the annotationType is instatiated.
Comment 2 Justin Spadea CLA 2011-11-22 15:57:27 EST
Verified