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

Bug 366095

Summary: An Annotation which has a field of annotations produces a compile an error
Product: z_Archived Reporter: Joseph Vincens <jvincens>
Component: EDTAssignee: Project Inbox <edt.compiler-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: pharmon
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
jtopen annotations none

Description Joseph Vincens CLA 2011-12-08 14:30:55 EST
I will attach a project that exhibits the problem.
Comment 1 Joseph Vincens CLA 2011-12-08 14:34:51 EST
Created attachment 208114 [details]
jtopen annotations

In the attached there is a service services.S1 that uses the annotation IBMiProgram, this annotation has a field parameterAnnotations which can be any of the eglx.jtopen.annotations.AS400xxxx annotations. 
if parameterAnnotations contains all the same type I get no error if it contains different types (like the example in S1) I see:
 AS400Bin2 and AS400Bin4 are not compatible types in the expression [AS400Bin2, ..., AS400Bin4].
Comment 2 Joseph Vincens CLA 2011-12-08 15:47:59 EST
I came up with a workaround so this is no longer blocking me.
I found that by wrapping each annotation in the same type I'm able to create the array.

so instead of
		parameterAnnotations = [
			@AS400Bin2{},
			@AS400Bin4{}
		]
I do 
		parameterAnnotations = [
			@AS400Parameter{annotation = @AS400Bin2{}},
			@AS400Parameter{annotation = @AS400Bin4{}}
		]
I still can't use a null as an array element, but at least I can continue.

Record AS400Parameter type Annotation
{	targets=[ElementKind.FieldMbr]
}
	annotation any?;
end
Comment 3 Paul Harmon CLA 2011-12-09 13:34:45 EST
I have committed a change to the following classes:

TypeCompatibilityUtil
SeeingsBlockAnnotationBindingBindingsCompletor
Comment 4 Joseph Vincens CLA 2011-12-12 08:36:15 EST
fixed