]> source.dussan.org Git - aspectj.git/commitdiff
Fix for Bugzilla Bug 57436
authoraclement <aclement>
Thu, 8 Apr 2004 10:46:58 +0000 (10:46 +0000)
committeraclement <aclement>
Thu, 8 Apr 2004 10:46:58 +0000 (10:46 +0000)
   Java 1.5 fails to run classes produced by ajc
[ Not the perfect fix, but passes all the tests I can find - lets see what the build machine thinks of it...]

org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java

index 27db10c3e783d0940267444419c5df07b9a0137f..36d270870686faea3bd0ad5e2ec45f68002ff7e6 100644 (file)
@@ -23,6 +23,7 @@ import org.eclipse.jdt.internal.compiler.ClassFile;
 import org.eclipse.jdt.internal.compiler.CompilationResult;
 //import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.Clinit;
+import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
 //import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
 import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
@@ -294,8 +295,15 @@ public class AspectDeclaration extends TypeDeclaration {
                int codeAttributeOffset = classFile.contentsOffset;
                classFile.generateCodeAttributeHeader();
                CodeStream codeStream = classFile.codeStream;
-               codeStream.init(classFile);
-               codeStream.initializeMaxLocals(methodBinding);
+               
+               // Use reset() rather than init()
+               // XXX We need a scope to keep reset happy, initializerScope is *not* the right one, but it works !
+//              codeStream.init(classFile);
+//              codeStream.initializeMaxLocals(methodBinding);
+               MethodDeclaration md = AstUtil.makeMethodDeclaration(methodBinding);
+               md.scope = initializerScope;
+               codeStream.reset(md,classFile);
+               
                // body starts here
                gen.generate(codeStream);
                // body ends here