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

Bug 347504

Summary: [Validation] @XmlEnum/@XmlEnumValue validation and content assist
Product: [WebTools] Dali JPA Tools Reporter: Paul Fullbright <paul.fullbright>
Component: JAXBAssignee: Paul Fullbright <paul.fullbright>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: neil.hauge
Version: 3.0   
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Bug Depends on:    
Bug Blocks: 327929    

Description Paul Fullbright CLA 2011-05-27 15:15:24 EDT
XmlEnum and XmlEnumValue annotations need the following validation:

- XmlEnum.value should match the java type binding of the simple type definition
- the type mapped by an enum should be a simple type
- the type mapped by an enum *should* be an enumerated simple type, but may not be in certain situations (probably a warning)
- the XmlEnumValues should be valid lexical representations of the XmlEnum.value and should map to enumerations of the schema type (if the schema type is enumerated)
Comment 1 Paul Fullbright CLA 2011-05-27 15:41:01 EDT
XmlEnum needs no further content assist.

XmlEnumValue needs the following content assist:

- if the schema type resolves to a valid enumerated simple type, the values of the type should be given as completion proposals
Comment 2 Paul Fullbright CLA 2011-10-25 17:15:25 EDT
Added validation for:

- XmlEnum value should map to a simple schema type
- XmlEnumValue value should be a valid lexical value for the enum's schema type

Added content assist for:

- XmlEnumValue value when enum's schema type has enumeration values

Chose not to add validation for:

- XmlEnum.value should match the java type binding of the simple type
definition  
[The value is always a String type in code.  Lexical validation was added instead.]
- the type mapped by an enum *should* be an enumerated simple type, but may not
be in certain situations (probably a warning) 
[It is entirely valid to write out xml with enumerated values, even if it isn't a schema constraint.]

It is also intentional that no validation was added for *duplicate* XmlEnumValue values, since neither the RI nor MOXy complained in this scenario.

Committed for 3.1 M3