Created
September 15, 2019 18:11
-
-
Save solidsnack/65b111351de17a45671c48bca225be49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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