groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pascal Schumacher <pascalschumac...@gmx.net>
Subject Re: groovy git commit: Fixing squid:S2444 - Lazy initialization of "static" fields should be "synchronized"
Date Tue, 05 Jan 2016 22:45:40 GMT
Yes, I agree the change most likely reduces performance, but increases 
thread-safety  (prevent that different Threads may work with different 
Metaclasses etc.)

I do not know enough about this area of the code to judge if the lack of 
thread-safety is really a concern.

I just merged the pull request because of Jochens +1 vote.

Am 05.01.2016 um 20:31 schrieb John Wagenleitner:
> Not sure but wonder if HandleMetaClass#myMetaClass was static to avoid 
> having to perform a lookup for each HMC instance.  Probably not a 
> issue but thought I'd bring attention to it.
>
> On Tue, Jan 5, 2016 at 10:13 AM, <pascalschumacher@apache.org 
> <mailto:pascalschumacher@apache.org>> wrote:
>
>     Repository: groovy
>     Updated Branches:
>       refs/heads/master 586a316da -> c5f17abbe
>
>
>     Fixing squid:S2444 - Lazy initialization of "static" fields should
>     be "synchronized"
>
>     <snip>
>
>     http://git-wip-us.apache.org/repos/asf/groovy/blob/c5f17abb/src/main/org/codehaus/groovy/runtime/HandleMetaClass.java
>     ----------------------------------------------------------------------
>     diff --git
>     a/src/main/org/codehaus/groovy/runtime/HandleMetaClass.java
>     b/src/main/org/codehaus/groovy/runtime/HandleMetaClass.java
>     index f421131..9167f5c 100644
>     --- a/src/main/org/codehaus/groovy/runtime/HandleMetaClass.java
>     +++ b/src/main/org/codehaus/groovy/runtime/HandleMetaClass.java
>     @@ -24,7 +24,7 @@ import java.lang.reflect.Method;
>
>      public class HandleMetaClass extends DelegatingMetaClass {
>          private Object object;
>     -    private static MetaClass myMetaClass;
>     +    private MetaClass myMetaClass;
>          private static final Object NONE = new Object();
>
>          public HandleMetaClass(MetaClass mc) {
>
>     <snip>
>


Mime
View raw message