If the “new” code is close enough to be considered a derived work then you will need a license.
And how is that determined... in court at trial? By an unbiased 3rd party competent enough to understand both codebases?