Code Review for jdk

Prepared by:twisti on Thu Sep 26 12:39:43 PDT 2013
Compare against:
Summary of changes: 72 lines changed: 31 ins; 8 del; 33 mod; 963 unchg
Patch of changes: jdk.patch
Author comments:
8019192: StringIndexOutOfBoundsException: in Class.getSimpleName()

This is a race in MemberName's name and type getters.

MemberName's type field is of type Object so it can hold different objects when it gets filled in from the VM. These types include String and Object[]. On the first invocation the current type if it's not MethodType gets converted to a MethodType.

There is a tiny window where some instanceof check have already been done on one thread and then another thread stores a MethodType. The following checkcast then fails.

The fix is to make name and type volatile and do the conversion in a synchronized block. This is okay because it's only done once.

Bug id: 8019192
Legend: Modified file
Deleted file
New file

Cdiffs Udiffs Sdiffs Frames Old New Patch Raw src/share/classes/java/lang/invoke/

72 lines changed: 31 ins; 8 del; 33 mod; 963 unchg

This code review page was prepared using /Users/twisti/bin/webrev (vers 23.18-hg-never-dev).