]> source.dussan.org Git - aspectj.git/commitdiff
avoid potential multi threaded issues
authorAndy Clement <andrew.clement@gmail.com>
Wed, 13 Mar 2013 15:23:55 +0000 (08:23 -0700)
committerAndy Clement <andrew.clement@gmail.com>
Wed, 13 Mar 2013 15:23:55 +0000 (08:23 -0700)
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java

index 649a74b990a66cf64646ec8f74a3071e048a315b..2286a06cf203291189bad48e0cb6cf3128dd679f 100644 (file)
@@ -286,10 +286,11 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
                ensureGenericSignatureUnpacked();
                if (methods == null) {
                        Method[] ms = javaClass.getMethods();
-                       methods = new ResolvedMember[ms.length];
+                       ResolvedMember[] newMethods = new ResolvedMember[ms.length];
                        for (int i = ms.length - 1; i >= 0; i--) {
-                               methods[i] = new BcelMethod(this, ms[i]);
+                               newMethods[i] = new BcelMethod(this, ms[i]);
                        }
+                       methods = newMethods;
                }
                return methods;
        }
@@ -298,10 +299,11 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
                ensureGenericSignatureUnpacked();
                if (fields == null) {
                        Field[] fs = javaClass.getFields();
-                       fields = new ResolvedMember[fs.length];
+                       ResolvedMember[] newfields = new ResolvedMember[fs.length];
                        for (int i = 0, len = fs.length; i < len; i++) {
-                               fields[i] = new BcelField(this, fs[i]);
+                               newfields[i] = new BcelField(this, fs[i]);
                        }
+                       fields = newfields;
                }
                return fields;
        }