Closed jonathanstowe closed 7 years ago
You can never have too many :) Thanks!
I have actually tracked down the problem I was experiencing to somehow getting the same attribute twice in the sub-class I was using. Trying to work around it locally,
right, it's the way it gets the attributes. The ^attributes method walks up the inheritance chain to get all the parent attributes unless you ask it not to. If you are working with a subclass which has some attribute that needs the "unmarshalled-by" trait it will succesfully unmarshal the locally defined one then hit the parent one (and fail on, say, construction.) This doesn't cause a problem when there is no need for custom un-marshalling.
What I think I need to do is get the local attributes first and cache the names and the package, then in the main attribute processing loop skip attributes that are not the locally defined ones.
There will be a further PR when I have got this right.
I thought this wasn't behaving as I expected, so I made a test. It appears that it does work but it's worth having a test as I want to use it in some code :)