Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Rule execution order looks to have been guaranteed since 4.12 but is not documented as such #1725

Open
cpovirk opened this issue Oct 21, 2021 · 1 comment

Comments

@cpovirk
Copy link
Contributor

cpovirk commented Oct 21, 2021

My understanding is that c75dcc2#diff-f35409420f2540415a9878beaf5a537248f301b6c683bb87a11016be3c9dc8b8R55 caused JUnit to begin processing @Rule fields in a defined order. The @Rule Javadoc, however, still states that the order is defined by the JVM's reflection API.

It would be good to know whether the intent is to commit to this order or not. I suppose that the current doc is technically wrong either way, since the current order is not dependent on the JVM reflection API :) But mainly I want to know how safe this is to rely on. Thanks.

(Sorry if I missed some past discussion in my searching or if I've misunderstood something.)

@panchenko
Copy link
Contributor

Since 4.13 the recommended way is using the order attribute of the @Rule annotation.
It's described in the Ordering section in bottom of the javadoc.
The sentence you linked is quite old and potentially needs an update :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants