TestNG wtf

  •  I read "Next Generation Java Testing", which is mainly about a testing framework in Java, TestNG.

    This, for those unaware,  is quite heavy on its usage of annotations.

    So at some point, I read this:

    In order to make this possible, TestNG supports a mechanism called
    annotation inheritance. The idea is very simple—all TestNG annotations
    declared on a class will automatically be visible on all subclasses of this class.
    Before we explore the consequences of this functionality, let’s make a
    quick digression to emphasize an important point: Annotation inheritance is
    not supported by the JDK

    Then he continues with giving a code sample which "proves" that this statement is true.

    I really find hard to believe that a senior software engineer of Google, just doesn't use google, and happily moves on reinventing the wheel. Also hard to believe that such a statement is made when there are as few as 10 public types in java.lang.annotation package, how could the "Inherited" annotation be missed?

    Also, the following text makes it even more funny (following the erroneous code sample):

    Therefore, support for inheritance of annotations has to be supplied individually
    by each tool, and that’s exactly what TestNG does. Just don’t expect
    to find this behavior in other products, unless is it explicitly advertised.


Log in to reply

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.