Gavin Tranter wrote:E is some object that extends Record, toNetSuiteRecord is returning some object that extends Record. It should all be fine.
But that doesn't guarantee that
toNetSuiteRecord returns the same type of sub-class of
Record that
E happens to be. What if, say,
toNetSuiteRecord returns a
SubClassOfRecord, and
E is
ADifferentSubClassOfRecord? The assignment won't be valid then.
Either your selected solution, or using
E super Record instead of
E extends Record would make it compile. (I couldn't say which is better - it depends on the rest of the situation).