yunussasmaz / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

Gson should release final fields reverting setAccessible to its earlier value #247

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Chapter 9 of JSR 133 (Java Memory Model and Thread Specification) 
http://www.cs.umd.edu/~pugh/java/memoryModel/jsr133.pdf has some semantics 
regarding potential implication on compiler optimizations when setAccessible is 
used. Figure out what is the right thing to do after Gson has done its job on 
an object instance. We should consider using setAcessible to false for the 
object.

Original issue reported on code.google.com by inder123 on 5 Oct 2010 at 12:26

GoogleCodeExporter commented 9 years ago
I don't think setting setAccessible() to false is necessary. Each type you get 
the fields of a class, you get new Field objects. Field.setAccessible() doesn't 
impact any happens-before relationships.

Original comment by limpbizkit on 31 Oct 2010 at 3:11