--- old/make/java/java/mapfile-vers 2013-03-21 15:28:42.114050505 +0100 +++ new/make/java/java/mapfile-vers 2013-03-21 15:28:41.858045451 +0100 @@ -191,6 +191,8 @@ Java_java_lang_reflect_Array_setLong; Java_java_lang_reflect_Array_setShort; Java_java_lang_reflect_Executable_getParameters0; + Java_java_lang_reflect_Executable_getTypeAnnotationBytes0; + Java_java_lang_reflect_Field_getTypeAnnotationBytes0; Java_java_lang_Runtime_freeMemory; Java_java_lang_Runtime_maxMemory; Java_java_lang_Runtime_gc; --- old/makefiles/mapfiles/libjava/mapfile-vers 2013-03-21 15:28:43.154071045 +0100 +++ new/makefiles/mapfiles/libjava/mapfile-vers 2013-03-21 15:28:42.898065989 +0100 @@ -191,6 +191,8 @@ Java_java_lang_reflect_Array_setLong; Java_java_lang_reflect_Array_setShort; Java_java_lang_reflect_Executable_getParameters0; + Java_java_lang_reflect_Executable_getTypeAnnotationBytes0; + Java_java_lang_reflect_Field_getTypeAnnotationBytes0; Java_java_lang_Runtime_freeMemory; Java_java_lang_Runtime_maxMemory; Java_java_lang_Runtime_gc; --- old/src/share/classes/java/lang/reflect/Executable.java 2013-03-21 15:28:44.186091426 +0100 +++ new/src/share/classes/java/lang/reflect/Executable.java 2013-03-21 15:28:43.902085817 +0100 @@ -329,6 +329,7 @@ private transient volatile Parameter[] parameters; private native Parameter[] getParameters0(); + native byte[] getTypeAnnotationBytes0(); /** * Returns an array of {@code Class} objects that represent the --- old/src/share/classes/java/lang/reflect/Field.java 2013-03-21 15:28:45.310113624 +0100 +++ new/src/share/classes/java/lang/reflect/Field.java 2013-03-21 15:28:45.050108489 +0100 @@ -81,8 +81,6 @@ // currently only two levels deep (i.e., one root Field and // potentially many Field objects pointing to it.) private Field root; - // This is set by the vm at Field creation - private byte[] typeAnnotations; // Generics infrastructure @@ -148,7 +146,6 @@ res.fieldAccessor = fieldAccessor; res.overrideFieldAccessor = overrideFieldAccessor; - res.typeAnnotations = typeAnnotations; return res; } @@ -1055,6 +1052,8 @@ return declaredAnnotations; } + private native byte[] getTypeAnnotationBytes0(); + /** * Returns an AnnotatedType object that represents the use of a type to specify * the declared type of the field represented by this Field. @@ -1062,7 +1061,7 @@ * @since 1.8 */ public AnnotatedType getAnnotatedType() { - return TypeAnnotationParser.buildAnnotatedType(typeAnnotations, + return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(), sun.misc.SharedSecrets.getJavaLangAccess(). getConstantPool(getDeclaringClass()), this, --- old/src/share/classes/java/lang/reflect/Method.java 2013-03-21 15:28:46.282132821 +0100 +++ new/src/share/classes/java/lang/reflect/Method.java 2013-03-21 15:28:46.066128556 +0100 @@ -79,8 +79,6 @@ // currently only two levels deep (i.e., one root Method and // potentially many Method objects pointing to it.) private Method root; - // This is set by the vm at Method creation - private byte[] typeAnnotations; // Generics infrastructure private String getGenericSignature() {return signature;} @@ -151,8 +149,6 @@ res.root = this; // Might as well eagerly propagate this if already present res.methodAccessor = methodAccessor; - - res.typeAnnotations = typeAnnotations; return res; } @@ -167,7 +163,7 @@ } @Override byte[] getTypeAnnotationBytes() { - return typeAnnotations; + return getTypeAnnotationBytes0(); } /** --- old/src/share/javavm/export/jvm.h 2013-03-21 15:28:47.438155652 +0100 +++ new/src/share/javavm/export/jvm.h 2013-03-21 15:28:47.154150042 +0100 @@ -470,6 +470,11 @@ JNIEXPORT jbyteArray JNICALL JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls); +JNIEXPORT jbyteArray JNICALL +JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field); + +JNIEXPORT jbyteArray JNICALL +JVM_GetMethodTypeAnnotations(JNIEnv *env, jobject method); /* * New (JDK 1.4) reflection implementation --- old/src/share/native/java/lang/reflect/Executable.c 2013-03-21 15:28:48.518176980 +0100 +++ new/src/share/native/java/lang/reflect/Executable.c 2013-03-21 15:28:48.254171766 +0100 @@ -23,11 +23,7 @@ * questions. */ -#include -#include - #include "jni.h" -#include "jni_util.h" #include "jvm.h" #include "java_lang_reflect_Executable.h" @@ -36,3 +32,9 @@ jobject method) { return JVM_GetMethodParameters(env, method); } + +JNIEXPORT jbyteArray JNICALL +Java_java_lang_reflect_Executable_getTypeAnnotationBytes0(JNIEnv *env, + jobject method) { + return JVM_GetMethodTypeAnnotations(env, method); +} --- /dev/null 2013-03-08 18:57:39.197921157 +0100 +++ new/src/share/native/java/lang/reflect/Field.c 2013-03-21 15:28:49.090188278 +0100 @@ -0,0 +1,34 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +#include "jni.h" +#include "jvm.h" +#include "java_lang_reflect_Field.h" + +JNIEXPORT jbyteArray JNICALL +Java_java_lang_reflect_Field_getTypeAnnotationBytes0(JNIEnv *env, + jobject method) { + return JVM_GetFieldTypeAnnotations(env, method); +}