Package scala.tools.asm

Examples of scala.tools.asm.ClassWriter


        className.startsWith("instrumented/"));
  }

        public byte[] transform(final ClassLoader classLoader, final String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) {
          if (shouldTransform(className)) {
            ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS) {
              @Override protected String getCommonSuperClass(final String type1, final String type2) {
                // Since we are not recomputing stack frame map, this should never be called we override this method because
                // default implementation uses reflection for implementation and might try to load the class that we are
                // currently processing. That leads to weird results like swallowed exceptions and classes being not
                // transformed.
                throw new RuntimeException("Unexpected call to getCommonSuperClass(" + type1 + ", " + type2 +
                    ") while transforming " + className);
              }
            };
                ProfilerVisitor visitor = new ProfilerVisitor(writer);
                ClassReader reader = new ClassReader(classfileBuffer);
                reader.accept(visitor, 0);
                return writer.toByteArray();
          } else {
            return classfileBuffer;
          }
        }
View Full Code Here

TOP

Related Classes of scala.tools.asm.ClassWriter

Copyright © 2018 www.massapicom. 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.