@ Override public void run ( RunNotifier notifier ) { Description description = getDescription ( ) ; try { super . run ( notifier ) ; } finally { try { Whitebox . setInternalState ( description , "fAnnotations" , new Annotation [ ] { } ) ; } catch ( RuntimeException err ) { if ( err . getCause ( ) instanceof java . lang . NoSuchFieldException && err . getCause ( ) . getMessage ( ) . equals ( "modifiers" ) ) { // on JDK12 you cannot change 'modifiers' } else { throw err ; } } } }
Clean up some state to avoid OOM issues