Skip to content

Instantly share code, notes, and snippets.

@fff
Created August 31, 2011 03:25
Show Gist options
  • Save fff/1182750 to your computer and use it in GitHub Desktop.
Save fff/1182750 to your computer and use it in GitHub Desktop.
None.hash code was changed by java.reflection
object TestNone {
def main(args: Array[String]) {
//first none
val none1 = None
//create by reflection
val constructor = classOf[None$].getDeclaredConstructor();
constructor.setAccessible(true);
val none2 = constructor.newInstance()
//new none
val none3 = None
printf("None is None?%s", none1 == none3) //None is None?false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment