From: aclement Date: Mon, 29 Sep 2008 23:22:48 +0000 (+0000) Subject: cope with someone asking the wrong question X-Git-Tag: V1_6_2~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5542c2e3afd491f9754444e295adfb7c208ef5df;p=aspectj.git cope with someone asking the wrong question --- diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeParameterAnnotations.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeParameterAnnotations.java index 1b93f6a86..6f378351c 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeParameterAnnotations.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeParameterAnnotations.java @@ -52,6 +52,14 @@ public abstract class RuntimeParameterAnnotations extends Attribute { public AnnotationGen[] getAnnotationsOnParameter(int parameterIndex) { if (!inflated) inflate(); + // This may happen. In a ctor for a non static inner type the compiler + // may have added an extra parameter to the generated ctor (the parameter + // contains the instance of the outer class) - in this case + // it may appear that there are more parameters than there are entries + // in the parameter annotations array + if (parameterIndex>=parameterAnnotations.size()) { + return AnnotationGen.NO_ANNOTATIONS; + } return (AnnotationGen[])parameterAnnotations.get(parameterIndex); }