Package javassist

Examples of javassist.CtClass.detach()


    } catch (Exception e) {
      System.err.println("Could not instrument " + name + ", " + e);
      e.printStackTrace(System.err);
    } finally {
      if (cl != null) {
        cl.detach();
      }
    }
    return b;
  }
View Full Code Here


         ctClass.addMethod(findById);
       }
       
        // Done.
        applicationClass.enhancedByteCode = ctClass.toBytecode();
        ctClass.detach();
  }

}
View Full Code Here

         {
            handleCtClass(ctClass, resource);
         }
         finally
         {
            ctClass.detach();              
         }
      }
      catch (ClassNotFoundException e)
      {
         if (forceAnnotations)
View Full Code Here

                  }
               }
            }
            finally
            {
               ctClass.detach();
            }
         }
         finally
         {
            try
View Full Code Here

  public void removeGeneratedClasses() {
    ClassPool pool = ClassPool.getDefault();
    for (Class<?> clazz : interfaces.values()) {
      CtClass ctClass = pool.getOrNull(clazz.getName());
      if (ctClass != null) {
        ctClass.detach();
        logger.debug("class {} is detached", clazz.getName());
      }
    }
  }
}
View Full Code Here

                  env.putAnnotation(ce.getAnnotation(), ce.getType(), ce.getClassName(), ce.getSignature());
               }
            }
            finally
            {
               ctClass.detach();
            }
         }
         finally
         {
            try
View Full Code Here

      String pattern = "Could not instrument {},  exception : {}";
      System.err.println(format(pattern, name, e.getMessage()));
      e.printStackTrace(System.err);
    } finally {
      if (cl != null) {
        cl.detach();
      }
    }
    return b;
  }
View Full Code Here

      }
      finally {
        try {
          if ( outputStream != null )
            outputStream.close();
          clas.detach();// release memory
        }
        catch (IOException ignore) {
        }
      }
    }
View Full Code Here

  public void removeGeneratedClasses() {
    ClassPool pool = ClassPool.getDefault();
    for (Class<?> clazz : interfaces.values()) {
      CtClass ctClass = pool.getOrNull(clazz.getName());
      if (ctClass != null) {
        ctClass.detach();
        logger.debug("class {} is detached", clazz.getName());
      }
    }
  }
}
View Full Code Here

            CtClass c = classPool.getAndRename(NoOpTypeParameterMatcher.class.getName(), className);
            c.setModifiers(c.getModifiers() | Modifier.FINAL);
            c.getDeclaredMethod("match").setBody("{ return $1 instanceof " + typeName + "; }");
            byte[] byteCode = c.toBytecode();
            c.detach();
            Method method = ClassLoader.class.getDeclaredMethod(
                    "defineClass", String.class, byte[].class, int.class, int.class);
            method.setAccessible(true);

            Class<?> generated = (Class<?>) method.invoke(classLoader, className, byteCode, 0, byteCode.length);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.