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
}
val o = binding.provider.get()
if (o !is AutoCloseable) {
if (!AutoCloseable::class.java.isAssignableFrom(binding.key.typeLiteral.rawType)) {
continue
}
val o = binding.provider.get() as AutoCloseable
o.close()
}
}

Loading…
Cancel
Save