Move a sad java-specific hack to Orca's java-specific script
Fix isSameObject() so that it is more performant and has less false positives