From 3f77e755e504d24e0dc6fd640972d56de15a6bef Mon Sep 17 00:00:00 2001 From: acolyer Date: Sun, 15 Jan 2006 21:33:55 +0000 Subject: [PATCH] pr122248, only unpack generic signatures if the world is in java 5 mode... --- weaver/src/org/aspectj/weaver/bcel/BcelField.java | 7 +++++-- weaver/src/org/aspectj/weaver/bcel/BcelMethod.java | 6 ++++++ weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java | 3 +++ weaver/testsrc/org/aspectj/weaver/MemberTestCase15.java | 2 ++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelField.java b/weaver/src/org/aspectj/weaver/bcel/BcelField.java index b5346b158..d512aaca4 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelField.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelField.java @@ -156,8 +156,11 @@ final class BcelField extends ResolvedMemberImpl { } private void unpackGenericSignature() { - if (unpackedGenericSignature) - return; + if (unpackedGenericSignature) { return; } + if (!world.isInJava5Mode()) { + this.genericFieldType = getReturnType(); + return; + } unpackedGenericSignature = true; String gSig = field.getGenericSignature(); if (gSig != null) { diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java index b5555553b..b54226745 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java @@ -265,6 +265,12 @@ final class BcelMethod extends ResolvedMemberImpl { private void unpackGenericSignature() { if (unpackedGenericSignature) return; + if (!world.isInJava5Mode()) { + this.genericReturnType = getReturnType(); + this.genericParameterTypes = getParameterTypes(); + return; + } + // ok, we have work to do... unpackedGenericSignature = true; String gSig = method.getGenericSignature(); if (gSig != null) { diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java index 8ee6ab638..f83d96b7f 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java @@ -633,6 +633,9 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { private void unpackGenericSignature() { if (genericSignatureUnpacked) return; + if (!getResolvedTypeX().getWorld().isInJava5Mode()) { + return; + } genericSignatureUnpacked = true; Signature.ClassSignature cSig = getGenericClassTypeSignature(); if (cSig != null) { diff --git a/weaver/testsrc/org/aspectj/weaver/MemberTestCase15.java b/weaver/testsrc/org/aspectj/weaver/MemberTestCase15.java index a3c60d709..8014289e7 100644 --- a/weaver/testsrc/org/aspectj/weaver/MemberTestCase15.java +++ b/weaver/testsrc/org/aspectj/weaver/MemberTestCase15.java @@ -40,6 +40,7 @@ public class MemberTestCase15 extends TestCase { public void testCanBeParameterizedGenericMethod() { BcelWorld world = new BcelWorld(); + world.setBehaveInJava5Way(true); ResolvedType javaLangClass = world.resolve(UnresolvedType.forName("java.lang.Class")); javaLangClass = javaLangClass.getGenericType(); if (javaLangClass == null) return; // for < 1.5 @@ -59,6 +60,7 @@ public class MemberTestCase15 extends TestCase { public void testCanBeParameterizedMethodInGenericType() { BcelWorld world = new BcelWorld(); + world.setBehaveInJava5Way(true); ResolvedType javaUtilList = world.resolve(UnresolvedType.forName("java.util.List")); javaUtilList = javaUtilList.getGenericType(); if (javaUtilList == null) return; // for < 1.5 -- 2.39.5