Optimise CloseableInjector

We now avoid provisioning if the binding is not AutoCloseable.
master
Graham 2 years ago
parent c43d48f71b
commit 3fe7bdcedc
  1. 4
      inject/src/main/kotlin/org/openrs2/inject/CloseableInjector.kt

@ -12,11 +12,11 @@ public class CloseableInjector(
continue continue
} }
val o = binding.provider.get() if (!AutoCloseable::class.java.isAssignableFrom(binding.key.typeLiteral.rawType)) {
if (o !is AutoCloseable) {
continue continue
} }
val o = binding.provider.get() as AutoCloseable
o.close() o.close()
} }
} }

Loading…
Cancel
Save