mercredi 1 mars 2017

Is Java automatically caching annotations and class metadata?

Java have a native support for annotations.

I'm wondering if when I call obj.getAnnotation(Annotation.class), java stores class metadata in any kind of cache.

I have the same question with reflection like:

for (Method method : obj.getDeclaredMethods()) {

        if (method.isAnnotationPresent(Annotation.class)) {

            Annotation annotation = method.getAnnotation(Annotation.class);
            Test test = (Test) annotation;

        }
}





Aucun commentaire:

Enregistrer un commentaire