File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/main/java/rx/internal/schedulers Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1616package rx .internal .schedulers ;
1717
1818import java .lang .reflect .*;
19- import java .util .Iterator ;
19+ import java .util .* ;
2020import java .util .concurrent .*;
2121import java .util .concurrent .atomic .AtomicReference ;
2222
@@ -110,10 +110,12 @@ public static void deregisterExecutor(ScheduledExecutorService service) {
110110 }
111111
112112 /** Purges each registered executor and eagerly evicts shutdown executors. */
113- @ SuppressAnimalSniffer // CHM.keySet returns KeySetView in Java 8+; false positive here
114113 static void purgeExecutors () {
115114 try {
116- Iterator <ScheduledThreadPoolExecutor > it = EXECUTORS .keySet ().iterator ();
115+ // This prevents map.keySet to compile to a Java 8+ KeySetView return type
116+ // and cause NoSuchMethodError on Java 6-7 runtimes.
117+ Map <ScheduledThreadPoolExecutor , ScheduledThreadPoolExecutor > map = EXECUTORS ;
118+ Iterator <ScheduledThreadPoolExecutor > it = map .keySet ().iterator ();
117119 while (it .hasNext ()) {
118120 ScheduledThreadPoolExecutor exec = it .next ();
119121 if (!exec .isShutdown ()) {
You can’t perform that action at this time.
0 commit comments