]> source.dussan.org Git - aspectj.git/commitdiff
cope with someone asking the wrong question
authoraclement <aclement>
Mon, 29 Sep 2008 23:22:48 +0000 (23:22 +0000)
committeraclement <aclement>
Mon, 29 Sep 2008 23:22:48 +0000 (23:22 +0000)
bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/RuntimeParameterAnnotations.java

index 1b93f6a866931bf2d8f8a3a1ab8a9a682a6ed0b8..6f378351c05e784b35ae6aaa27ea7fdbed75f012 100644 (file)
@@ -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);
        }