summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2011-02-02 19:31:02 +0000
committeraclement <aclement>2011-02-02 19:31:02 +0000
commitba424355222a08bdc0f9d98e8b0e2050cf6292af (patch)
treef26994bc3755e5ab4c08bf033cc4e5d551d40ccb
parent835f31af6fe633ace7c710e59c49316a373fba7b (diff)
downloadaspectj-ba424355222a08bdc0f9d98e8b0e2050cf6292af.tar.gz
aspectj-ba424355222a08bdc0f9d98e8b0e2050cf6292af.zip
335682
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java31
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelMethod.java5
2 files changed, 18 insertions, 18 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
index b74f85210..4e9495799 100644
--- a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
+++ b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
@@ -231,7 +231,7 @@ public class AtAjAttributes {
boolean hasAtAspectAnnotation = false;
boolean hasAtPrecedenceAnnotation = false;
- boolean versionProcessed = false;
+ WeaverVersionInfo wvinfo = null;
for (int i = 0; i < attributes.length; i++) {
Attribute attribute = attributes[i];
if (acceptAttribute(attribute)) {
@@ -254,15 +254,14 @@ public class AtAjAttributes {
try {
VersionedDataInputStream s = new VersionedDataInputStream(new ByteArrayInputStream(
((Unknown) attribute).getBytes()), null);
- WeaverVersionInfo wvi = WeaverVersionInfo.read(s);
- struct.ajAttributes.add(0, wvi);
- versionProcessed = true;
+ wvinfo = WeaverVersionInfo.read(s);
+ struct.ajAttributes.add(0, wvinfo);
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}
- if (!versionProcessed) {
+ if (wvinfo == null) {
// If we are in here due to a resetState() call (presumably because of reweavable state processing), the
// original type delegate will have been set with a version but that version will be missing from
// the new set of attributes (looks like a bug where the version attribute was not included in the
@@ -270,15 +269,18 @@ public class AtAjAttributes {
// if it set on the delegate for the type.
ReferenceTypeDelegate delegate = type.getDelegate();
if (delegate instanceof BcelObjectType) {
- WeaverVersionInfo wvi = ((BcelObjectType) delegate).getWeaverVersionAttribute();
- if (wvi != null && wvi.getMajorVersion() != WeaverVersionInfo.WEAVER_VERSION_MAJOR_UNKNOWN) {
- // use this one
- struct.ajAttributes.add(0, wvi);
- versionProcessed = true;
+ wvinfo = ((BcelObjectType) delegate).getWeaverVersionAttribute();
+ if (wvinfo != null) {
+ if (wvinfo.getMajorVersion() != WeaverVersionInfo.WEAVER_VERSION_MAJOR_UNKNOWN) {
+ // use this one
+ struct.ajAttributes.add(0, wvinfo);
+ } else {
+ wvinfo = null;
+ }
}
}
- if (!versionProcessed) {
- struct.ajAttributes.add(0, new AjAttribute.WeaverVersionInfo());
+ if (wvinfo == null) {
+ struct.ajAttributes.add(0, wvinfo = new AjAttribute.WeaverVersionInfo());
}
}
@@ -358,9 +360,6 @@ public class AtAjAttributes {
}
}
if (processedPointcut) {
- // FIXME asc should check we aren't adding multiple versions...
- // will do once I get the tests passing again...
- struct.ajAttributes.add(new AjAttribute.WeaverVersionInfo());
struct.ajAttributes.addAll(mstruct.ajAttributes);
}
}
@@ -561,7 +560,7 @@ public class AtAjAttributes {
// struct.context.getOffset()+1);//FIXME
// AVASM
// Not setting version here
- //struct.ajAttributes.add(new AjAttribute.WeaverVersionInfo());
+ // struct.ajAttributes.add(new AjAttribute.WeaverVersionInfo());
AjAttribute.Aspect aspectAttribute = new AjAttribute.Aspect(perClause);
struct.ajAttributes.add(aspectAttribute);
FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
index a97804404..13f883f1e 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
@@ -34,6 +34,7 @@ import org.aspectj.util.GenericSignature;
import org.aspectj.util.GenericSignature.TypeVariableSignature;
import org.aspectj.util.GenericSignatureParser;
import org.aspectj.weaver.AjAttribute;
+import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
import org.aspectj.weaver.AnnotationAJ;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.ISourceContext;
@@ -195,9 +196,9 @@ class BcelMethod extends ResolvedMemberImpl {
private void unpackAjAttributes(World world) {
associatedShadowMunger = null;
ResolvedType resolvedDeclaringType = getDeclaringType().resolve(world);
+ WeaverVersionInfo wvinfo = bcelObjectType.getWeaverVersionAttribute();
List<AjAttribute> as = Utility.readAjAttributes(resolvedDeclaringType.getClassName(), method.getAttributes(),
- resolvedDeclaringType.getSourceContext(), world, bcelObjectType.getWeaverVersionAttribute(),
- new BcelConstantPoolReader(method.getConstantPool()));
+ resolvedDeclaringType.getSourceContext(), world, wvinfo, new BcelConstantPoolReader(method.getConstantPool()));
processAttributes(world, as);
as = AtAjAttributes.readAj5MethodAttributes(method, this, resolvedDeclaringType, preResolvedPointcut,
resolvedDeclaringType.getSourceContext(), world.getMessageHandler());