Skip to content
Browse files

[Issue #394] Added javadoc mentioning special case when subclass over…

…rides/shadows superclass methods
1 parent b9e14f6 commit 6adb3ad892ed858849f4a80cd051441e8024226e @amalakar committed Sep 14, 2012
View
3 src/main/java/org/junit/After.java
@@ -13,6 +13,9 @@
* exception. The <code>&#064;After</code> methods declared in superclasses will be run after those of the current
* class.</p>
*
+ * <p>Note: If a subclass overrides a <code>&#064;After</code> method of the superclass, it would render the
+ * <code>&#064;After</code> annotation of the superclass useless.</p>
+ *
* Here is a simple example:
* <pre>
* public class Example {
View
3 src/main/java/org/junit/AfterClass.java
@@ -13,6 +13,9 @@
* exception. The <code>&#064;AfterClass</code> methods declared in superclasses will be run after those of the current
* class.</p>
*
+ * <p>Note: If a subclass shadows a <code>&#064;AfterClass</code> method of the superclass by using the
+ * same name, it would render the <code>&#064;AfterClass</code> annotation of the superclass useless.</p>
+ *
* Here is a simple example:
* <pre>
* public class Example {
View
3 src/main/java/org/junit/Before.java
@@ -12,6 +12,9 @@
* The <code>&#064;Before</code> methods of superclasses will be run before those of the current class.
* No other ordering is defined.
* </p>
+ *
+ * <p>Note: If a subclass overrides a <code>&#064;Before</code> method of the superclass, it would render the
+ * <code>&#064;Before</code> annotation of the superclass useless.</p>
*
* Here is a simple example:
* <pre>
View
3 src/main/java/org/junit/BeforeClass.java
@@ -13,6 +13,9 @@
* the test methods in the class. The <code>@BeforeClass</code> methods of superclasses
* will be run before those the current class.</p>
*
+ * <p>Note: If a subclass shadows a <code>&#064;BeforeClass</code> method of the superclass by using the
+ * same name, it would render the <code>&#064;BeforeClass</code> annotation of the superclass useless.</p>
+ *
* For example:
* <pre>
* public class Example {

4 comments on commit 6adb3ad

@UnquietCode

I just wanted to mention that I ran into this issue recently and was peeved that there was no mention of this behavior in the javadocs. Glad to see it patched!

@amalakar
Owner

@UnquietCode well I wasted couple of hours myself before realizing it. Figured putting it in the javadoc would help others. @dsaff was very quick in response and merged the changes immediately.

@UnquietCode

As they say, “You can recognize a pioneer by the arrow in his back." So, I guess you're the pioneer who lived to tell your tale and warn the others. :)

@amalakar
Owner
Please sign in to comment.
Something went wrong with that request. Please try again.