Why @Rule annotated fields in JUnit has to be public?
The JUnit runner will need to access the field reflectively to run the rule. If the field was private the access would throw IllegalAccessException. Another option would have been to have the runner modify the access from private to public before running the rule. However that could cause problems in case a security manager is … Read more