RFR: 8065172: More core reflection final and volatile annotations

Peter Levart peter.levart at gmail.com
Thu Nov 20 15:33:42 UTC 2014


Hi Martin,

On 11/19/2014 01:42 AM, Martin Buchholz wrote:
> Hi Joe, Peter, Paul
>
> This is the followup on thread safety I promised Peter.

Looks good.

I made the WildcardTypeImpl.[upperBoundASTs, lowerBoundASTs] and 
TypeVariableImpl.boundASTs fields volatile in my version of patch 
(instead of final):

http://cr.openjdk.java.net/~plevart/jdk9-dev/GenericsReflectionRaces/webrev.01/

...so that after the structure they point to has been parsed into bound 
types, they can be thrown away. The comments indicate that possibility 
already, but the implementor was afraid to do it because of possible 
races. I think I got it right here.

> As I said before, I'm willing to take the risk to use fields written
> via a race if we have a reflective test proving it correct, and the
> bug contains the 0.1 version of such a test.
>
> https://bugs.openjdk.java.net/browse/JDK-8065172
> http://cr.openjdk.java.net/~martin/webrevs/openjdk9/core-reflection-more-safety/


Inspired by your 0.1 version of a test, I created version 0.2:

http://cr.openjdk.java.net/~plevart/misc/SunReflectDataRaces/

...which uses some of your code, but rewritten with heavy use of 
Stream(s). When run with your proposed patch applied (and all previous 
patches that are already commited), it finds 20 possible data races. I 
haven't yet studied any of them.


Regards, Peter




More information about the core-libs-dev mailing list