< prev index next >

src/java.base/share/classes/sun/reflect/annotation/TypeAnnotationParser.java

Print this page

        

*** 121,133 **** @SuppressWarnings("unchecked") ArrayList<TypeAnnotation> tmp = l[pos]; tmp.add(t); } } for (int i = 0; i < size; i++) { @SuppressWarnings("unchecked") ! ArrayList<TypeAnnotation> list = l[i]; TypeAnnotation[] typeAnnotations; if (list != null) { typeAnnotations = list.toArray(new TypeAnnotation[list.size()]); } else { typeAnnotations = EMPTY_TYPE_ANNOTATION_ARRAY; --- 121,154 ---- @SuppressWarnings("unchecked") ArrayList<TypeAnnotation> tmp = l[pos]; tmp.add(t); } } + // If a constructor has a mandated outer this, it has no + // annotations and the annotations to parameter mapping should + // be offset by 1. + boolean offset = false; + if (decl instanceof Constructor) { + Constructor<?> ctor = (Constructor<?>) decl; + Class<?> declaringClass = ctor.getDeclaringClass(); + if (!declaringClass.isEnum() && + (declaringClass.isMemberClass() && + (declaringClass.getModifiers() & Modifier.STATIC) == 0) ) { + } + offset = true; + } for (int i = 0; i < size; i++) { + ArrayList<TypeAnnotation> list; + if (offset) { @SuppressWarnings("unchecked") ! ArrayList<TypeAnnotation> tmp = (i == 0) ? null : l[i - 1]; ! list = tmp; ! } else { ! @SuppressWarnings("unchecked") ! ArrayList<TypeAnnotation> tmp = l[i]; ! list = tmp; ! } TypeAnnotation[] typeAnnotations; if (list != null) { typeAnnotations = list.toArray(new TypeAnnotation[list.size()]); } else { typeAnnotations = EMPTY_TYPE_ANNOTATION_ARRAY;
< prev index next >