--- old/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java 2013-10-01 14:14:39.959663787 -0400 +++ new/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java 2013-10-01 14:14:39.679660888 -0400 @@ -128,14 +128,18 @@ for (int i = 0; i < size; i++) { @SuppressWarnings("unchecked") ArrayList list = l[i]; + TypeAnnotation[] typeAnnotations; if (list != null) { - TypeAnnotation[] typeAnnotations = list.toArray(new TypeAnnotation[0]); - result[i] = AnnotatedTypeFactory.buildAnnotatedType(types[i], - LocationInfo.BASE_LOCATION, - typeAnnotations, - typeAnnotations, - decl); + typeAnnotations = list.toArray(new TypeAnnotation[list.size()]); + } else { + typeAnnotations = EMPTY_TYPE_ANNOTATION_ARRAY; } + result[i] = AnnotatedTypeFactory.buildAnnotatedType(types[i], + LocationInfo.BASE_LOCATION, + typeAnnotations, + typeAnnotations, + decl); + } return result; } --- /dev/null 2013-10-01 09:54:12.860791519 -0400 +++ new/test/java/lang/reflect/Parameter/GetAnnotatedTypeTest.java 2013-10-01 14:14:40.474669147 -0400 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @compile -parameters GetAnnotatedTypeTest.java + * @run main GetAnnotatedTypeTest + * @summary javac should generate method parameters correctly. + */ + +public class GetAnnotatedTypeTest { + + public void meth(Object param) {} + + public static void main(String[] args) throws NoSuchMethodException { + if (GetAnnotatedTypeTest.class.getMethod("meth", Object.class).getParameters()[0].getAnnotatedType().getType() != Object.class) + throw new RuntimeException("Parameter did not have the expected annotated type"); + } +}