Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] EL pick wrong converter for parameterized type

Hi Andreas,

Does the fix for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=412331 fix this?

Are you running against a nightly build of 2.5.1?

Could be another hole in the converter processing logic, if so, can you enter another bug with example.

Thanks,
Guy


On 18/08/2013 4:23 PM, Andreas Joseph Krogh wrote:
På søndag 18. august 2013 kl. 17:57:00, skrev Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>:
Hi.
 
I'm experiencing that EL pick the wrong converter. I have a Scala-project where I have converters for Option[Int] and Option[Long] etc. For some reason the OptionIntegerConverter is used where OptionLongConverter should be used.
 
I'm unable to reproduce this on another project.
 
Where in the code is the converters mapped to types, so I can debug and see what's going on?
 
After som digging and debugging here's what's going on:
 
I have a Scala-project and am trying to auto-apply converters for Option[<primitive type>], ie. Option[Long], Option[Int] etc. It appears Scala generates byte-code like Option[java.lang.Object] for these type, as opposed to reference-types (AnyRef) where it correctly generates Option[java.lang.Long]. Because of this it is impossible (I think) for EL to automatically distinguish between fields of type Option[Int] and Option[Long], and the generation of MetadataProject.m_autoApplyConvertAccessors merges all of them to one type, Option[java.lang.Object].
 
The solution is to always annotate fields of Option-primitive types explicitly with @Convert.
 
--
Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
 


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

--

Oracle
Guy Pelletier

ORACLE Canada, 45 O'Connor Street Suite 400 Ottawa, Ontario Canada K1P 1A4

Green
            Oracle Oracle is committed to developing practices and products that help protect the environment


Back to the top