Skip to content

Commit 1cc5e73

Browse files
committed
#2914: explain 'superseding' in javadoc of @[Before|After][All|Each] methods
1 parent 7ee8db5 commit 1cc5e73

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterAll.java

+9-6
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,17 @@
4343
* <h2>Inheritance and Execution Order</h2>
4444
*
4545
* <p>{@code @AfterAll} methods are inherited from superclasses as long as
46-
* they are not <em>hidden</em> or <em>overridden</em>. Furthermore,
47-
* {@code @AfterAll} methods from superclasses will be executed after
48-
* {@code @AfterAll} methods in subclasses.
46+
* they are not <em>hidden</em> (default mode with {@code static} modifier) or
47+
* <em>overridden</em> or 'superseded' (i.e., replaced based on signature only,
48+
* irrespective of Java's visibility rules). Furthermore, {@code @AfterAll}
49+
* methods from superclasses will be executed after {@code @AfterAll} methods
50+
* in subclasses.
4951
*
5052
* <p>Similarly, {@code @AfterAll} methods declared in an interface are
51-
* inherited as long as they are not <em>hidden</em> or <em>overridden</em>,
52-
* and {@code @AfterAll} methods from an interface will be executed after
53-
* {@code @AfterAll} methods in the class that implements the interface.
53+
* inherited as long as they are not <em>hidden</em> or <em>overridden</em>
54+
* (or 'superseded', see above), and {@code @AfterAll} methods from an
55+
* interface will be executed after {@code @AfterAll} methods in the class
56+
* that implements the interface.
5457
*
5558
* <p>JUnit Jupiter does not guarantee the execution order of multiple
5659
* {@code @AfterAll} methods that are declared within a single test class or

junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterEach.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@
3636
* <h2>Inheritance and Execution Order</h2>
3737
*
3838
* <p>{@code @AfterEach} methods are inherited from superclasses as long as
39-
* they are not overridden. Furthermore, {@code @AfterEach} methods from
40-
* superclasses will be executed after {@code @AfterEach} methods in subclasses.
39+
* they are not overridden or 'superseded' (i.e., replaced based on signature
40+
* only, irrespective of Java's visibility rules). Furthermore,
41+
* {@code @AfterEach} methods from superclasses will be executed after
42+
* {@code @AfterEach} methods in subclasses.
4143
*
4244
* <p>Similarly, {@code @AfterEach} methods declared as <em>interface default
4345
* methods</em> are inherited as long as they are not overridden, and

junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeAll.java

+9-6
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,17 @@
4343
* <h2>Inheritance and Execution Order</h2>
4444
*
4545
* <p>{@code @BeforeAll} methods are inherited from superclasses as long as
46-
* they are not <em>hidden</em> or <em>overridden</em>. Furthermore,
47-
* {@code @BeforeAll} methods from superclasses will be executed before
48-
* {@code @BeforeAll} methods in subclasses.
46+
* they are not <em>hidden</em> (default mode with {@code static} modifier) or
47+
* <em>overridden</em> or 'superseded' (i.e., replaced based on signature only,
48+
* irrespective of Java's visibility rules). Furthermore, {@code @BeforeAll}
49+
* methods from superclasses will be executed before {@code @BeforeAll} methods
50+
* in subclasses.
4951
*
5052
* <p>Similarly, {@code @BeforeAll} methods declared in an interface are
51-
* inherited as long as they are not <em>hidden</em> or <em>overridden</em>,
52-
* and {@code @BeforeAll} methods from an interface will be executed before
53-
* {@code @BeforeAll} methods in the class that implements the interface.
53+
* inherited as long as they are not <em>hidden</em> or <em>overridden</em>
54+
* (or 'superseded', see above), and {@code @BeforeAll} methods from an
55+
* interface will be executed before {@code @BeforeAll} methods in the class
56+
* that implements the interface.
5457
*
5558
* <p>JUnit Jupiter does not guarantee the execution order of multiple
5659
* {@code @BeforeAll} methods that are declared within a single test class or

junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeEach.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@
3636
* <h2>Inheritance and Execution Order</h2>
3737
*
3838
* <p>{@code @BeforeEach} methods are inherited from superclasses as long as
39-
* they are not overridden. Furthermore, {@code @BeforeEach} methods from
40-
* superclasses will be executed before {@code @BeforeEach} methods in subclasses.
39+
* they are not overridden or 'superseded' (i.e., replaced based on signature
40+
* only, irrespective of Java's visibility rules). Furthermore,
41+
* {@code @BeforeEach} methods from superclasses will be executed before
42+
* {@code @BeforeEach} methods in subclasses.
4143
*
4244
* <p>Similarly, {@code @BeforeEach} methods declared as <em>interface default
4345
* methods</em> are inherited as long as they are not overridden, and

0 commit comments

Comments
 (0)