We should pass the ClassGenerator instance value (instead of the boolean returned by instanceof) to the setClass method call. Added testCreateFromArrayWithClassInstance which directly addresses issue 4006, also added testCreateFromArrayWithClassFromArray since it was not there
Merge pull request #4007 from righter/hotfix/4006

Pass ClassGenerator instance instead of boolean
Merge branch 'hotfix/4007'

Close #4007
Fixes #4006