class GlassFishPlugin {

    protected static AgentLogger LOGGER = AgentLogger.getLogger(GlassFishPlugin.class);

    private static String FRAMEWORK_BOOTDELEGATION = "org.osgi.framework.bootdelegation";

    private static final String BOOTDELEGATION_PACKAGES =
            "org.hotswap.agent, " +
            "org.hotswap.agent.*";


    @OnClassLoadEvent(classNameRegexp = "org.apache.felix.framework.Felix")
    public static void transformFelix(ClassPool classPool, CtClass ctClass) throws NotFoundException, CannotCompileException {<FILL_FUNCTION_BODY>}

    @OnClassLoadEvent(classNameRegexp = "org.apache.felix.framework.BundleWiringImpl")
    public static void transformBundleClassLoader(ClassPool classPool, CtClass ctClass) throws NotFoundException, CannotCompileException {

//        String initializePlugin = PluginManagerInvoker.buildInitializePlugin(GlassFishPlugin.class);
//
//        for (CtConstructor constructor : ctClass.getDeclaredConstructors()) {
//            constructor.insertAfter(initializePlugin);
//        }
//
        /*
        CtMethod getClassLoaderInternalCopy = CtMethod.make("public ClassLoader __getClassLoaderInternal(){return null;}", ctClass);
        getClassLoaderInternalCopy.setBody(ctClass.getDeclaredMethod("getClassLoaderInternal"), null);
        ctClass.addMethod(getClassLoaderInternalCopy);

        CtMethod getClassLoaderInternal = ctClass.getDeclaredMethod("getClassLoaderInternal");
        getClassLoaderInternal.setBody(
                "{  " +
                    "boolean wasClassLoader = (m_classLoader == null); " +
                    "ClassLoader ret = __getClassLoaderInternal();" +
                    "if (!wasClassLoader && ret != null) {" +
                        PluginManagerInvoker.buildInitializePlugin(GlassFishPlugin.class, "ret") +
                    "}" +
                    "return ret;" +
                "}"
        );

        LOGGER.debug("org.apache.felix.framework.BundleWiringImpl resource bundles registration.");
        */
    }
}


        CtClass[] constructorParams = new CtClass[] {
            classPool.get("java.util.Map")
        };

        CtConstructor declaredConstructor = ctClass.getDeclaredConstructor(constructorParams);
        declaredConstructor.insertBefore(
                "{" +
                    "if ($1 == null) { " +
                        "$1 = new java.util.HashMap();" +
                    "}" +
                    "String $$ha$bootDeleg = (String) $1.get(\"" + FRAMEWORK_BOOTDELEGATION + "\");" +
                    "if ($$ha$bootDeleg == null) {" +
                        "$$ha$bootDeleg = \"\";" +
                    "}" +
                    "if ($$ha$bootDeleg.indexOf(\"org.hotswap.agent\") == -1) {" +
                        "$$ha$bootDeleg = $$ha$bootDeleg.trim();" +
                        "if (!$$ha$bootDeleg.isEmpty()) {" +
                            "$$ha$bootDeleg = $$ha$bootDeleg + \", \";" +
                        "}" +
                        "$$ha$bootDeleg = $$ha$bootDeleg + \"" + BOOTDELEGATION_PACKAGES + "\";" +
                        "$1.put(\"" + FRAMEWORK_BOOTDELEGATION + "\", $$ha$bootDeleg);" +
                    "}" +
                "}"
        );
//        declaredConstructor.insertAfter(PluginManagerInvoker.buildInitializePlugin(GlassFishPlugin.class));
        LOGGER.debug("Class 'org.apache.felix.framework.Felix' patched in classLoader {}.");
    
<no_super_class>