Package javassist

Examples of javassist.CtClass.toBytecode()


                for (String newName : nameReplacements.keySet()) {
                    String oldName = nameReplacements.get(newName);
                    nc.replaceClassName(newName, oldName);
                }
                AddedClass ncd = new AddedClass(o.getValue(), nc.toBytecode(), o.getKey().getClassLoader());
                newClasses[count++] = ncd;
            }

            if (useFakereplace) {
                Agent.redefine(definitions, newClasses);
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 (AspectManager.debugClasses)
             {
                SecurityActions.debugWriteFile(clazz);
             }

             byte[] rtn = clazz.toBytecode();
             if (AspectManager.getPrune()) clazz.prune();
             return rtn;
          }
          else
          {
View Full Code Here

            throw new UnexpectedException("Error in PropertiesEnhancer", e);
        }

        if (isScala(applicationClass)) {
            // Temporary hack for Scala. Done.
            applicationClass.enhancedByteCode = ctClass.toBytecode();
            ctClass.defrost();
            return;
        }

        for (CtField ctField : ctClass.getDeclaredFields()) {
View Full Code Here

                }
            });
        }

        // Done.
        applicationClass.enhancedByteCode = ctClass.toBytecode();
        ctClass.defrost();
    }

    /**
     * Is this field a valid javabean property ?
View Full Code Here

            method.insertAfter("play.classloading.enhancers.LocalvariablesNamesEnhancer.LocalVariablesNamesTracer.exit();", true);

        }

        // Done.
        applicationClass.enhancedByteCode = ctClass.toBytecode();
        ctClass.defrost();

    }

    /**
 
View Full Code Here

        CtClass cc = cp.makeClass(new java.io.ByteArrayInputStream(classfileBuffer));
        for (CtMethod m : cc.getDeclaredMethods()) {
          m.insertBefore("org.stagemonitor.requestmonitor.profiler.Profiler.start();");
          m.insertAfter("org.stagemonitor.requestmonitor.profiler.Profiler.stop(\""+m.getLongName()+"\");", true);
        }
        byteCode = cc.toBytecode();
        cc.detach();
      } catch (Exception ex) {
        throw new RuntimeException(ex);
      }
    }
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);
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.