diff options
author | acolyer <acolyer> | 2005-09-01 12:39:01 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-09-01 12:39:01 +0000 |
commit | a114d244a365a653b52764110d6d312997d70c3e (patch) | |
tree | 3ed63a8f3cf0adf7d9fbb20710eace9dc9d9645e | |
parent | 2ce81c85a936ab156c4147dd426c5067955906e7 (diff) | |
download | aspectj-a114d244a365a653b52764110d6d312997d70c3e.tar.gz aspectj-a114d244a365a653b52764110d6d312997d70c3e.zip |
make sure we have *all* the formals in scope when unpacking the signature
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelField.java | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelField.java b/weaver/src/org/aspectj/weaver/bcel/BcelField.java index 7cdb10981..ad8edab0d 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelField.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelField.java @@ -148,26 +148,38 @@ final class BcelField extends ResolvedMemberImpl { } private void unpackGenericSignature() { - if (unpackedGenericSignature) return; + if (unpackedGenericSignature) + return; unpackedGenericSignature = true; String gSig = field.getGenericSignature(); if (gSig != null) { - // get from generic - Signature.FieldTypeSignature fts = new GenericSignatureParser().parseAsFieldSignature(gSig); - Signature.ClassSignature genericTypeSig = bcelObjectType.getGenericClassTypeSignature(); - Signature.FormalTypeParameter[] typeVars = ((genericTypeSig == null) ? new Signature.FormalTypeParameter[0] : genericTypeSig.formalTypeParameters); - try { - genericFieldType = - BcelGenericSignatureToTypeXConverter.fieldTypeSignature2TypeX(fts, typeVars, world); - } catch (GenericSignatureFormatException e) { - // development bug, fail fast with good info - throw new IllegalStateException( - "While determing the generic field type of " + this.toString() - + " with generic signature " + gSig + " the following error was detected: " - + e.getMessage()); - } + // get from generic + Signature.FieldTypeSignature fts = new GenericSignatureParser().parseAsFieldSignature(gSig); + Signature.ClassSignature genericTypeSig = bcelObjectType.getGenericClassTypeSignature(); + + Signature.FormalTypeParameter[] parentFormals = bcelObjectType.getAllFormals(); + Signature.FormalTypeParameter[] typeVars = + ((genericTypeSig == null) ? new Signature.FormalTypeParameter[0] : genericTypeSig.formalTypeParameters); + Signature.FormalTypeParameter[] formals = + new Signature.FormalTypeParameter[parentFormals.length + typeVars.length]; + // put method formal in front of type formals for overriding in + // lookup + System.arraycopy(typeVars, 0, formals, 0, typeVars.length); + System.arraycopy(parentFormals, 0, formals, typeVars.length,parentFormals.length); + + try { + genericFieldType = BcelGenericSignatureToTypeXConverter + .fieldTypeSignature2TypeX(fts, formals, world); + } catch (GenericSignatureFormatException e) { + // development bug, fail fast with good info + throw new IllegalStateException( + "While determing the generic field type of " + + this.toString() + " with generic signature " + + gSig + " the following error was detected: " + + e.getMessage()); + } } else { - genericFieldType = getReturnType(); - } + genericFieldType = getReturnType(); + } } }
\ No newline at end of file |