Description
Most of these are innocuous and represent only a deviation from best practices.
Some invoke new SomeClass().staticMethod(), representing a trivial instantiation cost that is unlikely to be significant.
I am most concerned by the use in ThreadIdentifierJUnitTest, which includes the static-method matches in what appear to be misguided assertions. For instance
{ long real_tid_with_wan = ThreadIdentifier.getRealThreadIDIncludingWan(wan1); assertEquals(42, ThreadIdentifier.getRealThreadID(real_tid_with_wan)); assertTrue(ThreadIdentifier.isParallelWANThreadID(real_tid_with_wan)); assertTrue(WanType.PRIMARY.matches(real_tid_with_wan)); } // ... { long real_tid_with_wan = ThreadIdentifier.getRealThreadIDIncludingWan(wan3); assertEquals(42, ThreadIdentifier.getRealThreadID(real_tid_with_wan)); assertTrue(ThreadIdentifier.isParallelWANThreadID(real_tid_with_wan)); assertTrue(WanType.PARALLEL.matches(real_tid_with_wan)); }
Because PRIMARY and PARALLEL are instantiated fields of WanType, and because matches is a static method, these assertions are equivalent, while at the same time the developer who wrote these likely believed these assertions were distinct.
Attachments
1.
|
Reevaluate assertions in ThreadIdentifierJUnitTest | Open | Unassigned |