presto-main/src/main/java/io/prestosql/sql/gen/IsolatedClass.java/IsolatedClass/isolateClass
class IsolatedClass:    public static <T> Class<? extends T> isolateClass(
            DynamicClassLoader dynamicClassLoader,
            Class<T> publicBaseClass,
            Class<? extends T> implementationClass,
            Class<?>... additionalClasses)
    {
        ImmutableMap.Builder<String, byte[]> builder = ImmutableMap.builder();
        builder.put(implementationClass.getName(), getBytecode(implementationClass));
        for (Class<?> additionalClass : additionalClasses) {
            builder.put(additionalClass.getName(), getBytecode(additionalClass));
        }

        // load classes into a private class loader
        Map<String, Class<?>> isolatedClasses = dynamicClassLoader.defineClasses(builder.build());
        Class<?> isolatedClass = isolatedClasses.get(implementationClass.getName());

        // verify the isolated class
        checkArgument(isolatedClass != null, "Could load class %s", implementationClass.getName());
        checkArgument(publicBaseClass.isAssignableFrom(isolatedClass),
                "Error isolating class %s, newly loaded class is not a sub type of %s",
                implementationClass.getName(),
                publicBaseClass.getName());
        checkState(isolatedClass != implementationClass, "Isolation failed");

        return isolatedClass.asSubclass(publicBaseClass);
    }