Generally it's a complicated area. Generally the only safe way to sneak out from under an existing license would be a black-box rewrite, done by people who hadn't looked at the source for the original version. Otherwise the original author could claim that it's a derivative work, and thus falls under the terms of the original license.
The CDDL in particular specifies that any modifications (changes, additions or deletions to the source code or their files) are also under the CDDL.
My understanding (although I'm not certain) is that a license to use and modify the software also implicitly grants a license to use the patents contained in the original code.
The CDDL in particular specifies that any modifications (changes, additions or deletions to the source code or their files) are also under the CDDL.
See http://web.archive.org/web/20090305064954/http://www.sun.com... 3.2,3.4 along with their definition of Modification.
However, even a black-box rewrite could still fall foul of any patents granted to the original creators.