Skip to content

Instantly share code, notes, and snippets.

@solidsnack
Created September 15, 2019 18:11
Show Gist options
  • Save solidsnack/65b111351de17a45671c48bca225be49 to your computer and use it in GitHub Desktop.
Save solidsnack/65b111351de17a45671c48bca225be49 to your computer and use it in GitHub Desktop.
public class Reflection {
private static final ReflectionFactory factory;
static {
ReflectionFactory impl;
try {
Class<?> implClass = Class.forName("kotlin.reflect.jvm.internal.ReflectionFactoryImpl");
impl = (ReflectionFactory) implClass.newInstance();
}
catch (ClassCastException e) { impl = null; }
catch (ClassNotFoundException e) { impl = null; }
catch (InstantiationException e) { impl = null; }
catch (IllegalAccessException e) { impl = null; }
factory = impl != null ? impl : new ReflectionFactory();
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment