mardi 17 janvier 2023

How to change an annotation at runtime with Reflection (JDK 17)

I'm trying to change the value of an annotation at runtime with Reflection, but I can't find out how to do that with JDK 17, I've done it in JDK 8, but it doesn't work in 17.

I've tried to do something, but nothing works...That's the code where I'm stuck into:

public void changeAnnotation(Class<?> clazz, Class<? extends Annotation> annotation) {
        Annotation oldAnnotation = clazz.getAnnotation(annotation);
    }




Aucun commentaire:

Enregistrer un commentaire