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

Bug 359936

Summary: Resolve issues with ValidValues annotation
Product: z_Archived Reporter: Brian Svihovec <svihovec>
Component: EDTAssignee: Paul Harmon <pharmon>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: jspadea
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Testcase. none

Description Brian Svihovec CLA 2011-10-04 22:11:16 EDT
Created attachment 204559 [details]
Testcase.

Import the attached EGL file.  NOTE: This file has no dependencies on other files or parts.

When the file is saved and built, you will see the following exception being thrown:

org.eclipse.edt.mof.serialization.DeserializationException: java.lang.ClassCastException: java.lang.String cannot be cast to org.eclipse.edt.mof.EObject
	at org.eclipse.edt.mof.serialization.xml.XMLDeserializer.deserialize(XMLDeserializer.java:79)
	at org.eclipse.edt.mof.serialization.AbstractObjectStore.get(AbstractObjectStore.java:69)
	at org.eclipse.edt.ide.rui.internal.lookup.PreviewIREnvironment.find(PreviewIREnvironment.java:94)
	at org.eclipse.edt.compiler.internal.egl2mof.Egl2MofBase.getMofSerializable(Egl2MofBase.java:1341)
...
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.eclipse.edt.mof.EObject
	at org.eclipse.edt.mof.serialization.xml.XMLDeserializer.startElement(XMLDeserializer.java:150)
	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
	at org.eclipse.edt.mof.serialization.xml.XMLDeserializer.deserialize(XMLDeserializer.java:77)
	... 41 more
Comment 1 Paul Harmon CLA 2011-10-11 12:01:42 EDT
This problem occurs because Validvalues.value is defined as an ANY[], but it really should be defined as ANY[][]. The deserializer needs to know when it is dealing with an array type. Since the list type in this case is an ANY, and it gets a list as the value, the deserializer doesnt know how to handle it.

There are a few ways to deal with this in the future:

1) Split up validValues into ValidValuesRanges and ValidValuesMatches. The former would take any[][] and the latter would take any[]
2) Keep validvalues, but change the definition to any[][]. Add an annotation onto the value field so that validation would allow non-array entries to be specified, such as validValues = [1, 2, 3, [6, 10]]. Validation would translate this into:  [[1],[2],[3],[6,10]]

For now, we will defer this out of 0.7 since it is not really needed right now
Comment 2 Justin Spadea CLA 2012-11-15 15:59:21 EST
Since this was originally a problem in the definition of the annotation, and now that annotation no longer exists, I'm resolving as invalid.
Comment 3 Matt Heitz CLA 2013-01-03 10:08:28 EST
Closing all bugs in the RESOLVED state with reason INVALID, WONTFIX, DUPLICATE, WORKSFORME, or NOT_ECLIPSE.