Perform the given instrumentation actions on a class.
@param classfileBuffer class to be transformed
@param instrumentationActions instrumentation actions to be applied
@return instrumented class
508348
private byte[] transform(byte[] classfileBuffer, InstrumentationActions instrumentationActions) {
		ClassReader classReader = new ClassReader(classfileBuffer);
		ClassWriter classWriter = new ClassWriter(classReader, ClassWriter.COMPUTE_FRAMES);
		ClassVisitor localVariableStateEmitterTestClassVisitor = new StateTrackingClassVisitor(classWriter,
				instrumentationActions);
		classReader.accept(localVariableStateEmitterTestClassVisitor, 0);
		return classWriter.toByteArray();
	}
134167
synchronized void activate(ComponentContext componentContext) throws Exception {
        this.componentContext = componentContext;
        this.classAvailableTransformer = new ClassAvailableTransformer(this, instrumentation, includeBootstrap);
        this.transformer = new ProbeClassFileTransformer(this, instrumentation, includeBootstrap);
        this.proxyActivator = new MonitoringProxyActivator(componentContext.getBundleContext(), this, this.instrumentation);
        this.proxyActivator.activate();
        // The class available transformer is registered as retransform incapable
        // to avoid having to keep track of which classes have been updated with
        // static initializers and serialVersionUID fields.  The probe transformer
        // however, must run through the listener config every time a retransform
        // occurs to allow it to discover new probes and replace currently active
        // probes

        //RTCD 89497-Update the set with the classes
        for (Class<?> clazz : MonitoringUtility.loadMonitoringClasses(componentContext.getBundleContext().getBundle())) {
            for (int i = 0; i < clazz.getMethods().length; i++) {
                Annotation anno = ((clazz.getMethods()[i]).getAnnotation(ProbeSite.class));
                if (anno != null) {
                    String temp = ((ProbeSite) anno).clazz();
                    probeMonitorSet.add(temp);
                }
            }
        }
        //Update to the set ended.

        //RTC D89497 adding instrumentors moved below as the MonitoringUtility.loadMonitoringClasses
        //was resulting in loading classes and in turn getting called during with transform process which
        //might cause hang in some situations
        this.instrumentation.addTransformer(this.transformer, true);
        this.instrumentation.addTransformer(this.classAvailableTransformer);
        // We're active so if we have any listeners, we can run down the loaded
        // classes.
        for (Class<?> clazz : this.instrumentation.getAllLoadedClasses()) {
            classAvailable(clazz);
        }
    }
428871
@Override
    public void visitClassContext(ClassContext classContext) {
        currentClass = classContext.getJavaClass();

        if (currentClass.getMajor() >= Const.MAJOR_1_8) {
            try {
                stack = new OpcodeStack();
                activeStackOps = new ArrayDeque<>();
                super.visitClassContext(classContext);
            } finally {
                activeStackOps = null;
                stack = null;
            }
        }
        currentClass = null;
    }
1320847
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            ignoreRegs = new BitSet();
            tryBlocks = new BitSet();
            catchHandlers = new BitSet();
            switchTargets = new BitSet();
            monitorSyncPCs = new ArrayList<>(5);
            stack = new OpcodeStack();
            super.visitClassContext(classContext);
        } finally {
            ignoreRegs = null;
            tryBlocks = null;
            catchHandlers = null;
            switchTargets = null;
            monitorSyncPCs = null;
            stack = null;
        }
    }
506954
public static Instrumentation initAgentAtRuntimeAndReportSuccess() {
        try {
            setSystemClassLoaderClassPath();
        } catch (Exception e) {
            Log.e("Could not set classpath. Tool will be off.", e);
            return null;
        }
        try {
            return addClassfileTransformer();
        } catch (Exception e) {
            Log.e("Could not add transformer. Tool will be off.", e);
            return null;
        }
    }
1062258
@Override
    public void scan(ClassSource_Aggregate classSource, Set<String> specificClassNames) throws AnnotationTargets_Exception {
        try {
            createScanner(classSource).scan(specificClassNames);
            // 'createScanner' throws class source exception

        } finally {
            haveScannedDirectClasses = true;
            haveScannedReferencedClasses = true;
        }
    }
1288258
@Requires("bytecode != null")
  @Ensures("result != null")
  public byte[] transformWithDebug(byte[] bytecode)
      throws IllegalClassFormatException {
    try {
      return instrumentWithDebug(bytecode);
    } catch (Throwable t) {
      /* If the class file contains errors, ASM will just crash. */
      IllegalClassFormatException e = new IllegalClassFormatException();
      e.initCause(t);
      throw e;
    }
  }
806885
public static synchronized void setInstrumentation(Instrumentation inst) {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "setInstrumentation", inst);

        instrumentation = inst;

        if (instrumentation == null) {
        } else if (isJava8TraceEnabled) {
        	setInjectAtTransform(true); //We always inject at transform in this workaround transformer. Either all or nothing here.
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "setInstrumentation");
    }
1353363
public static final void indexAllClasses(final Indexer indexer, final List<File> classFiles) {
        classFiles.forEach(file -> {
            try {
                final InputStream in = new FileInputStream(file);
                try {
                    indexer.index(in);
                } finally {
                    in.close();
                }
            } catch (final IOException ex) {
                throw new RuntimeException(ex);
            }
        });
    }
