Recently I upgraded to JDK19 and I am trying to list all the declared fields in the Method class. But it returns nothing.
import java.lang.reflect.Method;
import java.util.Arrays;
public class MethodFieldsDemo {
public static void main(String... args){
Arrays.stream(Method.class.getDeclaredFields()).forEach(f-> System.out.println(f.getName()));
}
}
When I run the same program using JDK 8, it returns all the fields.
Am I missing something or is there anything I need to do when workign with JDK 19.