diff options
author | aclement <aclement> | 2004-07-26 08:46:55 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-07-26 08:46:55 +0000 |
commit | ad6d6f62831e62589cfe6dbb5ccac3b3fbb2acf0 (patch) | |
tree | f3a58dbe6d0596bdea31f0c6d584ff1969cd8a2d | |
parent | 77a8d52969465ee104317127c7a4bf5859ff147b (diff) | |
download | aspectj-ad6d6f62831e62589cfe6dbb5ccac3b3fbb2acf0.tar.gz aspectj-ad6d6f62831e62589cfe6dbb5ccac3b3fbb2acf0.zip |
Generated aspectOf() method for singleton aspects will now decompile cleanly. Might help with bug #63347 (JRockit related)
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java index e78ac25f8..c914bc3e8 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java @@ -527,24 +527,42 @@ public class AspectDeclaration extends TypeDeclaration { final EclipseFactory world = EclipseFactory.fromScopeLookupEnvironment(this.scope); generateMethod(classFile, aspectOfMethod, new BodyGenerator() { public void generate(CodeStream codeStream) { - // body starts here - codeStream.getstatic(world.makeFieldBinding(AjcMemberMaker.perSingletonField( - typeX))); - Label isNull = new Label(codeStream); - codeStream.dup(); - codeStream.ifnull(isNull); - codeStream.areturn(); - isNull.place(); - - codeStream.incrStackSize(+1); // the dup trick above confuses the stack counter - codeStream.new_(world.makeTypeBinding(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION)); - codeStream.dup(); - codeStream.ldc(typeX.getNameAsIdentifier()); - codeStream.getstatic(initFailureField); + // Old style aspectOf() method which confused decompilers +// // body starts here +// codeStream.getstatic(world.makeFieldBinding(AjcMemberMaker.perSingletonField( +// typeX))); +// Label isNull = new Label(codeStream); +// codeStream.dup(); +// codeStream.ifnull(isNull); +// codeStream.areturn(); +// isNull.place(); +// +// codeStream.incrStackSize(+1); // the dup trick above confuses the stack counter +// codeStream.new_(world.makeTypeBinding(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION)); +// codeStream.dup(); +// codeStream.ldc(typeX.getNameAsIdentifier()); +// codeStream.getstatic(initFailureField); +// codeStream.invokespecial(world.makeMethodBindingForCall( +// AjcMemberMaker.noAspectBoundExceptionInitWithCause() +// )); +// codeStream.athrow(); +// // body ends here + + // body starts here (see end of each line for what it is doing!) + FieldBinding fb = world.makeFieldBinding(AjcMemberMaker.perSingletonField(typeX)); + codeStream.getstatic(fb); // GETSTATIC + Label isNonNull = new Label(codeStream); + codeStream.ifnonnull(isNonNull); // IFNONNULL + codeStream.new_(world.makeTypeBinding(AjcMemberMaker.NO_ASPECT_BOUND_EXCEPTION)); // NEW + codeStream.dup(); // DUP + codeStream.ldc(typeX.getNameAsIdentifier()); // LDC + codeStream.getstatic(initFailureField); // GETSTATIC codeStream.invokespecial(world.makeMethodBindingForCall( - AjcMemberMaker.noAspectBoundExceptionInitWithCause() - )); - codeStream.athrow(); + AjcMemberMaker.noAspectBoundExceptionInitWithCause())); // INVOKESPECIAL + codeStream.athrow(); // ATHROW + isNonNull.place(); + codeStream.getstatic(fb); // GETSTATIC + codeStream.areturn(); // ARETURN // body ends here }}); } |