1351884
protected function setupInstrumentationProcessor()
	{
		$file = $this->cacheDirectory . '/' . $this->contextName . '/instrument.php';
		
		if(is_file($file))
		{
			$this->instrumentationProcessor = new InstrumentationProcessor($this, require $file);
			$this->instrumentationProcessor->registertAutoload();
		}
	}
745791
protected void doScanDirectClasses() throws AnnotationTargets_Exception {
        if (haveScannedDirectClasses) {
            return;
        }

        haveScannedDirectClasses = true;

        if (rootClassSource == null) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "Call to scan direct classes before activation");
            }

        } else {
            if (directClassSourceCount == 0) {
                if (tc.isDebugEnabled()) {
                    Tr.debug(tc, "Strange call to scan direct classes before adding direct class sources");
                }
            }

            createScanner(rootClassSource).scanDirect();
            // 'createScanner' and 'scanDirect' both throw AnnotationTargets_Exception
        }
    }
281578
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            JavaClass cls = classContext.getJavaClass();
            constrainingMethods = buildConstrainingMethods(cls);
            AnnotationEntry[] annotations = cls.getAnnotationEntries();
            classHasAnnotation = !CollectionUtils.isEmpty(annotations);
            stack = new OpcodeStack();
            selfCallTree = new HashMap<>();
            super.visitClassContext(classContext);

            performModifyStateClosure(classContext.getJavaClass());

        } finally {
            stack = null;
            selfCallTree = null;
            curMethod = null;
            constrainingMethods = null;
        }
    }
685786
public void addActiveProbesforListener(ProbeListener listener, Collection<ProbeImpl> probes) {
        // Add the probes for the specified listener.  This is purely additive.
        // Since a listener's configuration can't be updated after registration,
        // we're adding probes for recently initialized / modified classes.
        addProbesByListener(listener, probes);

        for (ProbeImpl probe : probes) {
            addListenerByProbe(probe, listener);
        }
    }
230884
public CoverageBuilder analyzeFiles(ExecutionDataStore executionDataStore, Collection<File> classFiles) {
    CoverageBuilder coverageBuilder = new CoverageBuilder();
    if (useCurrentBinaryFormat) {
      Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
      for (File classFile : classFiles) {
        analyzeClassFile(analyzer, classFile);
      }
    } else {
      org.jacoco.previous.core.analysis.Analyzer analyzer = new org.jacoco.previous.core.analysis.Analyzer(executionDataStore, coverageBuilder);
      for (File classFile : classFiles) {
        analyzeClassFile(analyzer, classFile);
      }
    }
    return coverageBuilder;
  }
870518
private void scanClasses() throws PersistenceUnitScannerException {
        try {
            for (URL url : urlSet) {
                final HashSet<ClassInfoType> citSet = new HashSet<ClassInfoType>();
                final String urlProtocol = url.getProtocol();
                if ("file".equalsIgnoreCase(urlProtocol)) {
                    // Protocol is "file", which either addresses a jar file or an exploded jar file
                    final Path taPath = Paths.get(url.toURI());
                    if (Files.isDirectory(taPath)) {
                        // Exploded Archive
                        citSet.addAll(processExplodedJarFormat(taPath));
                    } else {
                        // Unexploded Archive
                        citSet.addAll(processUnexplodedFile(taPath));
                    }
                } else if (url.toString().startsWith("jar:file")) {
                    citSet.addAll(processJarFileURL(url));
                } else {
                    // InputStream will be in jar format.
                    citSet.addAll(processJarFormatInputStreamURL(url));
                }

                processInnerClasses(citSet);
                scannedClassesMap.put(url, citSet);
            }
        } catch (Exception e) {
            FFDCFilter.processException(e, PersistenceUnitScanner.class.getName() + ".scanClasses", "118");
            throw new PersistenceUnitScannerException(e);
        }
    }
112807
protected void addSpecialMethods(ClassFile proxyClassType, ClassMethod staticConstructor) {
        try {
            // Add special methods for interceptors
            for (Method method : LifecycleMixin.class.getMethods()) {
                BeanLogger.LOG.addingMethodToProxy(method);
                MethodInformation methodInfo = new RuntimeMethodInformation(method);
                createInterceptorBody(proxyClassType.addMethod(method), methodInfo, false, staticConstructor);
            }
            Method getInstanceMethod = TargetInstanceProxy.class.getMethod("weld_getTargetInstance");
            Method getInstanceClassMethod = TargetInstanceProxy.class.getMethod("weld_getTargetClass");
            generateGetTargetInstanceBody(proxyClassType.addMethod(getInstanceMethod));
            generateGetTargetClassBody(proxyClassType.addMethod(getInstanceClassMethod));

            Method setMethodHandlerMethod = ProxyObject.class.getMethod("weld_setHandler", MethodHandler.class);
            generateSetMethodHandlerBody(proxyClassType.addMethod(setMethodHandlerMethod));

            Method getMethodHandlerMethod = ProxyObject.class.getMethod("weld_getHandler");
            generateGetMethodHandlerBody(proxyClassType.addMethod(getMethodHandlerMethod));
       } catch (Exception e) {
            throw new WeldException(e);
        }
    }
1316345
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            stack = new OpcodeStack();
            suspectLocals = new HashMap<>();
            classVersion = classContext.getJavaClass().getMajor();
            super.visitClassContext(classContext);
        } finally {
            stack = null;
            suspectLocals = null;
        }
    }