@ SuppressForbidden ( "legitimate sysstreams." ) public static void warn ( String message , Throwable t ) { PrintStream w = ( warnings == null ? System . err : warnings ) ; try { w . print ( "WARN: " ) ; w . print ( message ) ; if ( t != null ) { w . print ( " -> " ) ; try { t . printStackTrace ( w ) ; } catch ( OutOfMemoryError e ) { // Ignore, OOM. w . print ( t . getClass ( ) . getName ( ) ) ; w . print ( ": " ) ; w . print ( t . getMessage ( ) ) ; w . println ( " (stack unavailable; OOM)" ) ; } } else { w . println ( ) ; } w . flush ( ) ; } catch ( OutOfMemoryError t2 ) { w . println ( "ERROR: Couldn't even serialize a warning (out of memory)." ) ; } catch ( Throwable t2 ) { // Can't do anything, really. Probably an OOM? w . println ( "ERROR: Couldn't even serialize a warning." ) ; } }
Warning emitter . Uses whatever alternative non - event communication channel is .