aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2005-12-08 15:35:45 +0000
committeraclement <aclement>2005-12-08 15:35:45 +0000
commit8b87db5ac266514d35e1632546d6888e7ca2f6d0 (patch)
tree22506970908cb183fba1a5d00db2cd2f5ba26600
parentf5f36e2dd0f1318f44397f691c480967c57dbfb4 (diff)
downloadaspectj-8b87db5ac266514d35e1632546d6888e7ca2f6d0.tar.gz
aspectj-8b87db5ac266514d35e1632546d6888e7ca2f6d0.zip
fixes for 119210 - allows for autoboxing with around advice.
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelShadow.java4
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/Utility.java35
2 files changed, 36 insertions, 3 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
index d9ab3af72..9163bc019 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
@@ -2231,7 +2231,7 @@ public class BcelShadow extends Shadow {
Utility.createConversion(
getFactory(),
BcelWorld.makeBcelType(mungerSig.getReturnType()),
- extractedMethod.getReturnType()));
+ extractedMethod.getReturnType(),world.isInJava5Mode()));
if (! isFallsThrough()) {
advice.append(InstructionFactory.createReturn(extractedMethod.getReturnType()));
}
@@ -2659,7 +2659,7 @@ public class BcelShadow extends Shadow {
Utility.createConversion(
getFactory(),
BcelWorld.makeBcelType(munger.getSignature().getReturnType()),
- callbackMethod.getReturnType());
+ callbackMethod.getReturnType(),world.isInJava5Mode());
if (!isFallsThrough()) {
returnConversionCode.append(
InstructionFactory.createReturn(callbackMethod.getReturnType()));
diff --git a/weaver/src/org/aspectj/weaver/bcel/Utility.java b/weaver/src/org/aspectj/weaver/bcel/Utility.java
index ef7324a8e..7eec5ef41 100644
--- a/weaver/src/org/aspectj/weaver/bcel/Utility.java
+++ b/weaver/src/org/aspectj/weaver/bcel/Utility.java
@@ -394,11 +394,15 @@ public class Utility {
}
}
+ public static InstructionList createConversion(InstructionFactory factory,Type fromType,Type toType) {
+ return createConversion(factory,fromType,toType,false);
+ }
public static InstructionList createConversion(
InstructionFactory fact,
Type fromType,
- Type toType) {
+ Type toType,
+ boolean allowAutoboxing) {
//System.out.println("cast to: " + toType);
InstructionList il = new InstructionList();
@@ -459,6 +463,35 @@ public class Utility {
&& ((ReferenceType)fromType).isAssignmentCompatibleWith(toType)) {
return il;
}
+
+ if (allowAutoboxing) {
+ if (toType instanceof BasicType && fromType instanceof ReferenceType) {
+ // unboxing
+ String name = toType.toString() + "Value";
+ il.append(
+ fact.createInvoke(
+ "org.aspectj.runtime.internal.Conversions",
+ name,
+ toType,
+ new Type[] { Type.OBJECT },
+ Constants.INVOKESTATIC));
+ return il;
+ }
+
+ if (fromType instanceof BasicType && toType instanceof ReferenceType) {
+ // boxing
+ String name = fromType.toString() + "Object";
+ il.append(
+ fact.createInvoke(
+ "org.aspectj.runtime.internal.Conversions",
+ name,
+ Type.OBJECT,
+ new Type[] { fromType },
+ Constants.INVOKESTATIC));
+ il.append(fact.createCast(Type.OBJECT, toType));
+ return il;
+ }
+ }
il.append(fact.createCast(fromType, toType));
return il;