Package javassist

Examples of javassist.CtClass.toBytecode()


          {
             processedClass.defrost();
             byte[] previousByteCode = processedClass.toBytecode();
             processedClass.defrost();
             processedClass.instrument(codeConverter);
             byte[] updatedByteCode = processedClass.toBytecode();
             if (!java.util.Arrays.equals(updatedByteCode, previousByteCode))
             {
               hotSwapper.registerChange(classPool.getClassLoader().loadClass(processedClass.getName()), updatedByteCode);
             }
             processedClass.defrost();
View Full Code Here


               {
                  continue;
               }
               // check if clazz should be added to classes
               clazz.defrost();
               byte[] previousByteCode = clazz.toBytecode();
               clazz.defrost();
               clazz.instrument(converter);
               if (!java.util.Arrays.equals(clazz.toBytecode(), previousByteCode))
               {
                  classes.add(clazz);
View Full Code Here

               // check if clazz should be added to classes
               clazz.defrost();
               byte[] previousByteCode = clazz.toBytecode();
               clazz.defrost();
               clazz.instrument(converter);
               if (!java.util.Arrays.equals(clazz.toBytecode(), previousByteCode))
               {
                  classes.add(clazz);
               }
               clazz.defrost();
            }
View Full Code Here

         for (CtClass clazz : classes)
         {
            AOPClassPool classPool = (AOPClassPool) clazz.getClassPool();
            clazz.defrost();
            hotSwapper.registerChange(classPool.getClassLoader().loadClass(clazz.getName()),
                  clazz.toBytecode());
         }
         // performs the hot swap of registered classes
         hotSwapper.hotSwap();
      }
      catch (Exception e) {
View Full Code Here

            if (!name.startsWith(CGLIB_ENHANCER) && !name.startsWith(CGLIB_METHOD_WRAPPER)) {
                final CtClass ctClass = classPool.get(name);
                if (ctClass.isFrozen()) {
                    ctClass.defrost();
                }
                bytes = ctClass.toBytecode();
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return bytes == null ? null : defineClass(name, bytes, 0, bytes.length);
View Full Code Here

        try {
            type = classPool.get(name);
            for (MockTransformer transformer : mockTransformerChain) {
                type = transformer.transform(type);
            }
            clazz = type.toBytecode();
        } catch (Exception e) {
            throw new IllegalStateException("Failed to transform class with name " + name + ". Reason: " + e.getMessage(), e);
        }

        return defineClass(name, clazz, 0, clazz.length);
View Full Code Here

    final ClassLoader loader = getClassLoader();
    final String className = getInternalClassName();

    final Class<?> classBeingRedefined = compiledClass.toClass( loader, loader.getClass().getProtectionDomain() );
    final byte[] classBytes = compiledClass.toBytecode();
    final ProtectionDomain protectionDomain = classBeingRedefined.getProtectionDomain();

    //Setting the context class loader to be able to parse all annotations/classes from the dependencies
    ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader();
    try {
View Full Code Here

                }
            } catch (Exception e) {
                throw new RuntimeException("Failed trying to wrap method [" + method.getName() + "] of class: " + className, e);
            }
        }
        return ctClazz.toBytecode();
    }

}
View Full Code Here

        try {
          cc = pool.makeClass(new ByteArrayInputStream(bytes));
     
      if (cc.subtypeOf(pool.get(ActiveRecord.class.getName())) && furtherCheckAllowedToChange(cc)) {
        addMethods(cc, ClassWorkSource.arMethods);
        result = cc.toBytecode();
      }
      else {
        result = bytes;
      }
    } catch (Exception ex) {
View Full Code Here

               {
                  continue;
               }
               // check if clazz should be added to classes
               clazz.defrost();
               byte[] previousByteCode = clazz.toBytecode();
               clazz.defrost();
               clazz.instrument(converter);
               if (!java.util.Arrays.equals(clazz.toBytecode(), previousByteCode))
               {
                  classes.add(clazz);
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.