@@ -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) { |
@@ -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) { |
@@ -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) { |
@@ -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 |