Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*    */ package org.jboss.aop.standalone;
 /*    */ 
 /*    */ import java.lang.reflect.Method;
 /*    */ import  javassist.CannotCompileException;
 /*    */ import  javassist.ClassPool;
 /*    */ import  javassist.CtClass;
 /*    */ import  javassist.NotFoundException;
 /*    */ import  javassist.scopedpool.ScopedClassPoolRepository;
/*    */ 
/*    */ 

Deprecated:
/*    */ public class StandaloneClassPool extends AOPClassPool
/*    */ {
/*    */   public StandaloneClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
/*    */   {
/* 43 */     super(cl, src, repository);
/*    */   }
/*    */ 
/*    */   public StandaloneClassPool(ClassPool src, ScopedClassPoolRepository repository)
/*    */   {
/* 48 */     super(src, repository);
/*    */   }
/*    */ 
/*    */   public Class toClass(CtClass ctClass)
/*    */     throws CannotCompileException
/*    */   {
/*    */     try
/*    */     {
/* 57 */       byte[] b = ctClass.toBytecode();
/* 58 */       Class cl = Class.forName("java.lang.ClassLoader");
/* 59 */       Method method = cl.getDeclaredMethod("defineClass"new Class[] { String.class, [B.class, Integer.TYPE, Integer.TYPE });
/*    */ 
/* 63 */       method.setAccessible(true);
/* 64 */       Object[] args = { ctClass.getName(), b, new Integer(0), new Integer(b.length) };
/*    */ 
/* 66 */       Class clazz = (Class)method.invoke(getClassLoader(), args);
/* 67 */       method.setAccessible(false);
/* 68 */       return clazz;
/*    */     }
/*    */     catch (RuntimeException e)
/*    */     {
/* 72 */       throw e;
/*    */     }
/*    */     catch (InvocationTargetException e)
/*    */     {
/* 76 */       throw new CannotCompileException(e);
/*    */     }
/*    */     catch (Exception e) {
/*    */     }
/* 80 */     throw new CannotCompileException(e);
/*    */   }
/*    */ 
/*    */   public synchronized CtClass getLocally(String classname)
/*    */     throws NotFoundException
/*    */   {
/* 86 */     return super.getLocally(classname);
/*    */   }
/*    */ }
/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
 * Qualified Name:     org.jboss.aop.standalone.StandaloneClassPool
 * JD-Core Version:    0.6.0
 */
New to GrepCode? Check out our FAQ X