Closed hallvard closed 9 years ago
I have cloned and fixed according to my suggestion (both deserialise and serialise), and written a test (both saving and loading) and it seemed to work.
Sorry to comment on a long closed issue, but this fix only works with EMF 2.9 or later as eClass.getFeatureType(structuralFeature) is introduced with EMF 2.9. So please update the dependencies accordingly in the README.
README has been updated.
I’ve encountered an issue that I think is related to (lack of support for) generics. I have a parameterized class with a value field of the type parameter type:
abstract class SimpleClass {
value : T
}
class StringClass extends SimpleClass {
}
emfjson seems to think value is of eType EJavaObject, even in StringClass objects. Apparently, it then defaults to a hex number format, at least the error message states "java.lang.NumberFormatException: Invalid hexadecimal”. I’ve just learned that Ecore includes a method on EClass for resolving types, so instead of structuralFeature.getEType() you should use eClass.getFeatureType(structuralFeature) where eClass is the type of the actual object, which may be a subclass of the class owning the structuralFeature.