@Test public void test() { JavaArchive archive = ShrinkWrap.create(JavaArchive.class).addClasses(Implementation.class, Interface.class, Argument.class, Result.class, TestSeparateInvocator.class); SeparateInvocator.<Interface, Implementation>invoke(Implementation.class, archive).run(new Argument(), "xyz"); }
public static <I, T extends I> I invoke(Class<T> clazz, JavaArchive... classPathArchives) { JavaArchive[] copy = new JavaArchive[classPathArchives.length + 1]; System.arraycopy(classPathArchives, 0, copy, 0, classPathArchives.length); copy[copy.length - 1] = ShrinkWrap.create(JavaArchive.class).addClass(SerializationUtils.class); ClassLoader separatedClassLoader = new ShrinkWrapClassLoader(ClassLoaderUtils.getBootstrapClassLoader(), copy); return invoke(clazz, separatedClassLoader); }
SeparateInvocator { public static <I, T extends I> I invoke(Class<T> clazz, JavaArchive... classPathArchives) { JavaArchive[] copy = new JavaArchive[classPathArchives.length + 1]; System.arraycopy(classPathArchives, 0, copy, 0, classPathArchives.length); copy[copy.length - 1] = ShrinkWrap.create(JavaArchive.class).addClass(SerializationUtils.class); ClassLoader separatedClassLoader = new ShrinkWrapClassLoader(ClassLoaderUtils.getBootstrapClassLoader(), copy); return invoke(clazz, separatedClassLoader); } }
SeparateInvocator { public static <I, T extends I> I invoke(Class<T> clazz, JavaArchive... classPathArchives) { JavaArchive[] copy = new JavaArchive[classPathArchives.length + 1]; System.arraycopy(classPathArchives, 0, copy, 0, classPathArchives.length); copy[copy.length - 1] = ShrinkWrap.create(JavaArchive.class).addClass(SerializationUtils.class); ClassLoader separatedClassLoader = new ShrinkWrapClassLoader(ClassLoaderUtils.getBootstrapClassLoader(), copy); return invoke(clazz, separatedClassLoader); } private  SeparateInvocator(Class<T> clazz, ClassLoader separatedClassLoader); }
SeparateInvocator { public static <I, T extends I> I invoke(Class<T> clazz, JavaArchive... classPathArchives) { JavaArchive[] copy = new JavaArchive[classPathArchives.length + 1]; System.arraycopy(classPathArchives, 0, copy, 0, classPathArchives.length); copy[copy.length - 1] = ShrinkWrap.create(JavaArchive.class).addClass(SerializationUtils.class); ClassLoader separatedClassLoader = new ShrinkWrapClassLoader(ClassLoaderUtils.getBootstrapClassLoader(), copy); return invoke(clazz, separatedClassLoader); } private  SeparateInvocator(Class<T> clazz, ClassLoader separatedClassLoader); static I invoke(Class<T> clazz, JavaArchive... classPathArchives); @SuppressWarnings("unchecked") static I invoke(Class<T> clazz, ClassLoader separatedClassLoader); }
SeparateInvocator { public static <I, T extends I> I invoke(Class<T> clazz, JavaArchive... classPathArchives) { JavaArchive[] copy = new JavaArchive[classPathArchives.length + 1]; System.arraycopy(classPathArchives, 0, copy, 0, classPathArchives.length); copy[copy.length - 1] = ShrinkWrap.create(JavaArchive.class).addClass(SerializationUtils.class); ClassLoader separatedClassLoader = new ShrinkWrapClassLoader(ClassLoaderUtils.getBootstrapClassLoader(), copy); return invoke(clazz, separatedClassLoader); } private  SeparateInvocator(Class<T> clazz, ClassLoader separatedClassLoader); static I invoke(Class<T> clazz, JavaArchive... classPathArchives); @SuppressWarnings("unchecked") static I invoke(Class<T> clazz, ClassLoader separatedClassLoader);  }