diff options
author | Andy Clement <andrew.clement@gmail.com> | 2012-09-06 09:37:31 -0700 |
---|---|---|
committer | Andy Clement <andrew.clement@gmail.com> | 2012-09-06 09:37:31 -0700 |
commit | c2ff74fd569ea2ef0c4abdc06e3f36a77b1ddd2c (patch) | |
tree | 4b6d7effe125c9d8d4e06ea96ad54cfb35e83cf8 /weaver | |
parent | 55ebaa15305cc686c6ed5915ff1115071b3c80bd (diff) | |
download | aspectj-c2ff74fd569ea2ef0c4abdc06e3f36a77b1ddd2c.tar.gz aspectj-c2ff74fd569ea2ef0c4abdc06e3f36a77b1ddd2c.zip |
388971 - fix for double synthetic attributes
Diffstat (limited to 'weaver')
-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())) { |