Patch addressing this by providing, when os.path.samefile is missing, a sunstitute that compares absolute paths.
I have tested this by running the ant template target to regenerate all *Derived.java files, then rebuilding successfully.