6881442: (reflect) Race condition in Class.getName()

Only read "name" field racily once

Reviewed-by: darcy
This commit is contained in:
Martin Buchholz 2009-09-12 15:30:13 -07:00
parent ee98fe5cd9
commit b5f1c84e3e

View File

@ -565,8 +565,9 @@ public final
* represented by this object.
*/
public String getName() {
String name = this.name;
if (name == null)
name = getName0();
this.name = name = getName0();
return name;
}