All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zeroturnaround.javarebel.integration.equinox.EquinoxClassPathManagerClassBytecodeProcessor Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
package org.zeroturnaround.javarebel.integration.equinox;

import org.zeroturnaround.bundled.javassist.ClassPool;
import org.zeroturnaround.bundled.javassist.CtClass;
import org.zeroturnaround.bundled.javassist.CtMethod;
import org.zeroturnaround.javarebel.integration.support.JavassistClassBytecodeProcessor;

public class EquinoxClassPathManagerClassBytecodeProcessor extends
    JavassistClassBytecodeProcessor {
  
  public void process(ClassPool cp, ClassLoader cl, CtClass ctClass) throws Exception {
    CtMethod m = 
      ctClass.getMethod(
          "findLocalClassImpl", 
          "(Ljava/lang/String;[Lorg/eclipse/osgi/baseadaptor/hooks/ClassLoadingStatsHook;)Ljava/lang/Class;");
    
    m.insertBefore(
        "{   synchronized (classloader) {" + 
        "      Class result =" + 
        "        classloader.publicFindLoaded($1);" + 
        "      if (result != null)" + 
        "        return result;" + 
        "      result = " + 
        "        org.zeroturnaround.javarebel.IntegrationFactory.getInstance()" + 
        "          .findReloadableClass((ClassLoader) classloader, $1);" + 
        "      if (result != null)" + 
        "        return result;" + 
        "    }}");
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy