How is Java implementation reflected?

The Java 7 language specifications speak quite early:

"this specification does not describe the reflection in detail."

I am wondering how: Reflection is implemented in Java?

I do not ask how it is used, and I understand that there may not be such a specific answer that I am looking for, but any information would be greatly appreciated.

I found this in Stackoverflow, a similar question about C #: How is reflection implemented in C #?

+4
source share
1 answer

The main entry point to any Reflection activity is the class Class. From it you can get Method, Field, Class, Constructorand Annotationinstances.

, , Java native. ,

private native Field[]       getDeclaredFields0(boolean publicOnly);
private native Method[]      getDeclaredMethods0(boolean publicOnly);
private native Constructor<T>[] getDeclaredConstructors0(boolean publicOnly);
private native Class<?>[]   getDeclaredClasses0();
private native byte[] getRawAnnotations(); // get converted to Annotation instances later

C- (/ ++). JDK , , , . OpenJDK .

+2

All Articles