From 5542c2e3afd491f9754444e295adfb7c208ef5df Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 29 Sep 2008 23:22:48 +0000 Subject: [PATCH] cope with someone asking the wrong question --- .../classfile/annotation/RuntimeParameterAnnotations.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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); } -- 2.39.5