Ensures that the given classes are initialized, as described in JLS Section 12.4.2 . WARNING: Normally it's a smell if a class needs to be explicitly initialized, because static state hurts system maintaina
(Class<?>... classes)
| 61 | * @throws ExceptionInInitializerError if an exception is thrown during initialization of a class |
| 62 | */ |
| 63 | public static void initialize(Class<?>... classes) { |
| 64 | for (Class<?> clazz : classes) { |
| 65 | try { |
| 66 | Class.forName(clazz.getName(), true, clazz.getClassLoader()); |
| 67 | } catch (ClassNotFoundException e) { |
| 68 | throw new AssertionError(e); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Returns a proxy instance that implements {@code interfaceType} by dispatching method |