diff options
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java index 84ba6c0b4..b66c6106d 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -967,11 +967,12 @@ public final class LazyMethodGen implements Traceable { if (enclosingClass.getWorld().isInJava5Mode()) { gen.setModifiers(gen.getModifiers() | ACC_SYNTHETIC); } - // belt and braces, do the attribute even on Java 5 in addition to - // the modifier flag - ConstantPool cpg = gen.getConstantPool(); - int index = cpg.addUtf8("Synthetic"); - gen.addAttribute(new Synthetic(index, 0, new byte[0], cpg)); + if (!hasAttribute("Synthetic")) { + // belt and braces, do the attribute even on Java 5 in addition to the modifier flag + ConstantPool cpg = gen.getConstantPool(); + int index = cpg.addUtf8("Synthetic"); + gen.addAttribute(new Synthetic(index, 0, new byte[0], cpg)); + } } if (hasBody()) { @@ -991,6 +992,15 @@ public final class LazyMethodGen implements Traceable { } return gen; } + + private boolean hasAttribute(String attributeName) { + for (Attribute attr: attributes) { + if (attr.getName().equals(attributeName)) { + return true; + } + } + return false; + } private void forceSyntheticForAjcMagicMembers() { if (NameMangler.isSyntheticMethod(getName(), inAspect())) { |