]> source.dussan.org Git - aspectj.git/commitdiff
fixed bug with ajcclinit in non-persingleton aspects
authorjhugunin <jhugunin>
Tue, 7 Jan 2003 20:50:18 +0000 (20:50 +0000)
committerjhugunin <jhugunin>
Tue, 7 Jan 2003 20:50:18 +0000 (20:50 +0000)
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java

index e4135cbcba70658e9e310ad3d5d0f8f6a522c903..2a3440898f1c2f189c819815afece0951ccc79c4 100644 (file)
@@ -323,18 +323,19 @@ public final class LazyClassGen {
         for (Iterator i = methodGens.iterator(); i.hasNext();) {
             LazyMethodGen gen = (LazyMethodGen) i.next();
                        if (gen.getName().equals(NameMangler.AJC_CLINIT_NAME)) return gen;
-        } 
-        throw new RuntimeException("unimplemented");
-//        LazyMethodGen clinit = new LazyMethodGen(
-//             Modifier.STATIC,
-//             Type.VOID,
-//             "<clinit>",
-//             new Type[0],
-//             CollectionUtil.NO_STRINGS,
-//             this);
-//             clinit.getBody().insert(getFactory().RETURN);
-//        methodGens.add(clinit);
-//        return clinit;
+        }
+        LazyMethodGen ajcClinit = new LazyMethodGen(
+               Modifier.STATIC,
+               Type.VOID,
+               NameMangler.AJC_CLINIT_NAME,
+               new Type[0],
+               CollectionUtil.NO_STRINGS,
+               this);
+               ajcClinit.getBody().insert(getFactory().RETURN);
+        methodGens.add(ajcClinit);
+        
+        getStaticInitializer().getBody().insert(Utility.createInvoke(getFactory(), ajcClinit));
+        return ajcClinit;
     }